Fix: fix_permissions baut Cache als www-data + setgid auf cache/storage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main v1.1.305
boban 2026-04-26 18:51:30 +02:00
parent c834b5f85d
commit e0128312cf
1 changed files with 8 additions and 0 deletions

View File

@ -159,13 +159,21 @@ _sudoers_add(){
chmod 440 "$file"
}
fix_permissions(){
# Eigentümer + Gruppe korrigieren
chown -R "${APP_USER}:${APP_GROUP}" \
"${APP_DIR}/bootstrap/cache" \
"${APP_DIR}/storage" \
"${APP_DIR}/public/build" 2>/dev/null || true
# Gruppe Schreibrecht + setgid (neue Dateien erben Gruppe automatisch)
chmod -R ug+rwX \
"${APP_DIR}/bootstrap/cache" \
"${APP_DIR}/storage" 2>/dev/null || true
find "${APP_DIR}/bootstrap/cache" "${APP_DIR}/storage" \
-type d -exec chmod g+s {} \; 2>/dev/null || true
# Cache als www-data (PHP-FPM-User) neu aufbauen → keine Rechteprobleme
sudo -u "${APP_GROUP}" php "${APP_DIR}/artisan" optimize:clear --quiet 2>/dev/null || true
sudo -u "${APP_GROUP}" php "${APP_DIR}/artisan" config:cache --quiet 2>/dev/null || true
sudo -u "${APP_GROUP}" php "${APP_DIR}/artisan" route:cache --quiet 2>/dev/null || true
}
ensure_system(){