From 39fe6fa0811284d9111de66f55fd7588d9bdbd95 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 15 Oct 2023 15:45:34 +0800 Subject: [PATCH] fix copyDir for FreeBSD and add debug message --- src/SPC/store/FileSystem.php | 3 ++- src/SPC/store/SourceExtractor.php | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SPC/store/FileSystem.php b/src/SPC/store/FileSystem.php index 192134da..9ae82889 100644 --- a/src/SPC/store/FileSystem.php +++ b/src/SPC/store/FileSystem.php @@ -132,6 +132,7 @@ class FileSystem break; case 'Linux': case 'Darwin': + case 'BSD': f_passthru('cp -r "' . $src_path . '" "' . $dst_path . '"'); break; } @@ -154,7 +155,7 @@ class FileSystem if ($move_path !== null) { $move_path = SOURCE_PATH . '/' . $move_path; } - logger()->info("extracting {$name} source"); + logger()->info("extracting {$name} source to " . ($move_path ?? SOURCE_PATH . "/{$name}") . ' ...'); try { $target = $move_path ?? (SOURCE_PATH . "/{$name}"); // Git source, just move diff --git a/src/SPC/store/SourceExtractor.php b/src/SPC/store/SourceExtractor.php index fd8f1e54..66a96c25 100644 --- a/src/SPC/store/SourceExtractor.php +++ b/src/SPC/store/SourceExtractor.php @@ -59,9 +59,12 @@ class SourceExtractor } // check source dir exist - $check = $lock[$source]['move_path'] === null ? SOURCE_PATH . '/' . $source : SOURCE_PATH . '/' . $lock[$source]['move_path']; + $check = $lock[$source]['move_path'] === null ? (SOURCE_PATH . '/' . $source) : (SOURCE_PATH . '/' . $lock[$source]['move_path']); if (!is_dir($check)) { + logger()->debug('Extracting source [' . $source . '] to ' . $check . ' ...'); FileSystem::extractSource($source, DOWNLOAD_PATH . '/' . ($lock[$source]['filename'] ?? $lock[$source]['dirname']), $lock[$source]['move_path']); + } else { + logger()->debug('Source [' . $source . '] already extracted in ' . $check . ', skip !'); } } }