deploy.sh 增加配置缓存重建步骤
git pull 之后执行 php artisan config:clear 与 config:cache,避免修改 config/*(如本次 PDO 弃用修复)后 Laravel 仍读旧缓存导致改动不生效。config:cache 失败时仅告警不中断部署。
This commit is contained in:
@@ -36,6 +36,18 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 清除并重建配置缓存:改了 config/* 后必须执行,否则 Laravel 仍读旧缓存,修改不生效
|
||||
# 注意:若以 root 执行,生成的 bootstrap/cache/config.php 归 root 所有;
|
||||
# 若 PHP-FPM 以 www 运行,请确保该文件对 www 可读(或部署后统一 chown -R www:www)
|
||||
log_message "重建配置缓存..."
|
||||
php artisan config:clear
|
||||
php artisan config:cache
|
||||
if [ $? -eq 0 ]; then
|
||||
log_message "配置缓存已重建"
|
||||
else
|
||||
log_message "警告: 配置缓存重建失败(请检查 php 是否在 PATH 中,或 config 含闭包无法缓存)"
|
||||
fi
|
||||
|
||||
# 安装依赖(如果需要)
|
||||
# log_message("安装依赖...")
|
||||
# npm install
|
||||
|
||||
Reference in New Issue
Block a user