CLI Utilities & Emergency Recovery

Standalone Qwiki includes operator CLI scripts under bin/ and supports PHP's built-in development server for zero-config local evaluation.

Emergency 2FA Reset (bin/reset-2fa.php)

If an administrator loses their TOTP authenticator app and all 8 recovery codes, reset 2FA from the server shell (php_sapi_name() === 'cli' enforced):

php bin/reset-2fa.php admin
  • Loads users.json via Config::loadUsers(), locates the matching username (case-insensitive), clears twoFactor to null, and saves users.json.
  • After running, the user can sign in with their password and re-enroll 2FA if required by policy.

Sub-Wiki Documentation Sync (bin/sync-subwiki-docs.php)

Synchronizes a designated documentation mirror sub-wiki (for example /docs) from demo-data/:

# Auto mode (prefers symlink, falls back to copy)
php bin/sync-subwiki-docs.php docs

# Explicitly create a symlink (ideal on VPS/dedicated hosts)
php bin/sync-subwiki-docs.php docs --symlink

# Physical file copy (for shared hosts that disallow symlinks)
php bin/sync-subwiki-docs.php docs --copy
  • Anti-overwrite guards refuse to overwrite non-mirror sub-wikis unless --force is explicitly supplied.

Local PHP Development Server

To test a Standalone Qwiki directory locally without Apache or Nginx:

php -S 127.0.0.1:8080 -t /path/to/standalone-qwiki

Clean URLs (/category/slug) work directly with PHP's built-in CLI server via index.php routing.