Fix: fix_permissions läuft nach jedem Update-Pfad (kein 404 mehr nach Update)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.304
boban 2026-04-26 18:46:33 +02:00
parent 7454638506
commit c834b5f85d
1 changed files with 12 additions and 3 deletions

View File

@ -158,6 +158,16 @@ _sudoers_add(){
printf '%s\n' "$rule" >> "$file" printf '%s\n' "$rule" >> "$file"
chmod 440 "$file" chmod 440 "$file"
} }
fix_permissions(){
chown -R "${APP_USER}:${APP_GROUP}" \
"${APP_DIR}/bootstrap/cache" \
"${APP_DIR}/storage" \
"${APP_DIR}/public/build" 2>/dev/null || true
chmod -R ug+rwX \
"${APP_DIR}/bootstrap/cache" \
"${APP_DIR}/storage" 2>/dev/null || true
}
ensure_system(){ ensure_system(){
# Scripts nach sbin # Scripts nach sbin
_sbin_install "${APP_DIR}/scripts/mailwolt-apply-domains" /usr/local/sbin/mailwolt-apply-domains _sbin_install "${APP_DIR}/scripts/mailwolt-apply-domains" /usr/local/sbin/mailwolt-apply-domains
@ -325,6 +335,7 @@ if [[ $NEED_COMPOSER -eq 0 && $NEED_MIGRATIONS -eq 0 && $NEED_FRONTEND -eq 0 &&
NEW_VER="$(get_version)" NEW_VER="$(get_version)"
write_build_info "$NEW_VER" "$NEW_REV" write_build_info "$NEW_VER" "$NEW_REV"
echo "[i] Version: ${OLD_VER}${NEW_VER}" echo "[i] Version: ${OLD_VER}${NEW_VER}"
fix_permissions
ensure_system ensure_system
exit 0 exit 0
fi fi
@ -361,9 +372,6 @@ if [[ $NEED_PHP_RESTART -eq 1 || $NEED_COMPOSER -eq 1 || $NEED_MIGRATIONS -eq 1
as_app "cd ${APP_DIR} && php artisan config:cache || true" as_app "cd ${APP_DIR} && php artisan config:cache || true"
as_app "cd ${APP_DIR} && php artisan route:cache || true" as_app "cd ${APP_DIR} && php artisan route:cache || true"
as_app "cd ${APP_DIR} && php artisan queue:restart || true" as_app "cd ${APP_DIR} && php artisan queue:restart || true"
# Rechte: bootstrap/cache und storage müssen für www-data lesbar sein
chown -R "${APP_USER}:${APP_GROUP}" "${APP_DIR}/bootstrap/cache" "${APP_DIR}/storage" 2>/dev/null || true
chmod -R g+rX "${APP_DIR}/bootstrap/cache" "${APP_DIR}/storage" 2>/dev/null || true
fi fi
# -------- Dienste neu laden (gezielt) ---------------------------------------- # -------- Dienste neu laden (gezielt) ----------------------------------------
@ -388,6 +396,7 @@ fi
NEW_VER="$(get_version)" NEW_VER="$(get_version)"
write_version_files "$NEW_VER" "$NEW_REV" write_version_files "$NEW_VER" "$NEW_REV"
fix_permissions
echo "[✓] Update abgeschlossen: ${OLD_VER}${NEW_VER} (${OLD_REV:0:7}${NEW_REV:0:7})" echo "[✓] Update abgeschlossen: ${OLD_VER}${NEW_VER} (${OLD_REV:0:7}${NEW_REV:0:7})"
# -------- .env: REVERB-Werte auf Domain-Basis normalisieren ------------------- # -------- .env: REVERB-Werte auf Domain-Basis normalisieren -------------------