Skip to content

A ClassicPress/Wordpress plugin which identifies bottlenecks in the mysql database and flags them for optimizing

License

Notifications You must be signed in to change notification settings

nootkan/wp-db-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WP Database Analyzer

Version: 1.8.2
Author: Van Isle Web Solutions
Author URI: https://www.vanislebc.com
Tested With: ClassicPress 2.2.0 / WordPress 6.x
PHP: 8.2+ compatible
License: GPLv2 or later


Overview

WP Database Analyzer is a lightweight, all‑in‑one diagnostic and maintenance tool for WordPress and ClassicPress administrators. It analyzes, cleans, and maintains your core database tables for optimal health, helping to detect orphaned data, expired transients, fragmentation and other performance issues directly from the admin dashboard. The plugin requires no external services or dependencies and runs entirely within your site.


Key Features

1. On‑Demand Database Analysis

  • Scans all core tables (posts, postmeta, users, comments, terms, options, etc.)
  • Reports table size, fragmentation, and index usage
  • Highlights large or bloated tables and high fragmentation
  • Displays clean, readable results in the dashboard

2. Saved Report Management

  • Run Performance Analysis – generate a new report instantly
  • View Last Saved Report, Download, or Clear previous reports
  • Last report stored in the options table (autoload: no) for safe persistence

3. Fragmentation Optimizer

  • Detects significant fragmentation (>10 MB and >10%)
  • Allows safe one‑click OPTIMIZE TABLE actions
  • Displays success/error notices and verifies repair after completion

4. Orphan Data Cleaner (1.5+)

  • Scans for orphaned entries in postmeta, commentmeta, usermeta, and termmeta
  • Identifies expired transients and presents sample listings
  • Lets admins selectively delete only specific orphan types
  • Includes confirmation and warning dialogs for safety

5. Options Overview & Autoload Control (1.5+)

  • Lists largest options in the wp_options / cp_options table (top 200 by size)
  • Shows option name, size, and autoload status
  • Allows toggling autoload flag (yes / no) safely via AJAX
  • Useful for identifying plugins or themes loading large data on every page load

6. Table Repair & Maintenance Tools (1.5+)

  • Adds Run Repair on Core Tables button for rare corruption issues
  • Warns users to back up before running repairs
  • Logs repair and cleanup events to a lightweight activity log

7. Smart Scheduling & Email Summaries (1.6+)

  • Enables automated weekly database analysis via WP‑Cron
  • Optional auto‑optimization of fragmented tables after each run
  • Optionally emails a summary report to the site admin
  • Tracks and displays next scheduled run and recent activity

8. Advanced Diagnostics (1.7+)

  • Lists non‑core tables sharing the DB prefix (e.g. plugin or theme tables)
  • Displays row count, data size, index size, and storage engine
  • Provides a full Cron Task Overview with next run time, schedule, creator, and orphan status
  • Identifies missing callbacks as Possible Orphaned Cron Jobs
  • Fully integrated beneath the main report for continuous monitoring

9. System Snapshot, CSV Export & Developer Hooks (1.8.x)

  • Adds a System Snapshot panel showing:
    • Database name & table prefix
    • Last analysis time
    • Next scheduled run
    • Approximate database size (total / core / non‑core)
    • PHP, MySQL, and WP/CP versions
  • Adds a Download Last Report button (CSV) with a lightweight activity log
  • Introduces developer filters:
    • wpdb_analyzer_fragmentation_thresholds – customize MB/% thresholds
    • wpdb_analyzer_core_tables – extend or override the list of “core” tables
    • wpdb_analyzer_log_event – hook into the maintenance log for custom logging

File Structure

wp-db-analyzer/
├── includes/
│   └── class-wordpress-analyzer.php   # Core analysis engine
├── LICENSE
├── README.md                          # This file
└── wp-db-analyzer.php                 # Admin UI, diagnostics, cleanup & cron logic

Requirements

  • PHP 8.0 or higher (tested with 8.2)
  • MySQL 5.7 / MariaDB 10.3 or newer
  • WordPress 6.x or ClassicPress 2.x
  • Administrator privileges

Changelog

v1.8.2 - Snapshot & CSV polish (Nov 2025)

  • Added System Snapshot box at top of the tools screen
  • Snapshot now shows database size and basic environment versions
  • Added CSV export for the maintenance log
  • Minor UI text tweaks and internal code clean‑up

v1.8.1 - Developer Hooks & Internal Refactors (Nov 2025)

  • Added one-click CSV export of Recent Maintenance Activity
  • Sanitizes CSV output and forces safe download
  • New internal action: admin_post_wpdb_analyzer_export_log

1.8.0 - Developer Hooks + Threshold Filters (Nov 2025)

  • Added filters for fragmentation thresholds
  • Added filters for core table list overrides
  • Added before/after logging actions
  • First stage of making the plugin developer-extensible

v1.7.0 - Advanced Diagnostics (Nov 2025)

  • Added Advanced Diagnostics section with non‑core table listing and cron task overview
  • Marked tasks without callbacks as “Possible Orphan” for easy troubleshooting
  • Displayed creator type (Core, Plugin, Theme) for better traceability
  • Integrated results beneath Recent Maintenance Activity

v1.6.0 - Smart Scheduling (Oct 2025)

  • Added weekly scheduled analysis using WP‑Cron
  • Optional automatic optimization after each run
  • Optional email summary to admin email address
  • Logged scheduling events in Recent Maintenance Activity

v1.5.1 - UI and Safety Enhancements (Sep 2025)

  • Added JavaScript confirm dialogs with multi‑line warnings
  • Highlighted dangerous actions with yellow notices
  • Added server‑side logging for repair and cleanup events

v1.5.0 - Maintenance Tools (Aug 2025)

  • Introduced Orphan Data Cleanup and Options Overview
  • Added Table Repair tool and maintenance logs
  • Improved error handling and admin UI

v1.4.1 - Security Hardening (Jul 2025)

  • Replaced raw exception output with safe admin notices
  • Logged full details server‑side only
  • Removed file path and SQL fragment exposure

v1.4.0 - Feature Enhancements

  • Added report persistence and download capability
  • Added Optimize Fragmented Tables feature
  • Improved analyzer performance and layout

About

A ClassicPress/Wordpress plugin which identifies bottlenecks in the mysql database and flags them for optimizing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages