=== WXD Backup Lite ===
Contributors: wxdlabs
Tags: backup, restore, migration, database backup, scheduler
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Production-ready WordPress backup plugin for local backups, restore workflows, migration support, scheduled runs, and retention control.

== Description ==

WXD Backup Lite gives site owners a reliable way to create full-site WordPress backups, restore them, and move sites between environments from wp-admin.

Included in this release:
- Full-site zip backups
- Selective backup contents and backup presets
- SQL database export
- WordPress core and content file archiving
- Manual backup runs from the admin area
- Daily and weekly scheduling
- Automatic retention cleanup
- Local restore workflow with automatic restore points
- Upload backup archive for import, restore, or migration
- Background job activity tracking
- Backup inspection and archive verification
- Server diagnostics and storage forecast
- Backup manifest file for restore and migration workflows
- Basic backup directory hardening with `index.php` and `.htaccess`

WXD Backup Lite focuses on dependable local backup, restore, and migration workflows for single-site WordPress installs.

**Privacy:** No data leaves your server. WXD Backup Lite does not make external API calls, does not phone home, and does not require an account or license key. Backup archives are stored locally in `wp-content/uploads/wsbl-backups`.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin through the WordPress admin.
3. Go to `Tools > WXD Backup`.
4. Create your first backup or configure the schedule and retention policy.

== Screenshots ==

1. Backup dashboard with schedule, storage, and server readiness overview.
2. Manual backup workflow with live progress and recent activity tracking.
3. Upload and migration workflow for importing backup archives.
4. Backup inspection and restore tools for recovery operations.

== Frequently Asked Questions ==

= Where are backups stored? =
Backups are stored in `wp-content/uploads/wsbl-backups`.

= What does each backup contain? =
Each archive contains a SQL database dump, a JSON manifest file, key root config files when present, and the main WordPress directories.

= Does this plugin support restore? =
Yes. You can restore a full backup or selectively restore supported backup components from the admin area.

= Does this plugin support migration? =
Yes. You can upload an archive, import it into local backup storage, restore it, and optionally update WordPress URL settings for migration workflows.

= Does it require any special PHP extension? =
Yes. The PHP `ZipArchive` extension must be enabled.

= Does this plugin send data to external services? =
No. WXD Backup Lite stores backups locally on the current WordPress site and does not require an external service to function.

== Changelog ==

= 1.0.1 =
* Restore reliability: post-commit harden (.htaccess + wp-config) now runs in the same request that commits files, so cPanel/LiteSpeed handler directives baked into a backup .htaccess can no longer 500 the site mid-restore.
* Restore reliability: stale source-site jobs purged from the imported activity log; the completed restore is recorded as its own activity entry.
* Restore reliability: iThemes Security `itsec-*` (hyphen) options purged on restore, preventing Force-SSL redirect loops on the destination.
* Stop restore: clicking Stop early no longer leaves the modal hanging at "Preparing restore... 0%"; the rollback now drives incrementally via the JS poll loop instead of one synchronous AJAX call, so the event log streams transitions instead of going silent for ~9 minutes.
* Stop restore: progress bar no longer snaps from 100% back to 0% after a successful rollback.
* Stop restore: starting a new restore from a wizard that still shows a previous "Stopped" terminal state now resets cleanly instead of inheriting that state.
* Stop restore: event log no longer leaks a stale "Importing general database tables" entry below the "Stop requested by user" line.
* Rollback throughput: DB import bumped to 5,000 statements / 12 s per tick during rollback (was 120 / default), turning ~3-hour rollbacks of 200 MB databases into minutes.
* Migrate wizard: removed the URL-mapping step (auto-detected from archive, applied via existing source!=target heuristic) and the "More import sources" PRO upsell.
* Migrate wizard: Stop Restore button moved into the wizard footer for cleaner alignment, and now hides on terminal completion.
* Migrate wizard: progress bar now fills determinately during the restore phase using session.progress, instead of staying in indeterminate shimmer until completion.
* Migrate wizard: event log now matches the standalone Restore wizard's density, surfacing every state transition and checkpoint instead of just one or two early job stages.
* Activity log: drag-and-drop file selection now enables the wizard's Next button (parity with Browse).
* Activity log: per-tick byte/percent sub-progress shown during long DB import buckets so the user sees continuous motion.
* Activity log: stopped+rolled-back restores now render with an amber "Stopped — rolled back" badge instead of a misleading green "Completed" + duplicated "Completed Completed in 10m 31s" timing.
* Activity log: event log populates from both the standalone restore wizard and the migrate wizard's poll loop, including the post-DB-swap reconnect path.
* Activity log: Retry Job for restore-type jobs now opens the regular Restore wizard (with confirmation, progress bar, event log) instead of running silently in the background.
* Modal copy: completion message now distinguishes user-stopped restores ("Restore stopped — rollback to the safety restore point completed successfully.") from engine failures ("Restore failed, but the safety restore point was reapplied successfully.").
* Code quality: extracted shared `renderRestoreSessionUpdate`, `hideMigrateRestoreControls`, and `resetRestoreEventLogs` helpers so the standalone Restore wizard and migrate import-restore flow render through a single source of truth — eliminates the recurring drift that caused parity bugs between the two flows.
* Critical: fixed a rollback-empties-plugin-dir bug where a single failed copy() during the file-rollback phase would call cleanup_path() on the destination without a preserved fallback, deleting wp-content/plugins entirely. The error-recovery path is now gated behind a preserved-path existence check, so partial state is preserved instead of obliterated when no fallback exists.
* Migrate wizard: fixed event-log infinite-loop where job.stage and session.message were being logged simultaneously each poll tick, breaking the dedup lock and filling the log with hundreds of identical alternating pairs.
* Localhost compatibility: optional ASCII-fast-path shim for the `WpOrg\Requests\IdnaEncoder` autoloader works around a known Elementor + localhost subdirectory crash; only activates when the home URL contains `localhost`, `127.0.0.1`, `.local`, or `.test`.
* Code quality: full WordPress.org Plugin Check ruleset now passes with zero errors and zero warnings.

= 1.0.0 =
* Initial release of WXD Backup Lite under Webxdevelopers.
* Full-site and component-level WordPress backups with SQL database export.
* Restore workflow with automatic safety restore point and rollback on failure.
* Import and migration workflow with URL mapping and environment-aware hardening.
* Scheduled backups, retention policy, background job tracking, and archive verification.
* Diagnostics, storage forecast, and backup directory hardening.
* Cooperative stop/rollback with race-condition-safe concurrent stop handling.

== Upgrade Notice ==

= 1.0.1 =
Reliability and UX hardening. Restore is more resilient on shared hosts; activity log no longer surfaces stale jobs as failures; progress feedback during long imports is more granular. Recommended upgrade for any 1.0.0 user.

= 1.0.0 =
Initial public release. Please take a test backup on a staging copy before running a restore or migration on a production site.
