=== DB Backup by Fairshare.tech ===
Contributors: keshavgrover
Tags: database backup, cron job, mysql, automatic backup, mysqldump
Requires at least: 5.0
Tested up to: 6.8
Stable tag: 1.0.2
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Automatic WordPress database backups with mysqldump or PHP fallback. Supports email and reliable real cron jobs.

== Description ==

**DB Backup by Fairshare.tech** lets you create automated WordPress database backups on your preferred schedule. It uses `mysqldump` if available for fast and reliable backups, and falls back to a PHP-based method if `mysqldump` is unavailable.

Backups are stored securely in your `wp-content/uploads/db_backup/` directory, and you can choose to have them emailed to your admin email address. The plugin provides a settings page for configuration and supports triggering backups via a real cron job for reliability.

### **Features**
1. Flexible backup frequency: Daily, Weekly, or Monthly.
2. Backups saved in `wp-content/uploads/db_backup/` with timestamped filenames.
3. Option to email backups to the admin email address.
4. Uses `mysqldump` if available, with PHP fallback.
5. No dependency on WP-Cron—supports real cron jobs via a secure endpoint.
6. Secure authentication using unique access key for cron URL.
7. Simple configuration via WordPress Settings page.

== Installation ==

1. Upload the `db-backup-by-fairshare` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **Settings → DB Backup** to configure:
   - Backup frequency (Daily, Weekly, Monthly)
   - Email backup option (Yes / No)
4. If you want real cron jobs:
   - Copy the cron URL from the settings page.
   - Add it to your hosting cron manager or an external service (e.g., EasyCron).

**Requirements:**
- `mysqldump` installed on the server (optional, for faster backups).
- `exec()` function enabled in PHP (required for mysqldump method).
- If `exec()` or `mysqldump` is not available, the plugin uses a PHP-based backup.

== Frequently Asked Questions ==

= Where are backups stored? =
All backups are stored in `wp-content/uploads/db_backup/` with a timestamped filename.

= Can I change the backup schedule? =
Yes. Go to **Settings → DB Backup** and choose Daily, Weekly, or Monthly.

= Can I disable email notifications? =
Yes. On the settings page, select **No** for the "Email Backup" option.

= Does it work without mysqldump? =
Yes. If `mysqldump` or `exec()` is not available, the plugin uses a PHP-based fallback to create the backup.

= How do I set up a real cron job? =
On the settings page, copy the provided URL and add it to your hosting control panel's cron job scheduler or use an external service like [EasyCron](https://www.easycron.com).

= Is the cron URL secure? =
Yes. The URL contains a unique 32-character access key that's generated during plugin activation. This key doesn't expire and provides excellent security for your backup endpoint.

== Screenshots ==
1. Plugin settings page with backup frequency and email options.
2. Example of cron job setup instructions.
3. Backup files stored in `wp-content/uploads/db_backup/`.

== Changelog ==

= 1.0.2 =
* CRITICAL FIX: Removed nonce dependency to prevent backup failures after 24 hours.
* Simplified security model using only unique access key.
* Improved long-term reliability for scheduled backups.
* Updated documentation to reflect security changes.

= 1.0.1 =
* Added settings page for backup frequency and email options.
* Added support for real cron jobs via secure URL.
* Fallback to PHP-based backup if `mysqldump` is unavailable.
* Backups stored in `wp-content/uploads/db_backup/`.

= 1.0.0 =
* Initial release with weekly backup and email delivery.

== Upgrade Notice ==

= 1.0.2 =
CRITICAL UPDATE: Fixes backup failures after 24 hours. All users should update immediately.

= 1.0.1 =
Added custom frequency settings and real cron job support.
