=== Tanzeef – Database Cleaner & Optimizer ===
Contributors: eslamelshenawy9316
Tags: database cleaner, optimize database, undo, woocommerce cleanup, revisions
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Clean and speed up your WordPress database with one-click undo: revisions, trash, spam, orphaned data, transients and WooCommerce leftovers.

== Description ==

Most database cleaners delete for good: one wrong click and the data is gone. **Tanzeef** (Arabic for "cleaning") saves a **restore point before every cleanup**, so you can **undo** it with one click. It also shows you exactly what will be removed before you remove it, gives your database a **health score**, and cleans the leftovers that make **WooCommerce** stores slow.

= Undo any cleanup =

* Before anything is deleted, Tanzeef saves exactly those rows in a protected file.
* **Undo this cleanup** puts everything back: posts with their meta, categories and comments, comment replies re-attached to their parents, transients and orphaned data, with their original IDs.
* The last cleanup can be undone for 7 days. You can turn restore points off.

= See before you delete =

Click **Show** next to any item to see examples of what will be removed, such as post titles and dates, comment authors, meta keys or transient names, before you clean anything.

= Database health score =

A score out of 100 with plain-language findings: settings loaded on every page, wasted table space, unneeded items and old revisions.

= What it cleans =

* **Revisions**, with an option to keep the ones edited in the last N days.
* **Auto-drafts** and **trashed posts, pages and products**.
* **Spam** and **trashed comments**, plus pending comments and pingbacks when you choose them.
* **Orphaned data**: post, comment, user and term meta, and term relationships left behind by deleted items.
* **oEmbed cache** and **expired transients**.
* **WooCommerce**: expired customer sessions and orphaned order item data.

= Safe by design =

* Posts and comments are deleted with WordPress's own functions, so their meta, terms and caches are cleaned up too and other plugins are notified.
* Big sites are cleaned in small batches, so nothing times out.
* Only items marked safe are selected by default. Pending comments and pingbacks are never removed unless you tick them.

= Tables =

See every table with its rows, size and wasted space, and **optimize** or **repair** it.

= Tanzeef Pro =

Tanzeef Pro is a separate premium plugin. It adds:

* **Automatic cleanups** every day, week or month, with an **email report** after each one.
* **30 days of undo history** for every cleanup, not just the last one.
* **Deep WooCommerce cleanup**: old background task records and logs (Action Scheduler), which grow to hundreds of thousands of rows on busy stores.
* **Autoloaded options**: see what loads on every page and stop autoloading what you don't need.
* **Scheduled tasks (cron)**: see, run or delete background tasks, and spot ones left by removed plugins.
* **Which plugin owns each table, option and task**, and delete tables left behind by removed plugins.

**بالعربي:** تنظيف إضافة بتنضّف قاعدة بيانات ووردبريس وتسرّعها، وبتحفظ نقطة استرجاع قبل كل تنظيف عشان تقدر تتراجع بضغطة. بتوريك اللي هيتمسح قبل ما يتمسح، وبتدّي قاعدة البيانات درجة صحة من 100، وبتنضّف بقايا متاجر ووكومرس.

== Installation ==

1. Install and activate the plugin.
2. Go to **Tools → Tanzeef**.
3. Check the counts, select what to remove, and click **Clean selected**.

== Frequently Asked Questions ==

= Is it safe? =

Tanzeef only removes the items listed, uses WordPress's own functions for posts and comments, and saves a restore point first so you can undo a cleanup. For big changes to an important site, a full database backup is still a good idea.

= Where are restore points stored? =

In wp-content/uploads/tanzeef-restore, in files that cannot be opened from a browser. They are deleted automatically after 7 days, when you undo the cleanup, or when you delete the plugin.

= Will it delete my WooCommerce orders or products? =

No. Only products or orders that are already in the trash are removed, and only if you select "Trashed posts".

= Does it work on multisite? =

It cleans the site you are on. Run it on each site separately.

== Changelog ==

= 0.2.2 =
* The Autoloaded options and Scheduled tasks screens now preview what Pro adds, with an upgrade link.

= 0.2.1 =
* Restore points are stored as data files (no code) in a protected folder in uploads.
* Admin styles and scripts are loaded with wp_enqueue.
* Fixed the preview button on some sites.

= 0.2.0 =
* Undo: a restore point is saved before every cleanup.
* "Show" to preview what will be removed.
* Database health score.
* WooCommerce: expired sessions and orphaned order item data.

= 0.1.0 =
* First version.
