mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-09 03:22:51 +08:00
调整更新的文件替换逻辑;
This commit is contained in:
@@ -11,7 +11,6 @@ use League\Flysystem\Local\LocalFilesystemAdapter;
|
|||||||
use League\Flysystem\StorageAttributes;
|
use League\Flysystem\StorageAttributes;
|
||||||
use think\console\Command;
|
use think\console\Command;
|
||||||
use think\console\Input;
|
use think\console\Input;
|
||||||
use think\console\input\Option;
|
|
||||||
use think\console\Output;
|
use think\console\Output;
|
||||||
use think\facade\App;
|
use think\facade\App;
|
||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
@@ -24,7 +23,6 @@ class Update extends Command
|
|||||||
{
|
{
|
||||||
// 指令配置
|
// 指令配置
|
||||||
$this->setName('admin:update')
|
$this->setName('admin:update')
|
||||||
->addOption('show-diff', null, Option::VALUE_NONE, 'show changed files diff')
|
|
||||||
->setDescription('the admin:update command');
|
->setDescription('the admin:update command');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,12 +146,10 @@ class Update extends Command
|
|||||||
foreach ($changed_files as $file_path => $compare_result) {
|
foreach ($changed_files as $file_path => $compare_result) {
|
||||||
$output->warning($file_path);
|
$output->warning($file_path);
|
||||||
|
|
||||||
if ($input->hasOption('show-diff')) {
|
|
||||||
if (is_string($compare_result)) {
|
if (is_string($compare_result)) {
|
||||||
$output->writeln($compare_result);
|
$output->writeln($compare_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$file_count = count($changed_files);
|
$file_count = count($changed_files);
|
||||||
|
|
||||||
@@ -197,18 +193,21 @@ class Update extends Command
|
|||||||
->map(fn (StorageAttributes $attributes) => $attributes->path())
|
->map(fn (StorageAttributes $attributes) => $attributes->path())
|
||||||
->toArray();
|
->toArray();
|
||||||
|
|
||||||
// 删除当前版本要替换的文件
|
$delete_files = array_diff($last_version_list_files, $current_version_list_files);
|
||||||
foreach ($current_version_list_files as $file_path) {
|
|
||||||
|
foreach ($delete_files as $file_path) {
|
||||||
$now_file_path = $now_dir . '/' . $file_path;
|
$now_file_path = $now_dir . '/' . $file_path;
|
||||||
unlink($now_file_path);
|
unlink($now_file_path);
|
||||||
}
|
}
|
||||||
// 将最新版本要替换的文件替换到项目代码中
|
|
||||||
foreach ($last_version_list_files as $file_path) {
|
|
||||||
$last_file_path = $last_version_dir . '/' . $file_path;
|
|
||||||
$now_file_path = $now_dir . '/' . $file_path;
|
|
||||||
PathTools::intiDir($now_file_path);
|
|
||||||
|
|
||||||
copy($last_file_path, $now_file_path);
|
foreach ($last_version_list_files as $file_path) {
|
||||||
|
$now_file_path = $now_dir . '/' . $file_path;
|
||||||
|
$last_file_path = $last_version_dir . '/' . $file_path;
|
||||||
|
|
||||||
|
$file_content = file_get_contents($last_file_path);
|
||||||
|
|
||||||
|
PathTools::intiDir($now_file_path);
|
||||||
|
file_put_contents($now_file_path, $file_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测now的composer依赖和最新的composer依赖
|
// 检测now的composer依赖和最新的composer依赖
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ use think\facade\App;
|
|||||||
|
|
||||||
class Version extends Command
|
class Version extends Command
|
||||||
{
|
{
|
||||||
public const VERSION = 'v2.0.32';
|
public const VERSION = 'v2.0.33';
|
||||||
|
|
||||||
public const LAYUI_VERSION = '2.8.16';
|
public const LAYUI_VERSION = '2.8.16';
|
||||||
|
|
||||||
public const COMMENT = [
|
public const COMMENT = [
|
||||||
'重新集成数据库迁移工具',
|
'调整更新的文件替换逻辑;',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function configure()
|
protected function configure()
|
||||||
|
|||||||
Reference in New Issue
Block a user