2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-05 09:17:18 +08:00

特性(命令行):优化升级流程

This commit is contained in:
耗子
2022-12-01 15:04:31 +08:00
parent 0e4f5cc29d
commit b32f8ececf

View File

@@ -91,6 +91,14 @@ class Panel extends Command
*/
private function update(): void
{
/**
* 检查当前是否有任务正在运行
*/
if (Task::query()->where('status', '!=', 'finished')->count()) {
$this->error('当前有任务正在运行,请稍后再试');
$this->info('如需强制更新请先执行panel cleanRunningTask');
return;
}
$this->info('正在下载面板...');
$this->info(shell_exec('wget -O /tmp/panel.zip https://api.panel.haozi.xyz/api/version/latest'));
$this->info('正在备份数据库...');
@@ -228,7 +236,10 @@ class Panel extends Command
*/
private function cleanRunningTask(): void
{
// 更新任务状态
Task::query()->update(['status' => 'finished']);
// 将所有队列任务清空
shell_exec('php-panel /www/panel/artisan queue:clear');
$this->info('成功');
}
}