=== DK Site Migration Pro ===
Contributors: kvachakhia
Tags: migration, backup, clone, duplicate, restore
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Move a full WordPress site — files and database — into one .wpmigrate archive and restore it elsewhere with serialized-safe URL replacement.

== Description ==

DK Site Migration Pro packages your entire WordPress site into one custom archive and restores it anywhere. It is built for real-world hosting: work is processed in small, resumable chunks so it never fails because of a low PHP time limit, small memory limit, or a disabled `mysqldump`.

**What gets exported**

* All site files (uploads, plugins, themes and child themes, custom folders)
* WordPress core files (optional)
* The complete database, via a chunked PHP engine (no `mysqldump` required)
* A manifest describing the source environment, plus per-entry and whole-archive checksums

**What happens on import**

* The archive is validated (magic bytes, format version, checksums) before anything is written
* A preflight checks PHP/WordPress versions and free disk space
* Files extract to a staging area with strict path-traversal protection
* The database loads into staging tables, then swaps in
* URLs and server paths are rewritten everywhere — including inside PHP-serialized data — using a recursive engine that recomputes serialized string lengths, never a raw SQL replace

**Safe by design**

* A dedicated capability plus nonces guard every action
* Backups live in a protected directory with randomized filenames and an authenticated download handler
* Secrets (database passwords, salts, tokens) are never written to logs or the archive manifest
* Imports stage everything and swap late, with a rollback path if the swap fails

**Privacy first**

The plugin runs entirely on your own server. No site files, database content, or URLs are sent anywhere. Optional cloud storage is a separate, opt-in module and is disabled by default.

This is the free edition. A Pro edition adds unlimited archive size, cloud storage, scheduled and incremental backups, encryption, Multisite support, WP-CLI commands, and automatic rollback — all built on the same extension points, with no licensing logic baked into the core.

== Installation ==

1. Upload the `kvachakhia-site-archive-restore` folder to `/wp-content/plugins/`, or install the ZIP from Plugins → Add New → Upload.
2. Activate the plugin through the Plugins screen.
3. Open **Site Migration** in the admin menu.
4. Visit **System Information** and run the environment self-test to confirm your server is ready.

**Nginx note:** the plugin writes Apache deny rules automatically. On Nginx, add a rule denying direct access to `wp-content/uploads/ksar-backups/`. Downloads always go through an authenticated handler regardless of server.

== Frequently Asked Questions ==

= Does this require mysqldump or shell access? =
No. The database export/import is a pure PHP engine that processes rows in chunks. `mysqldump` is only used as an optional fast path when your host allows it.

= Will it break serialized data when changing domains? =
No. Replacement is done in PHP with a recursive walker that unserializes, replaces, and reserializes so string lengths stay correct. It handles nested arrays, objects, JSON, page-builder data, and doubly-serialized values.

= What is the .wpmigrate file? =
A custom archive format owned by this plugin — not a renamed ZIP. It has its own header, table of contents, per-block checksums, and version gate, and is read only by the plugin.

= Is my data sent anywhere? =
No. Everything runs locally. Cloud features are opt-in and off by default.

== Screenshots ==

1. Export screen with inclusion and exclusion options.
2. Import screen with drag-and-drop upload and replacement preview.
3. Backups catalogue.
4. Activity logs.
5. System information and environment self-test.

== Changelog ==

= 1.0 =
* Initial release. Full-site export to a single .wpmigrate archive and import/restore onto another WordPress install. Highlights: chunked, resumable export and import (no mysqldump required); a custom self-checksummed archive format with validation and corruption detection; serialized-safe URL and path search-and-replace that recomputes serialized string lengths (handles nested arrays, objects, JSON, page builders, WooCommerce, doubly-serialized data); automatic domain and table-prefix handling with a pre-import preview; safe extraction with directory-traversal protection; automatic rollback of files and database on failure; resilience to timeouts and WordPress maintenance mode; and an admin interface with Export, Import, Backups, Activity Logs, Settings, and System Information.

== Upgrade Notice ==

= 1.0 =
Initial release.
