chore: improve fix.sh and composer permission handling

This commit is contained in:
root
2026-05-19 18:50:40 +02:00
parent e5e8e050a0
commit 8567ce6951
2 changed files with 13 additions and 21 deletions
+2
View File
@@ -71,10 +71,12 @@
"@php artisan filament:upgrade" "@php artisan filament:upgrade"
], ],
"post-install-cmd": [ "post-install-cmd": [
"@php artisan optimize:clear",
"bash fix.sh" "bash fix.sh"
], ],
"post-update-cmd": [ "post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force", "@php artisan vendor:publish --tag=laravel-assets --ansi --force",
"@php artisan optimize:clear",
"bash fix.sh" "bash fix.sh"
], ],
"post-root-package-install": [ "post-root-package-install": [
+11 -21
View File
@@ -1,29 +1,19 @@
#!/bin/bash #!/bin/bash
set -e PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
echo "=========================================="
echo " AtomCMS Quick Fix Script"
echo "=========================================="
PROJECT_DIR="/var/www/atomcms"
WEB_USER="www-data" WEB_USER="www-data"
cd "$PROJECT_DIR" cd "$PROJECT_DIR" || exit 1
echo "[1/4] Clearing all caches..." echo "Fixing permissions..."
php artisan optimize:clear
echo "[2/4] Fixing file permissions..." # Fix ownership (only if running as root/sudo, skip otherwise)
chown -R "$WEB_USER":"$WEB_USER" storage bootstrap/cache public/build 2>/dev/null || true if [ "$(id -u)" -eq 0 ]; then
chmod -R 775 storage bootstrap/cache public/build 2>/dev/null || true chown -R "$WEB_USER":"$WEB_USER" storage bootstrap/cache 2>/dev/null || true
fi
echo "[3/4] Clearing OPcache..." # Fix directory permissions
php -r "if (function_exists('opcache_reset')) { opcache_reset(); echo 'OPcache cleared'.PHP_EOL; } else { echo 'OPcache not enabled'.PHP_EOL; }" find storage bootstrap/cache -type d -exec chmod 775 {} + 2>/dev/null || true
find storage bootstrap/cache -type f -exec chmod 664 {} + 2>/dev/null || true
echo "[4/4] Rebuilding view cache..." echo "Permissions fixed."
php artisan view:cache
echo "=========================================="
echo " Fix complete!"
echo "=========================================="