|
@@ -5,25 +5,40 @@ cd "$(dirname "$0")" || exit 1
|
|
# 引入依赖脚本
|
|
# 引入依赖脚本
|
|
source scripts/lib.sh
|
|
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
|
|
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
|
|
# 检查Composer
|
|
print_message "Checking Composer..." "检查Composer..."
|
|
print_message "Checking Composer..." "检查Composer..."
|
|
check_composer
|
|
check_composer
|
|
|
|
|
|
-# 清理优化缓存
|
|
|
|
-print_message "Cleaning panel cache..." "清理面板缓存..."
|
|
|
|
-php artisan optimize:clear
|
|
|
|
-
|
|
|
|
# 执行Composer更新
|
|
# 执行Composer更新
|
|
print_message "Updating packages via Composer..." "通过Composer更新程序包..."
|
|
print_message "Updating packages via Composer..." "通过Composer更新程序包..."
|
|
composer update --no-interaction --no-dev --optimize-autoloader
|
|
composer update --no-interaction --no-dev --optimize-autoloader
|
|
|
|
|
|
-# 执行Panel更新
|
|
|
|
-php artisan panel:update
|
|
|
|
-
|
|
|
|
# 设置权限
|
|
# 设置权限
|
|
set_permissions
|
|
set_permissions
|
|
|
|
|
|
@@ -32,4 +47,6 @@ update_old_queue
|
|
|
|
|
|
# 检查最新的IP数据库文件
|
|
# 检查最新的IP数据库文件
|
|
print_message "Updating IP database files..." "更新本地IP数据库文件..."
|
|
print_message "Updating IP database files..." "更新本地IP数据库文件..."
|
|
-cd scripts/ && bash download_dbs.sh
|
|
|
|
|
|
+(cd scripts/ && bash download_dbs.sh)
|
|
|
|
+
|
|
|
|
+print_message "Panel update completed successfully!" "面板更新完成!"
|