mirror of
https://github.com/myronblair/novacpx
synced 2026-06-30 17:50:41 -05:00
dbc5a01de9
#4: Postfix virtual mailbox config (virtual_mailbox_domains/maps, vmail user, maildir at /var/mail/vhosts/%d/%n). Dovecot SQL backend pointed at novacpx.email_accounts with SHA512-CRYPT passdb and per-domain Maildir userdb. #5: BIND9 confirmed working — dig @localhost resolves testdomain1.com correctly. #6: Certbot 2.9.0 confirmed installed; domains.document_root wired; infrastructure ready for live domain issuance (testdomain1.com not publicly resolvable so dry-run expected to fail). #7: Fixed all broken user-panel API queries — missing tables (databases, ftp_accounts, ssl_certs, cron_jobs, php_configs, notifications) created; `databases` reserved-word backtick-quoted across DatabaseManager+endpoints; domains.php is_primary→type=main, doc_root→document_root column fixes; DNSManager::createZone call signature fixed; stats/account auto-resolves account_id for user role. #8: assert_account_access() helper added to api/index.php; reseller ownership check wired into email, ftp, databases, domains, dns, ssl endpoints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.7 KiB
Bash
Executable File
52 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# nova-phpcheck.sh — PHP static analysis on all panel PHP files
|
|
# Usage: bash nova-phpcheck.sh [path] (default: ../panel)
|
|
# bash nova-phpcheck.sh --fix (show errors + line context)
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
TARGET="${1:-$SCRIPT_DIR/../panel}"
|
|
FIX=false
|
|
[[ "${1:-}" == "--fix" ]] && { FIX=true; TARGET="${2:-$SCRIPT_DIR/../panel}"; }
|
|
|
|
GREEN='\033[0;32m'; RED='\033[0;31m'; YELLOW='\033[1;33m'; NC='\033[0m'
|
|
|
|
PHP_BIN=$(command -v php8.3 || command -v php || echo "")
|
|
[[ -z "$PHP_BIN" ]] && { echo "No PHP binary found. Install php8.3."; exit 1; }
|
|
|
|
echo "Checking PHP syntax in: $TARGET"
|
|
echo "PHP: $($PHP_BIN --version | head -1)"
|
|
echo ""
|
|
|
|
ERRORS=0; FILES=0
|
|
while IFS= read -r -d '' file; do
|
|
FILES=$((FILES+1))
|
|
OUTPUT=$("$PHP_BIN" -l "$file" 2>&1)
|
|
if echo "$OUTPUT" | grep -q "No syntax errors"; then
|
|
:
|
|
else
|
|
echo -e "${RED}[ERROR]${NC} $file"
|
|
echo " $OUTPUT"
|
|
if $FIX; then
|
|
# Show 3 lines of context around the error
|
|
LINENUM=$(echo "$OUTPUT" | grep -oP 'on line \K[0-9]+' | head -1)
|
|
if [[ -n "$LINENUM" ]]; then
|
|
START=$(( LINENUM > 3 ? LINENUM - 3 : 1 ))
|
|
echo ""
|
|
sed -n "${START},$((LINENUM+2))p" "$file" | nl -ba -v"$START" | \
|
|
awk -v err="$LINENUM" '{if(NR==err-START+4) printf "\033[31m→ %s\033[0m\n",$0; else print " "$0}'
|
|
echo ""
|
|
fi
|
|
fi
|
|
ERRORS=$((ERRORS+1))
|
|
fi
|
|
done < <(find "$TARGET" -name "*.php" -not -path "*/vendor/*" -print0)
|
|
|
|
echo ""
|
|
if [[ $ERRORS -eq 0 ]]; then
|
|
echo -e "${GREEN}[✓]${NC} All $FILES PHP files OK"
|
|
exit 0
|
|
else
|
|
echo -e "${RED}[✗]${NC} $ERRORS error(s) in $FILES files"
|
|
exit 1
|
|
fi
|