Unarchiver

A powerful, single-file PHP script designed for unpacking backups. Companion script for the Archiver.

Archive Restorer (Migration Tool)

Version PHP License

A powerful, single-file PHP script designed to automate the migration and restoration of WordPress websites (and other PHP applications). Originally optimized for Cloud86 hosting, but compatible with most Linux/Apache/Nginx environments running cPanel, Plesk, or DirectAdmin.

๐Ÿš€ Features

This tool handles the entire migration workflow in a step-by-step wizard interface:

  • ๐Ÿ“ฆ Smart Extraction: Automatically detects and extracts .zip, .tar, .tar.gz, and multi-part archives (e.g., .part1.zip, .z01).
  • ๐Ÿ“ฅ Remote Import: Pull backups directly from another server using a URL (supports wget and curl), avoiding the need to download/upload to your local machine first.
  • ๐Ÿ“‚ Structure Fixer: Detects if files were extracted into a nested subfolder (like httpdocs or public_html) and moves them to the root automatically.
  • ๐Ÿ—„๏ธ Database Import:
    • Scans for .sql or .sql.gz files.
    • Accepts database credentials via UI.
    • Imports directly using the system mysql command for speed.
    • Plesk Helper: Includes a JS snippet to auto-fill database credentials in the Plesk interface.
  • โš™๏ธ Config Automator: Automatically updates wp-config.php with the new database credentials.
  • ๐Ÿ”— Path Fixer: Scans .htaccess, .user.ini, and wp-config.php to replace old absolute paths with the current server path.
  • ๐Ÿงน Cleanup: One-click removal of the script and all archive files after migration is complete.

๐Ÿ“‹ Prerequisites

To run this script, your hosting environment needs:

  1. PHP 7.4 or higher.
  2. shell_exec and exec enabled (Required for unzip, tar, and mysql commands).
  3. Write permissions on the directory where the script is uploaded.
  4. Standard system tools installed: unzip, tar, mysql, wget (optional), curl (optional).

๐Ÿ› ๏ธ Installation & Usage

1. Upload the Script

Upload the restore.php (or whatever you name this script) to the root directory of your website (e.g., /public_html/ or /httpdocs/).

2. Upload Archives (Two Options)

  • Option A (FTP): Upload your backup zip/tar files to the same folder via FTP/SFTP.
  • Option B (Remote): Open the script in your browser and use the "Remote Import" feature to pull files from a direct URL.

3. Run the Wizard

Navigate to the script in your browser:

Changelog

[1.1.0] 17-02-2026

  • Improvement Server-Side Retry Logic: Added a retry loop and aggressive cache clearing to fix race conditions when scanning for databases after moving files.
  • Improvement Path Scanner Upgrade: Now detects and fixes directory paths (e.g., WPCACHEHOME) in wp-config.php, not just file paths.
  • Improvement WAF Support: Added specific logic to detect and fix paths in wordfence-waf.php, handling complex regex patterns found in .user.ini and .htaccess.
  • Improvement Database Scan Logic: Refined exclusion logic to use relative paths, preventing false positives when the site is located in a system path (e.g., /var/www/).
  • Improvement Backup Inclusion: Re-enabled scanning of backups/, _backups/, etc., ensuring valid SQL dumps in these common locations are found.
  • Improvement Fast Path Scan: Added a "fast path" check using glob() to instantly find SQL files in the root directory.
  • Improvement Import Fallback: Implemented automatic fallback to synchronous import if the background (async) import process fails.
  • Fix False Positive Reduction: Fixed an issue where system directories (like administrator in Joomla or vendor in Magento) caused thousands of irrelevant SQL files to be detected.
  • Fix 500 Error Prevention: Added automatic sanitization of .htaccess files immediately after moving them. This specifically comments out "cPanel-generated PHP handlers" (AddHandler directives) that cause 500 Internal Server Errors on Cloud86 hosting.
  • Fix Cleanup Limits: Limited the recursion depth of the cleanup process to 3 levels to prevent timeouts and improved the regex for identifying .imported SQL files.

[1.0.1] - 03-02-2026

  • Improvement When pulling a remote file the progress is now shown as a single line instead of new log entries.

[1.0.0] - 02-02-2026

  • New Major Release: First stable release of the Archive Restorer tool.
  • Feature Remote Fetching: Integrated a remote import module supporting wget and curl with real-time download progress tracking and split-part detection.
  • Feature Smart Unpacking: Support for .zip, .tar, and .tar.gz using system-level commands and nohup to bypass PHP execution timeouts.
  • Feature Structure Normalization: Added an automatic detection system for nested folder structures (e.g., public_html or httpdocs) with a one-click move-to-root utility.
  • Feature Database Suite: - Added a recursive SQL scanner for .sql and .sql.gz files.
    • Plesk Smart-Bot: Created a JavaScript console-injection snippet to automate the creation of databases and users within Plesk.
    • Automated wp-config.php updating after successful database imports.
  • Feature System Fixes: - Path Resolver: Implemented a scanner to fix hardcoded absolute paths in configuration files like .htaccess and wp-config.php.
    • Wordfence Recovery: Added specific logic to automatically repair wordfence-waf.php pathing to prevent 500 errors post-migration.
  • Feature Security: Integrated a permission reset module to enforce 0755 for directories and 0644 for files.
  • Improvement UI/UX: Modern dark-mode dashboard built with Tailwind CSS featuring an interactive stepper and live log streaming.
  • Improvement Performance: Optimized file scanning by excluding redundant directories like node_modules, vendor, and backups.
  • Improvement Cleanup: Added a secure self-destruct mechanism to delete the tool and source archives after a successful restoration.
Copied to clipboard!