@@ -135,7 +135,7 @@ public function syncServerDirectory(Server $server, string $localPath, string $r
135135 $ serverConfig ,
136136 $ localPath ,
137137 $ remotePath ,
138- Cache:: pull ($ chunkKey ) ?? [] ,
138+ app ( self ::class)-> pullChunkFromCache ($ chunkKey ),
139139 $ worker ,
140140 $ releaseId ,
141141 );
@@ -195,7 +195,7 @@ public function syncDirectory(SFTP $sftp, string $localPath, string $remotePath,
195195 }
196196
197197 if ($ onProgress ) {
198- $ onProgress (' upload ' , $ relative );
198+ $ onProgress ($ relative );
199199 }
200200 }
201201
@@ -244,7 +244,7 @@ protected function deleteRemovedFiles(SFTP $sftp, string $localPath, string $rem
244244
245245 if (! $ disk ->exists ($ localItem )) {
246246 if ($ onProgress ) {
247- $ onProgress (' delete ' , $ currentRelative );
247+ $ onProgress ($ currentRelative );
248248 }
249249 $ sftp ->delete ($ remoteItem , true );
250250 } elseif ($ type === 2 ) { // NET_SFTP_TYPE_DIRECTORY
@@ -284,6 +284,20 @@ protected function ensureLocalDir(string $dir): void
284284 }
285285 }
286286
287+ /**
288+ * @return array<int, string>
289+ */
290+ public function pullChunkFromCache (string $ key ): array
291+ {
292+ $ chunk = Cache::pull ($ key );
293+
294+ if (! is_array ($ chunk )) {
295+ return [];
296+ }
297+
298+ return array_values (array_filter ($ chunk , 'is_string ' ));
299+ }
300+
287301 private function normalizeLocalPath (string $ path , string $ diskRoot ): string
288302 {
289303 $ normalized = str_replace ('\\' , '/ ' , $ path );
@@ -388,7 +402,7 @@ protected function buildProgressLogger(?int $releaseId, int $worker, array $rela
388402 $ logEveryFiles = max (1 , $ this ->requireInt (config ('services.sftp.progress_every_files ' , 100 ), 'SFTP progress file interval ' ));
389403 $ logEverySeconds = max (0.0 , $ this ->requireFloat (config ('services.sftp.progress_every_seconds ' , 3 ), 'SFTP progress time interval ' ));
390404
391- return static function (string $ action , string $ relativePath ) use ($ releaseId , $ worker , $ totalFiles , &$ completedFiles , &$ lastLoggedAt , $ logEveryFiles , $ logEverySeconds ): void {
405+ return static function (string $ relativePath ) use ($ releaseId , $ worker , $ totalFiles , &$ completedFiles , &$ lastLoggedAt , $ logEveryFiles , $ logEverySeconds ): void {
392406 $ completedFiles ++;
393407 $ now = microtime (true );
394408
0 commit comments