=== NaveenCodes Database Monitor ===
Contributors: shinu1503
Tags: database, monitor, cleanup, optimizer, db health
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WordPress database monitor — health scoring, table manager, one-click cleanup, and scheduled maintenance. Zero external requests.

== Description ==

**NaveenCodes Database Monitor** is a professional, OOP-based plugin that gives WordPress site owners and developers complete visibility and control over their database.

= Features =

**Dashboard**
* Animated circular health score (0–100) calculated from real overhead and junk data
* Database size, table count, total rows, and overhead — live-refreshing every 60 seconds
* Top-tables bar chart with animated fill
* Quick actions: Run Cleanup / Optimize All

**Table Manager**
* Full table list with data size, index size, overhead, row count, and engine
* Per-table Optimize and Repair with real-time status
* Bulk "Optimize All tables with overhead" with confirmation dialog
* Live search/filter across all table names

**Cleanup Tools**
* 8 cleanup types — each with a live count and single-click clean:
  * Post Revisions
  * Auto Drafts
  * Trashed Posts (with orphaned postmeta)
  * Spam Comments (with orphaned commentmeta)
  * Trashed Comments
  * Expired Transients
  * Orphaned Post Meta
  * Orphaned Comment Meta
* "Run Full Cleanup" button runs all enabled types at once
* Full cleanup history log with duration, items removed, and trigger source

**Query Runner**
* SELECT-only safe query textarea with syntax hint
* Ctrl+Enter shortcut to run
* 6 built-in quick-query templates
* Results table with execution time and row count

**Automated Maintenance**
* Scheduled cleanup: daily, weekly, or monthly (WP-Cron)
* Scheduled table optimization: daily, weekly, or monthly
* Per-type cleanup toggle — enable only what you need
* Weekly database health email report

**Settings**
* Full control over all automation and email settings
* Log retention: configurable 7–365 days
* Query Runner toggle (developer sites only)

**Design**
* Animated database cylinder in page headers
* Floating 3D cubes background decoration
* Responsive — works on all screen sizes

= Free Forever =

No upsells. No premium version. All features free, forever.

= Privacy =

This plugin does not collect or transmit any data outside your own WordPress site. Email reports are sent only to the configured admin email address.

== Installation ==

1. Upload the `naveencodes-database-monitor` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Navigate to **DB Monitor** in the admin sidebar.

== Frequently Asked Questions ==

= Is this plugin safe to use on production sites? =

Yes. All cleanup operations use WordPress API functions and standard SQL with `$wpdb->prepare()`. The Query Runner is restricted to SELECT queries only.

= Can I undo a cleanup? =

Cleanup operations permanently delete data (revisions, drafts, spam, etc.). Always take a database backup before running bulk operations.

= What does the Health Score measure? =

The score starts at 100 and deducts points for overhead percentage, tables with >1 MB overhead, and total cleanable item count. A score of 80+ is excellent.

= Does it work with custom table prefixes? =

Yes. All queries use `$wpdb` table properties and properly handle any table prefix.

== Screenshots ==

1. Dashboard — health gauge, stat cards, top tables bar chart
2. Table Manager — full table list with optimize/repair actions
3. Cleanup Tools — 8 cleanup cards with live counts
4. Settings — automated cleanup, optimization, and email reports

== Changelog ==

= 1.0.1 =
* Fixed: Dashboard widget CSS is now loaded via wp_add_inline_style() instead of an inline style tag.
* Removed: Query Runner feature — removed in response to WP.org guidelines on raw SQL from user input.
* Updated: Tested up to WordPress 7.0.

= 1.0.0 =
* Initial release.
* Dashboard with animated health gauge and bar chart.
* Table Manager with per-table optimize/repair.
* Cleanup Tools for 8 junk data types.
* Scheduled cleanup and optimization via WP-Cron.
* Weekly email health report.
* Full cleanup operation log.

== Upgrade Notice ==

= 1.0.1 =
Fixes WP.org review issues. Update recommended.

= 1.0.0 =
Initial release — no upgrade action needed.
