mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-09 03:22:51 +08:00
完善更新逻辑
This commit is contained in:
@@ -78,6 +78,7 @@ class AdminUpdateServiceBase
|
|||||||
$output->writeln('重装代码');
|
$output->writeln('重装代码');
|
||||||
} else {
|
} else {
|
||||||
$this->cleanWorkpaceDir();
|
$this->cleanWorkpaceDir();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,23 +127,23 @@ class AdminUpdateServiceBase
|
|||||||
->toArray()
|
->toArray()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$ignore_prefix = [
|
||||||
|
'runtime',
|
||||||
|
'vendor',
|
||||||
|
'.git',
|
||||||
|
];
|
||||||
|
|
||||||
// 当前版本的所有文件
|
// 当前版本的所有文件
|
||||||
$current_version_files = $current_version_filesystem->listContents('/', true)
|
$current_version_files = $current_version_filesystem->listContents('/', true)
|
||||||
->filter(function (StorageAttributes $attributes) {
|
->filter(function (StorageAttributes $attributes) use ($ignore_prefix) {
|
||||||
if ($attributes->isDir()) {
|
if ($attributes->isDir()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($attributes->path(), 'runtime') === 0) {
|
foreach ($ignore_prefix as $prefix) {
|
||||||
return false;
|
if (str_starts_with($attributes->path(), $prefix)) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
if (strpos($attributes->path(), 'vendor') === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strpos($attributes->path(), '.git') === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -152,17 +153,15 @@ class AdminUpdateServiceBase
|
|||||||
|
|
||||||
// 最新版本的所有文件
|
// 最新版本的所有文件
|
||||||
$last_version_files = $last_version_filesystem->listContents('/', true)
|
$last_version_files = $last_version_filesystem->listContents('/', true)
|
||||||
->filter(function (StorageAttributes $attributes) {
|
->filter(function (StorageAttributes $attributes) use ($ignore_prefix) {
|
||||||
if ($attributes->isDir()) {
|
if ($attributes->isDir()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($attributes->path(), 'runtime') === 0) {
|
foreach ($ignore_prefix as $prefix) {
|
||||||
return false;
|
if (str_starts_with($attributes->path(), $prefix)) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
if (strpos($attributes->path(), 'vendor') === 0) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -255,9 +254,10 @@ class AdminUpdateServiceBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(empty($need_process_files)){
|
if (empty($need_process_files)) {
|
||||||
$output->writeln('没有需要更新的文件');
|
$output->writeln('没有需要更新的文件');
|
||||||
$this->cleanWorkpaceDir();
|
$this->cleanWorkpaceDir();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user