You've already forked Atomcms-edit
chore: improve fix.sh and composer permission handling
This commit is contained in:
@@ -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": [
|
||||||
|
|||||||
@@ -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 "=========================================="
|
|
||||||
|
|||||||
Reference in New Issue
Block a user