=== RMS Backup ===
Contributors: rmsds
Tags: backup, restore, database backup, sqlite, migration
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.5.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manual local backups of your database, SQLite stores and files, with archive verification and a safety snapshot before every restore.

== Description ==

RMS Backup creates complete, verifiable backups of a WordPress site and keeps them on your own server. It is designed for site owners who want a simple, local-only backup tool that never sends data anywhere.

**What it backs up**

* The WordPress MySQL/MariaDB database, exported in consistent, chunked steps so large tables do not time out.
* SQLite databases registered by compatible plugins (through the `rms_backup_sqlite_stores` filter), captured as online snapshots.
* WordPress files (core, themes, plugins and uploads), with optional incremental file backups that only store files changed since the last full backup. The content, plugin, must-use plugin, theme and uploads directories are read from the locations WordPress is configured to use, including relocated ones.

**What it leaves out on purpose**

* `wp-config.php` and copies of it (for example `wp-config.php.bak`): they hold the database password, authentication keys and salts. Keep a copy of your configuration file separately.
* Authentication keys and salts that WordPress stores in the database when they are not defined in `wp-config.php`. After a restore WordPress generates new ones and users sign in again.

A database backup is a full copy of your database, including user accounts and password hashes. Treat every archive as confidential.

**What you can do with an archive**

* Verify it: every part is checked against the SHA-256 checksums stored in its manifest without changing the site.
* Download its ZIP parts and manifest from the admin screen.
* Import archive parts created on another site, by upload or from a local server path.
* Restore it. A safety snapshot of the current site is taken first, the site is placed in maintenance mode while files and data are replaced, and URLs are rewritten (including serialized data) when the archive comes from a different address.
* Restore archives encrypted by RMS Backup Pro when you supply their passphrase.

**WP-CLI**

All operations are also available as `wp rms-backup` commands: `run`, `list`, `verify`, `import`, `restore`, `restore-recover`, `delete`, `rotate`, `logs`, `sqlite` and `legacy`. Run `wp help rms-backup` for details.

**Privacy**

RMS Backup makes no HTTP requests, contains no tracking, and does not contact any external service. Backups are created only when you start them.

== Installation ==

1. Install and activate RMS Backup from the Plugins screen.
2. Open **Tools > RMS Backup** (on multisite: **Network Admin > RMS Backup**).
3. Choose a backup scope and click **Create backup**.

If RMS Backup Pro is active on the same site, Pro handles all backup operations and RMS Backup stays idle until Pro is deactivated.

== Frequently Asked Questions ==

= Where are the backups stored? =

In a private sub-directory of the WordPress uploads directory (as returned by `wp_upload_dir()`), named `rms-backup-` followed by a 32-character random token generated once per site, for example `wp-content/uploads/rms-backup-3f9c…/`. Each backup is a sub-folder containing ZIP parts and a `manifest.json`.

= How are the archives protected from download? =

The plugin offers one way to download an archive: the admin screen, for an administrator, with a nonce check. Direct requests to the files are a matter of web server configuration, so protection has these layers:

* the directory name contains 128 random bits and cannot be guessed;
* an `.htaccess` file denies all web access on Apache and LiteSpeed (when the server allows `.htaccess` overrides);
* a `web.config` file denies all web access on IIS;
* an `index.php` file prevents directory listings;
* the directory is created with restrictive permissions (0700).

RMS Backup checks that these files exist and that the rule files deny access before it writes, imports or copies any archive; otherwise it refuses.

**Nginx** does not read `.htaccess` or `web.config`. On a standard Nginx installation the archives are protected by the unguessable directory name only: someone who learns the full file address can download that file. To have the server refuse such requests too, add this rule to your site configuration (before the PHP location) and adjust the path if your uploads directory is elsewhere:

`location ~* "/wp-content/uploads/(sites/[0-9]+/)?rms-backup-[0-9a-f]{32}(/|$)" { deny all; }`

The plugin does not send requests to your site to test these rules.

= Does a restore write outside the uploads directory? =

Yes, because restoring a backup replaces WordPress files and data. Files are written only into the directories WordPress is configured to use. While a restore runs, RMS Backup also uses WordPress's own `.maintenance` file. Everything else the plugin writes (archives, temporary files, restore progress and logs) stays in its directory inside uploads. The plugin does not create must-use plugins or any other executable files.

= What do visitors see during a restore? =

A maintenance page (HTTP 503). If a restore fails or is interrupted, the plugin keeps showing that page to visitors until the site is recovered, while administrators and the login screen stay reachable. If the PHP process was stopped outright, WordPress's own maintenance mode also covers the administration area for up to ten minutes. This protection works as long as the plugin is active and WordPress can load it.

= A restore was interrupted. How do I get my site back? =

The plugin screen shows the safety snapshot taken before the restore; you can restore it from the same screen. With WP-CLI, run `wp rms-backup restore-recover` to see the status, `wp rms-backup restore-recover --rollback` to return to the safety snapshot, or `wp rms-backup restore-recover --maintenance-off` to only end maintenance mode.

= Are backups deleted when I uninstall the plugin? =

No. Archives are your data and remain in the uploads directory after uninstall. Delete them first with `wp rms-backup delete <backup-id>`, or remove the `rms-backup-…` directory manually.

= Does it schedule automatic backups or upload to the cloud? =

No. This edition creates backups only when you start them and stores them locally. Scheduled backups and remote storage are available in RMS Backup Pro.

= Does it work on multisite? =

Yes. On multisite the plugin is managed from Network Admin and requires the `manage_network_options` capability.

== Changelog ==

= 1.5.1 =
* First release on WordPress.org.
* Archives are stored only in a protected, randomly named sub-directory of the uploads directory.
* Restore maintenance uses WordPress core maintenance mode and the core error page.

== Upgrade Notice ==

= 1.5.1 =
First public release.
