You've already forked Atomcms-edit
chore: improve fix.sh and composer permission handling
This commit is contained in:
@@ -1,29 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "=========================================="
|
||||
echo " AtomCMS Quick Fix Script"
|
||||
echo "=========================================="
|
||||
|
||||
PROJECT_DIR="/var/www/atomcms"
|
||||
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
WEB_USER="www-data"
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
cd "$PROJECT_DIR" || exit 1
|
||||
|
||||
echo "[1/4] Clearing all caches..."
|
||||
php artisan optimize:clear
|
||||
echo "Fixing permissions..."
|
||||
|
||||
echo "[2/4] Fixing file permissions..."
|
||||
chown -R "$WEB_USER":"$WEB_USER" storage bootstrap/cache public/build 2>/dev/null || true
|
||||
chmod -R 775 storage bootstrap/cache public/build 2>/dev/null || true
|
||||
# Fix ownership (only if running as root/sudo, skip otherwise)
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
chown -R "$WEB_USER":"$WEB_USER" storage bootstrap/cache 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "[3/4] Clearing OPcache..."
|
||||
php -r "if (function_exists('opcache_reset')) { opcache_reset(); echo 'OPcache cleared'.PHP_EOL; } else { echo 'OPcache not enabled'.PHP_EOL; }"
|
||||
# Fix directory permissions
|
||||
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..."
|
||||
php artisan view:cache
|
||||
|
||||
echo "=========================================="
|
||||
echo " Fix complete!"
|
||||
echo "=========================================="
|
||||
echo "Permissions fixed."
|
||||
|
||||
Reference in New Issue
Block a user