=== Haznox Cleaner for UpdraftPlus ===
Contributors:      haznoxtech
Tags:              updraftplus, backup, google drive, cleanup, automation
Requires at least: 5.0
Tested up to:      6.9
Stable tag:        2.2.0
Requires PHP:      7.2
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Automatically deletes local UpdraftPlus backup files after confirmed remote upload to Google Drive or any other configured remote storage.

== Description ==

**Haznox Cleaner for UpdraftPlus** is a lightweight WordPress plugin that works alongside [UpdraftPlus](https://updraftplus.com/) to automatically remove local backup files from your server once they have been successfully uploaded to a remote storage destination such as Google Drive, Amazon S3, Dropbox, OneDrive, or any other service supported by UpdraftPlus.

This keeps your server disk usage low without any manual effort — ideal for agencies and developers managing multiple WordPress sites.

**How it works:**

1. UpdraftPlus runs its regular backup and uploads files to your configured remote storage.
2. Once the backup job completes, Haznox Cleaner for UpdraftPlus schedules a cleanup task to run 10 minutes later via WP-Cron.
3. Before deleting anything, the plugin confirms that remote storage is configured and the backup exists in UpdraftPlus history.
4. Only then are the local backup files permanently removed from your server.

**Key features:**

* Hooks into both the modern (`updraftplus_backup_complete`) and legacy (`updraft_backup_complete`) UpdraftPlus actions — compatible with all UpdraftPlus versions.
* Four-method backup directory resolver that works with default, custom, and token-based UpdraftPlus path configurations.
* Activity log inside WordPress admin — see exactly what was deleted, when, and why anything was skipped.
* Manual Clean button to run an on-demand cleanup from the dashboard.
* All operations are logged with timestamps.
* Safety checks prevent deletion if remote storage is not configured or the backup is not found in UpdraftPlus history.
* System files (`.htaccess`, `index.html`, `index.php`) are never touched.
* Clean uninstall — all plugin data is removed from the database when you delete the plugin.

**Supports all UpdraftPlus remote storage destinations:**

* Google Drive
* Amazon S3 (and S3-compatible)
* Dropbox
* Microsoft OneDrive
* Backblaze B2
* FTP / SFTP
* Any other service supported by UpdraftPlus

== Installation ==

**From the WordPress admin:**

1. Go to **Plugins > Add New**.
2. Click **Upload Plugin** and select the `haznox-cleaner-for-updraftplus.zip` file.
3. Click **Install Now**, then **Activate Plugin**.

**Manual installation:**

1. Unzip `haznox-cleaner-for-updraftplus.zip`.
2. Upload the `haznox-cleaner-for-updraftplus` folder to `/wp-content/plugins/`.
3. Activate the plugin from **Plugins > Installed Plugins** in WordPress admin.

**After activation:**

* No configuration is required.
* The plugin reads your existing UpdraftPlus settings automatically.
* Go to **Settings > Updraft Cleaner** to view the status panel and activity log.

== Frequently Asked Questions ==

= Does this plugin work without UpdraftPlus? =

No. This plugin is an add-on for UpdraftPlus and requires it to be installed and active.

= Which version of UpdraftPlus is supported? =

Both the free and premium versions of UpdraftPlus are supported. The plugin is compatible with all recent UpdraftPlus versions.

= Will my backups be deleted even if the upload to Google Drive failed? =

No. The plugin checks two things before deleting: (1) that a remote storage service is configured in UpdraftPlus, and (2) that the backup appears in UpdraftPlus backup history. If either check fails, no files are deleted and the reason is recorded in the activity log.

= Why does cleanup happen 10 minutes after the backup? =

The delay ensures that UpdraftPlus has fully finished uploading all backup files to the remote destination before any local files are removed.

= Where can I see what was deleted? =

Go to **Settings > Updraft Cleaner** in your WordPress admin. The activity log shows every backup detected, every file deleted, and every time a deletion was skipped with the reason.

= What happens to the plugin's data when I delete it? =

When you delete (uninstall) the plugin from WordPress admin, all stored options — including the activity log — are automatically removed from the database. No data is left behind.

= Is the plugin compatible with multisite? =

The plugin is designed for single-site use. Multisite compatibility has not been tested.

= Does the plugin send any data externally? =

No. The plugin does not make any external HTTP requests and does not transmit any data outside your server.

== Screenshots ==

1. The Status panel showing UpdraftPlus detection, remote storage status, backup directory, and next scheduled clean time.
2. The Activity Log showing detailed timestamped entries for every backup and cleanup event.
3. The local backup file browser listing all current files in the UpdraftPlus backup directory.

== Changelog ==

= 2.2.0 =
* Renamed plugin to "Haznox Cleaner for UpdraftPlus" and slug to `haznox-cleaner-for-updraftplus` to comply with WordPress.org trademark guidelines.
* Removed `load_plugin_textdomain()` — no longer needed for WordPress.org-hosted plugins since WordPress 4.6.
* Replaced `is_writable()` with `WP_Filesystem` API (`$wp_filesystem->is_writable()`, `->delete()`, `->exists()`) as required by WordPress.org plugin review standards.
* Fixed Plugin URI returning a 404 HTTP response.
* All file system operations now route exclusively through the WordPress `WP_Filesystem` layer.

= 2.1.0 =
* Full WordPress.org coding standards compliance.
* Added proper internationalisation (i18n) — all strings are now translation-ready.
* Replaced `@unlink()` with `wp_delete_file()` (WordPress-recommended file deletion).
* Admin CSS now delivered via `wp_add_inline_style()` instead of inline attributes.
* Added `register_uninstall_hook()` — all plugin data is removed on uninstall.
* Added `uninstall.php` as a secondary uninstall safety net.
* Introduced singleton pattern to prevent duplicate instantiation.
* Nonce field names scoped to plugin slug to prevent conflicts.
* Redirect query parameters scoped to plugin slug.
* Text domain changed to match plugin slug: `haznox-cleaner-for-updraftplus`.
* Added `load_plugin_textdomain()` for translation support.
* Added `languages/` directory placeholder.
* Fixed backup directory resolver to use four fallback methods.
* Resolved token paths (`%WP_CONTENT_DIR%`, etc.) from UpdraftPlus options.

= 2.0.0 =
* Introduced admin dashboard with status panel and activity log.
* Added manual clean and clear log actions.
* Added four-method backup directory resolver.
* Added UpdraftPlus remote storage confirmation check.
* Added support for legacy `updraft_backup_complete` hook.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 2.2.0 =
Trademark compliance rename, WP_Filesystem migration, and Plugin Check error fixes. Required update for all users.

= 2.1.0 =
Full WordPress.org compliance update. Adds translation support, proper uninstall cleanup, and improved security.

= 2.0.0 =
Major feature update adding admin dashboard, activity log, and improved safety checks.
