diff --git a/app/Console/Commands/PanelUpdate.php b/app/Console/Commands/PanelUpdate.php deleted file mode 100644 index a35f0994..00000000 --- a/app/Console/Commands/PanelUpdate.php +++ /dev/null @@ -1,59 +0,0 @@ -output->createProgressBar(2); - $bar->minSecondsBetweenRedraws(0); - $this->displayBanner(); - $bar->start(); - $this->updateDatabase(); - - $bar->advance(); - $this->updateCache(); - - $bar->finish(); - $this->info(trans('setup.update_complete')); - } - - private function displayBanner(): void - { - $banner = << < | |_| |/ ___/ | (_| || | | || __/| | -\/ |_| \___/ /_/\_\ \__, |\/ \__,_||_| |_| \___||_| - |___/ - -BANNER; - - $this->info($banner); - } - - private function updateDatabase(): void - { - $this->line(trans('setup.update_db')); - Artisan::call('migrate --force'); - - if (config('app.env') === 'demo' && $this->confirm(trans('setup.demo_reset'))) { - Artisan::call('migrate:fresh --seed --force'); - } - } - - private function updateCache(): void - { - $this->line(trans('setup.update_cache')); - Artisan::call('optimize'); - } -} diff --git a/app/Providers/SettingServiceProvider.php b/app/Providers/SettingServiceProvider.php index 6d7fe41e..39208947 100644 --- a/app/Providers/SettingServiceProvider.php +++ b/app/Providers/SettingServiceProvider.php @@ -55,8 +55,8 @@ class SettingServiceProvider extends ServiceProvider ->merge(collect(['is_onlinePay' => $settings->whereIn('name', $payments)->pluck('value')->filter()->isNotEmpty()])) // 设置在线支付开关 ->sortKeys() ->toArray(); - $modified['tasks_clean'] = json_decode($modified['tasks_clean'], true); - $modified['tasks_close'] = json_decode($modified['tasks_close'], true); + $modified['tasks_clean'] = json_decode($modified['tasks_clean'] ?? '', true); + $modified['tasks_close'] = json_decode($modified['tasks_close'] ?? '', true); config(['settings' => $modified]); // 设置系统参数 diff --git a/resources/lang/de/setup.php b/resources/lang/de/setup.php deleted file mode 100644 index 64329e8f..00000000 --- a/resources/lang/de/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - 'Sie sind im Demo-Modus. Möchten Sie die Datenbank zurücksetzen?', - 'update_cache' => 'Cache aktualisieren...', - 'update_complete' => 'Aktualisierung abgeschlossen!', - 'update_db' => 'Datenbank aktualisieren...', -]; diff --git a/resources/lang/en/setup.php b/resources/lang/en/setup.php deleted file mode 100644 index a7245dd9..00000000 --- a/resources/lang/en/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - 'You have been detected in Demo mode, do you reset the database?', - 'update_cache' => 'Update cache...', - 'update_complete' => 'Update Completed! ', - 'update_db' => 'Update Database...', -]; diff --git a/resources/lang/fa/setup.php b/resources/lang/fa/setup.php deleted file mode 100644 index a407e540..00000000 --- a/resources/lang/fa/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - 'شناسایی شد که شما در حالت دمو هستید. آیا می‌خواهید پایگاه داده را بازنشانی کنید؟', - 'update_cache' => 'به‌روزرسانی کش...', - 'update_complete' => 'به‌روزرسانی کامل شد!', - 'update_db' => 'به‌روزرسانی پایگاه داده...', -]; diff --git a/resources/lang/ja/setup.php b/resources/lang/ja/setup.php deleted file mode 100644 index 5ba84602..00000000 --- a/resources/lang/ja/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - 'DEMOモードであることが検出されました。データベースをリセットしますか?', - 'update_cache' => 'キャッシュを更新しています...', - 'update_complete' => '업데이트 완료!', - 'update_db' => 'データベースを更新しています...', -]; diff --git a/resources/lang/ko/setup.php b/resources/lang/ko/setup.php deleted file mode 100644 index 6a0c8687..00000000 --- a/resources/lang/ko/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - '데모 모드가 감지되었습니다. 데이터베이스를 재설정하시겠습니까?', - 'update_cache' => '캐시 업데이트 중...', - 'update_complete' => '업데이트 완료!', - 'update_db' => '데이터베이스 업데이트 중...', -]; diff --git a/resources/lang/vi/setup.php b/resources/lang/vi/setup.php deleted file mode 100644 index 7a6cd38b..00000000 --- a/resources/lang/vi/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - 'Phát hiện bạn đang ở chế độ Demo, bạn có muốn đặt lại cơ sở dữ liệu không?', - 'update_cache' => 'Cập nhật bộ nhớ đệm...', - 'update_complete' => 'Cập nhật hoàn tất!', - 'update_db' => 'Cập nhật cơ sở dữ liệu...', -]; diff --git a/resources/lang/zh_CN/setup.php b/resources/lang/zh_CN/setup.php deleted file mode 100644 index c346b363..00000000 --- a/resources/lang/zh_CN/setup.php +++ /dev/null @@ -1,10 +0,0 @@ - '检测到您在DEMO模式, 是否重置数据库?', - 'update_cache' => '更新缓存...', - 'update_complete' => '更新完毕!', - 'update_db' => '更新数据库...', -]; diff --git a/scripts/lib.sh b/scripts/lib.sh index eb7dbceb..c0eb02ec 100644 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -5,6 +5,18 @@ function print_message() { echo -e "\e[34m========= $1 | $2 =========\e[0m" } +function print_logo() { +cat << "EOF" + ___ ___ _ + / _ \ _ __ ___ __ __ _ _ / _ \ __ _ _ __ ___ | | + / /_)/| '__| / _ \ \ \/ /| | | | / /_)/ / _` || '_ \ / _ \| | +/ ___/ | | | (_) | > < | |_| |/ ___/ | (_| || | | || __/| | +\/ |_| \___/ /_/\_\ \__, |\/ \__,_||_| |_| \___||_| + |___/ + +EOF +} + # 安装依赖 install_dependencies() { # 判断系统 diff --git a/update.sh b/update.sh index 5ed7d7d4..746e5219 100644 --- a/update.sh +++ b/update.sh @@ -5,25 +5,40 @@ cd "$(dirname "$0")" || exit 1 # 引入依赖脚本 source scripts/lib.sh +print_message "Starting panel update..." "开始面板更新..." + +print_logo + # 更新代码 -print_message "Checking server environment..." "检查服务器环境..." +print_message "updating Code..." "更新代码..." git fetch -f && git reset -q --hard origin/master && git pull +# 更新数据库 +print_message "Updating database..." "更新数据库..." +php artisan migrate --force + +# 如果是演示环境,询问是否重置数据库 +if [[ $(grep -E '^APP_ENV=demo' .env) ]]; then + read -p "Reset demo database? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + print_message "Resetting demo database..." "重置演示数据库..." + php artisan migrate:fresh --seed --force + fi +fi + +# 优化缓存 +print_message "Optimizing application cache..." "优化应用缓存..." +php artisan optimize + # 检查Composer print_message "Checking Composer..." "检查Composer..." check_composer -# 清理优化缓存 -print_message "Cleaning panel cache..." "清理面板缓存..." -php artisan optimize:clear - # 执行Composer更新 print_message "Updating packages via Composer..." "通过Composer更新程序包..." composer update --no-interaction --no-dev --optimize-autoloader -# 执行Panel更新 -php artisan panel:update - # 设置权限 set_permissions @@ -32,4 +47,6 @@ update_old_queue # 检查最新的IP数据库文件 print_message "Updating IP database files..." "更新本地IP数据库文件..." -cd scripts/ && bash download_dbs.sh \ No newline at end of file +(cd scripts/ && bash download_dbs.sh) + +print_message "Panel update completed successfully!" "面板更新完成!" \ No newline at end of file