=== Gogasys Media Cleaner: Clean Unused Media, Duplicate Files & Database ===
Contributors: gogasysitsolutions
Tags: media cleaner, unused media, delete unused images, database cleaner, duplicate media, clean wordpress
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

The ultimate Media Cleaner to clean your WordPress media library! Safely delete unused media, duplicate files, orphaned images, and optimize your database.

== Description ==

[youtube https://www.youtube.com/watch?v=-7_n2CfpG_8]

**Media Cleaner: Clean your WordPress!**
Gogasys Media Cleaner is the most powerful, all-in-one plugin that helps you clean up your WordPress media library by deleting unused media entries and files, finding duplicate media, and fixing broken database entries. 

With an advanced internal trash feature, you can preview and confirm changes before permanently deleting anything. Plus, Gogasys Media Cleaner uses smart analysis to ensure compatibility with specific plugins and themes, ensuring you never break your website layout. 

Whether you need to clean up unused images, free up server space, or just keep your media library organized, this is the only Media Cleaner you need!

= Advanced Features =
* **Internal Trash System (Safety First):** Safely move unused media to a secure, temporary trash bin before permanent deletion. Easily click "Restore" to recover media if needed!
* **Orphaned Filesystem Scanner:** Scans your physical `/wp-content/uploads/` directory for "ghost" files that are wasting server space but aren't visible in the Media Library. It safely cleans them up while strictly ignoring all code/system files (PHP, CSS, JS).
* **Duplicate Media Scanner:** Finds exactly identical files (matching by file size and MD5 hash content) and allows you to easily trash duplicates to free up massive storage.
* **1-Click Database Optimization:** Works as a database cleaner by safely removing orphaned postmeta, term relationships, and expired transients left behind by deleted media.
* **Deep Scanning Engine:** Checks post content, featured images, WooCommerce galleries, ACF fields, Site icons, **Widgets, and Theme Customizer Options**.
* **AJAX-Based Processing:** Handles enormous media libraries with millions of files without server timeouts by processing in controlled batches.
* **Modern Admin Dashboard:** Clean, responsive UI fully integrated into the WordPress admin with dedicated tabs for Scanner, Trash, Filesystem, Duplicates, and DB Optimization.

= COMPATIBILITY =
This Media Cleaner plugin is highly compatible with all media types, including WebP, PNG, JPG, and PDFs. It has been extensively tested with the Gutenberg editor, WooCommerce, and various page builders (Elementor, Divi, WPBakery). It successfully scans post meta where complex page builders store their image data!

== Installation ==

1. Upload the `gogasys-unused-media-cleaner` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to Media -> Unused Media to start your first scan.

== Frequently Asked Questions ==

= Is it safe to delete the files? =
While the plugin uses a robust scanning strategy, we always recommend taking a full backup of your site and database before performing bulk deletions.

= Does it support page builders? =
Yes, it scans post content and meta values where most page builders store their data.

== Changelog ==

= 1.1.2 =
* **New Feature:** Added a 1-Click Database Optimization tool to safely purge orphaned metadata and expired transients.
* **New Feature:** Added a 1-Click "Empty Trash" button to instantly permanently delete all files currently sitting in the plugin's trash bin.
* **Security Enhancement:** Both the Orphaned Filesystem and Duplicate Media scanners now strictly ignore system files (PHP, CSS, JS, etc.) to completely prevent accidental layout/code breaks.

= 1.1.1 =
* **New Feature:** Added Duplicate Media Scanner. Finds identical files to help you free up massive amounts of storage.
* **New Feature:** Added Orphaned Filesystem Scanner. Cleans up physical files that are wasting space on your server without being visible in the Media Library.
* **Enhancement:** Scanner now detects images used in Widgets and Theme Customizer settings.
* **UI Update:** Added "Orphaned Files" and "Duplicates" tabs to the admin dashboard.

= 1.1.0 =
* **New Feature:** Added an Internal Trash System! Media files are now moved to a secure trash folder instead of being permanently deleted immediately.
* **New Feature:** Added a "Restore" button to easily recover media from the trash.
* **UI Update:** Added a new "Trash" tab to the admin dashboard for managing deleted files.

= 1.0.5 =
* Architectural scaling improvement: Replaced transient memory storage with direct DB offset queries to support millions of posts and infinite media libraries without memory exhaustion or timeouts.
* Real-time Results: Unused media files now instantly populate the results table batch-by-batch during the scan.
* Highly optimized database queries to drastically reduce scanning time.
* Fixed progress bar logic to update accurately during scanning.
* Reduced batch size for smoother progress indication.

= 1.0.4 =
* Enhanced scan progress UI to show distinct stages (Initialization done, total files found, batch progress).

= 1.0.3 =
* Optimized scan initialization time.
* Added a warning disclaimer before performing deletions.
* Resolved an issue causing false positives where some unused media was not showing up.

= 1.0.2 =
* Changed menu location to left sidebar.
* Fixed scan initialization connection error.
* Maintained scan results after page refresh.

= 1.0.1 =
* Refactored for prefixing compliance and updated tested up to version.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.2 =
Keep your database lean! We've added a 1-Click DB Optimization tool and an Empty Trash button for maximum efficiency. Update highly recommended.

= 1.1.1 =
New advanced scanning tools! We've added a Duplicate Media scanner and an Orphaned Filesystem scanner to help you reclaim server space. Update highly recommended.

= 1.1.0 =
Massive safety upgrade! We've introduced an Internal Trash System to prevent accidental deletions. You can now restore deleted media files. Update highly recommended.

= 1.0.5 =
Major performance boost for scanning. Update recommended.

= 1.0.4 =
UI enhancements for scan progress reporting.

= 1.0.3 =
Scanner optimizations and accuracy improvements.

= 1.0.2 =
Bug fixes for scanning and UI improvements.

= 1.0.1 =
Refactored for prefixing compliance and updated tested up to version.

= 1.0.0 =
Initial release.
