2 Commits

Author SHA1 Message Date
myron 3a1746b0c0 fix: all 6 code review findings
1. admin.js: dashboard setTimeout was after return (dead code) — restructured
   to assign template to const html, run setTimeout, then return html

2. DockerManager.php createStack: replaced SELECT LAST_INSERT_ID() with
   db->insert() which already returns lastInsertId correctly for SQLite

3. DockerManager.php setQuota: replaced ON DUPLICATE KEY UPDATE / VALUES()
   MySQL syntax with SQLite-compatible ON CONFLICT(user_id) DO UPDATE SET
   excluded.col syntax

4. post-restore.sh: PHP helper file now written ONCE at start of step 4
   before any call to it (was written AFTER first call, causing silent failure)

5. post-restore.sh: git pull exit code now captured before pipeline (the
   while-read loop always exited 0, masking pull failures)

6. uninstall.sh: tar backup now aborts on failure (previously 2>/dev/null
   swallowed errors and rm -rf destroyed source unconditionally); also
   rm -f → rm -rf for .service.d drop-in directory
2026-06-23 03:13:42 +00:00
myron e805e55120 feat: #40 Linux uninstaller
- Full backup before removal: DB, all account home dirs, nginx vhosts,
  SSL certs, DNS zones, mail config, logs, systemd units, cron jobs
- Backup compressed to /tmp/novacpx-uninstall-backup-TIMESTAMP.tar.gz
- Prints scp command + temp HTTP server option to download backup
- Requires confirmation (or --yes flag to skip)
- Removes: hosting accounts + Linux users, PHP-FPM pools, nginx vhosts,
  novacpx-web systemd unit, sudoers rules, cron jobs, opendkim keys,
  DNS zones, postfix virtual tables, fail2ban filters
- Removes all NovaCPX directories: /srv/novacpx /opt/novacpx-src
  /opt/novacpx /var/lib/novacpx /var/log/novacpx /etc/novacpx
- Restores nginx default site
- Leaves base services (nginx, php-fpm, postfix, etc.) running
- Usage: bash uninstall.sh [--yes]
2026-06-23 00:50:50 +00:00