=== Kivotos Backup – light backup & restore ===
Contributors: kostech
Tags: backup, restore, google drive, s3, migration
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 0.3.0
License: GPLv2 or later

Light, fast backups of the database and files in standard .tar.gz files, with scheduling, restore of just the parts you choose and optional copy to Google Drive or S3-compatible cloud storage.

== Description ==

Kivotos ("ark" in Greek) does one job: it keeps a copy of your site that you can bring back.

* **Standard files, one per part.** Each backup is a set of normal `.tar.gz` files: database, plugins, themes, uploads, other files, WordPress core, other folders. You can open them with any archive tool and import the SQL with phpMyAdmin. No lock-in.
* **Restore only what you need.** Tick the parts to bring back (for example only the database, or only the themes). From the cloud, only the files of those parts are downloaded.
* **Fast.** Photos, videos and archives are already compressed, so they are stored as they are instead of being compressed again. Database rows are streamed, large tables are read by primary key.
* **Never times out.** The work is done in slices of a few seconds and continues by itself, even in the middle of a large file or table. It works on cheap shared hosting.
* **Nothing on your pages.** The plugin code loads only in wp-admin and WP-Cron. A visitor costs zero queries and zero files.
* **Safe restore.** Database tables are loaded next to the live ones and swapped in with one atomic rename. Files are written next to the old ones and renamed. `wp-config.php` is never replaced. You stay logged in.
* **Google Drive (optional).** Connect your own Google account with your own OAuth client. The plugin asks only for the `drive.file` permission: it can see just the files it uploaded itself. Large files go up in parts and resume.
* **Cloud copy (optional).** Any S3-compatible storage: Backblaze B2, Cloudflare R2, Wasabi, Amazon S3, Hetzner Object Storage, DigitalOcean Spaces, MinIO. Implemented in one file, no SDK. Large files go up in parts and resume.
* **Schedule and retention.** Daily, weekly or monthly, keep the last N backups on the server and in the cloud, email when something fails.
* **Backups outside the web root** when the server has a `private` folder next to the site (Plesk); otherwise a folder with a random name, protected by `.htaccess`.
* No ads, no upsells, no account, no tracking.

Requirements: PHP 7.4+ with the `zlib` and `mysqli` extensions (both standard). ZipArchive is not needed.

== External services ==

The plugin contacts external services only in these cases:

* **Cloud storage (S3-compatible)**, only if you turn it on: your backup files are sent to the storage you chose, with the keys you entered.
* **Google Drive**, only if you connect it: your backup files are sent to the Google Drive of the account you connected (Google APIs: accounts.google.com, oauth2.googleapis.com, www.googleapis.com). Google's terms: https://policies.google.com/terms and privacy policy: https://policies.google.com/privacy
* **Updates**: this plugin is not hosted on WordPress.org. When WordPress checks for updates, the plugin asks https://kos-tech.eu/radar/ for the latest version number. Nothing about your site is sent besides the request itself. From 0.2.1 every update must carry an ed25519 signature from kos-tech; unsigned or altered files are not installed. Updates are installed automatically; you can turn that off in the plugin list, or with `define( 'KBK_AUTO_UPDATE', false );`.

== Frequently Asked Questions ==

= How do I move a site? =
Make a backup on the old site and download its files (one per part). Install the plugin on the new site, upload them on the Backups page and press Restore. The new site keeps its own address. Links inside the content are not rewritten in this version.

= Where are the backups? =
The Backups page shows the folder. You can change it in Settings.

= Can I restore without the plugin? =
Yes. Unpack the `.tar.gz` files, copy the `site/` folder over your WordPress and import `database.sql` (it is in the `-db` file).

== Changelog ==

= 0.3.0 =
* Each backup is now written as separate files per part: database, plugins, themes, uploads, other files, WordPress core, other folders.
* Restore: choose which parts to bring back. Everything you do not tick stays as it is. From the cloud only the files of the chosen parts are downloaded.
* Download each part on its own; upload several part files at once to move a site.
* "Send to cloud" sends only the files that are missing there.
* Backups made by earlier versions (one file) keep working, with the same choice of parts on restore.

= 0.2.5 =
* Restore: an archive that was cut short is now always reported as incomplete. Before, a cut at certain points could finish as "completed" with files missing.
* A failed cloud copy no longer stops the job: the backup completes with a warning, the next destination is still tried and old backups are still removed. Before, a broken cloud connection could fill the disk.
* Cloud retries now wait (30 seconds, then 1, 2 and 4 minutes) instead of running one right after the other.
* A file that is not a backup of this plugin is marked as unreadable and no longer counts as one of the backups to keep.
* The name used for backups is remembered, so a change of domain no longer leaves the older backups behind.
* Restoring only the database stops as soon as the database has been read, instead of unpacking the whole archive.
* A backup from another address no longer replaces .htaccess / .user.ini / php.ini in the site root.
* Checks for free disk space before packing, and for the size of the file after sending it to S3 storage.
* Nothing is loaded on admin-ajax requests of visitors. The log file is no longer a .txt file. On multisite only network administrators can use the plugin.

= 0.2.4 =
* Database: if the server stops reading a table in the middle (statement time limit, lost connection), the backup now fails with a clear message. Before, it could finish as "completed" with rows missing.
* Clean-up of old backups: backups of another site that share the same cloud folder (for example the same domain in a subfolder) are no longer counted or removed.
* A leftover "cancel" mark no longer cancels the next backup.
* Uploading a backup file no longer replaces an existing backup with the same name when the backup folder is inside the public folder.
* Views and triggers are not part of the backup; the backup list now says so when the site has any.

= 0.2.3 =
* Existing backup files in a public folder are renamed to .kbk by the hourly task itself, also on sites without a backup schedule (0.2.2 did it only when the plugin page was opened or a schedule was set).

= 0.2.2 =
* Security: when the backup folder is inside the public folder of the site, backup files are stored with the extension .kbk, so a web server that ignores .htaccess (nginx) does not hand them out. Existing files are renamed automatically; downloads from the plugin page are still normal .tar.gz files. A daily self-test warns if the folder can be reached from the internet.
* Security: updates are accepted only from the plugin folder of the update server and the signature also covers the version number.
* New warning (admin notice and email) when the scheduled backups are not being made, and when a notification email could not be sent.
* A job that makes no progress for two hours is stopped instead of blocking all later backups; a scheduled backup that cannot start is retried every hour and reported.
* “Only on failure” emails are also sent when a backup finished with warnings; folders that are symbolic links are reported instead of being skipped silently.
* The archive is read back after it is written, and its SHA-256 is checked before a restore.
* Database error messages never contain data; tables without a simple key are exported in a fixed order.
* After a restore the plugin stays active and scheduled.
* Backup names that clash with the plugin’s own state files are refused.

= 0.2.1 =
* Updates are signed by kos-tech (ed25519) and verified before installation, in addition to the SHA256 check. A failed update check is shown on the plugin page.

= 0.2.0 =
* Google Drive: connect your account and every backup is also sent to your Drive. Restore and clean-up of old backups work from there too.
* Lock a backup: a locked backup is never removed by the automatic clean-up, on the server or in the cloud.
* Updates: the plugin now updates itself from the kos-tech server, with an integrity check of the file before it is installed.

= 0.1.0 =
* First version.
