=== WP Debug Toolkit Pro ===
Contributors: wpdebugtoolkit
Tags: debug, debugging, development, error logging, log viewer, error monitor, debug logs, wp-config, error handling, php errors
Requires at least: 5.6
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Advanced debugging toolkit for WordPress that enhances the development experience with a beautiful log viewer and powerful error management tools.

== Description ==

**WP Debug Toolkit Pro** is an essential monitoring suite for WordPress agencies and developers. It gives you complete visibility into your site's health, database performance, and error logs—even when WordPress is completely broken.

Instead of relying on fragile plugins that crash when your site does, WP Debug Toolkit uses a hybrid architecture (Plugin + Standalone Viewer) to ensure you always have access to critical debug data.

### Key Features

* **Error Log Viewer (Standalone)** - A high-performance log reader that runs independently of WordPress. Debug White Screen of Death (WSOD) issues instantly without FTP/SSH.
* **Query Viewer** - Filesystem-based database monitoring with zero "Observer Effect." Identify slow queries and N+1 patterns without slowing down your site.
* **Email Alerts** - Proactive notifications for critical errors. Includes a dual-channel delivery system (native mail fallback) to ensure you know about crashes before your clients do.
* **Emergency Recovery** - The Standalone Viewer works even if the database is down, allowing you to identify the culprit plugin/theme immediately.
* **Professional Reporting** - White-label email alerts with custom branding for your agency clients.
* **One-Click Debug Mode** - Enable/disable debugging constants safely without touching `wp-config.php`.
* **Smart Filtering** - Advanced search operators (`+include -exclude`) to cut through log noise.
* **Modern React UI** - Fast, responsive interfaces that make debugging feel like a modern workflow.

### Perfect For

* **Agencies** managing multiple client sites who need proactive monitoring
* **Developers** who need deep technical insights without database overhead
* **Site Owners** who want peace of mind knowing their site is being watched 24/7

### Live Demo & Documentation

See the full feature breakdown at [wpdebugtoolkit.com](https://wpdebugtoolkit.com).



== Installation ==

1. Upload the `wpdebugtoolkit` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Access WP Debug Toolkit from the WordPress admin menu and activate the license key
4. Install the standalone viewer with one click from the plugin's interface
5. Start using the powerful debugging tools!

== Frequently Asked Questions ==

= Is this plugin free? =

There is a free version planned, but at the moment there is only a Premium (paid) licensed version.

= Will this plugin slow down my site? =

No. Unlike other debugging tools that write logs to your database (bloating it and slowing down queries), WP Debug Toolkit uses filesystem logging for its Query Viewer. This ensures zero database overhead and minimal impact on your site's performance.

= What happens if my site crashes (WSOD)? =

This is where WP Debug Toolkit shines. Because the **Standalone Viewer** runs as a separate React application (independent of WordPress core), you can access it directly via its URL even if your WP Admin is inaccessible. You can see the fatal error log immediately without needing FTP/SSH. If you have the email alerts enabled, you'll also receive an email with a WP Recovery URL you can use to regain access to your site.

= Is it safe to use on a production site? =

Yes. The tools are explicitly designed for production monitoring with a "security-first" architecture:
1. **Query Viewer:** Uses filesystem logging to avoid database strain.
2. **Viewer App:** Protected by a secure, standalone authentication system (independent of WP users) and strict path validation.
3. **Debug Mode:** You can toggle debug logging on/off instantly as needed.
4. **Security In Mind:** Rate-limited login attempts and customizable session timeouts to prevent brute-force attacks, and more. 

= Can I use this on a local development environment? =

Absolutely! WP Debug Toolkit is designed to work seamlessly in local development environments like XAMPP, Local by Flywheel, DevKinsta, Docker etc.

= Does this plugin modify my wp-config.php file? =

Yes, when you enable or disable debugging features, WP Debug Toolkit safely modifies your wp-config.php file to add the necessary constants. It creates a backup before making any changes.


== Changelog ==

= 1.1.0 =
* New: Query Logger - Real-time database query monitoring with slow query detection and performance metrics
* New: Query Statistics Dashboard - Visual insights into query performance and component-level breakdowns
* New: N+1 Query Detection - Automatically identifies and highlights repeated queries with aggregate statistics
* New: Database query error logging with detailed error messages and filtering
* New: Query export to CSV, JSON, and TSV formats with accurate component attribution
* New: Dynamic query statistics that recalculate based on active filters
* New: WP-CLI commands for license activation, debug toggling, viewer setup, and log management (wp dbtk)
* New: Email notification system for error alerts with customizable templates
* New: Automatic log cleanup with delete/archive/truncate methods, size limits, and age-based rotation
* New: Viewer permissions health check with repair button in Site Health
* New: Viewer settings for query dashboard limit, tail scan MB, max entry MB
* New: PHP memory limit management (writes to wp-config.php)
* New: Upload limit controls via WordPress filters
* New: Settings UI redesign with modern tabbed interface
* New: Modular licensing system with grandfathered benefits for early adopters
* Security: Query logs encrypted at rest
* Security: Password protection now mandatory for viewer (8-character minimum)
* Security: SQLite-based rate limiting with progressive brute-force protection
* Security: Enhanced session security with 30-minute timeout and IP binding
* Security: Strengthened path traversal prevention with expanded blocklist
* Security: Replaced exec() with token_get_all() for PHP syntax validation
* Security: Fixed wp-config.php case-sensitivity bypass vulnerability in viewer
* Security: Added protection for secure-debug.php (GridPane compatibility)
* Security: Scoped CORS headers to plugin endpoints only
* Security: Restricted wp-config backup file permissions
* Security: Hardened viewer config and auth files against direct access
* Security: Expanded viewer blocked files list with additional sensitive file patterns
* Security: Added directory listing protection for query log storage
* Improved: Production and performance warnings in setup wizard for debug mode and query logging
* Improved: “Install without tools” option to set up the viewer without enabling debugging tools
* Improved: Setup wizard defaults tools to disabled — users opt in consciously
* Improved: Viewer installer wizard with step-by-step guidance
* Improved: Redesigned crash recovery system with cleaner UI and granular plugin/theme controls
* Improved: License management moved to Settings page
* Improved: Targeted cache clearing (plugin-specific transients only)
* Improved: Enhanced output buffer management
* Improved: Better type safety and code quality across PHP and React code
* Added: Custom file paths configuration (DBTK_CONFIG_PATH, DBTK_LOG_PATH constants)
* Added: Error level selection in Settings (Debug, Info, Warning, Error)
* Added: Cache busting in Admin and Viewer apps
* Added: WordPress internationalization (wp-i18n) support
* Added: Psalm static analysis with type hints
* Added: Partner discounts page
* Fix: Query Viewer tail reader no longer returns 0 entries on huge final log line
* Fix: Viewer auth rate limiter fallback when PDO SQLite is unavailable
* Fix: Directory permission issues on restrictive servers (umask handling)
* Fix: Viewer installation on hosts where WordPress files are in subfolders
* Fix: Path validation now supports relative paths securely
* Fix: Health check now properly loads WordPress admin functions
* Fix: Admin CSS isolation prevents conflicts with other plugins
* Fix: Compatibility with UiPress Lite and WP Dark Mode
* Fix: wp-config.php duplicate constants when reinstalling viewer

= 1.0.1-beta-2 =
* Fixed: Critical GridPane issue where uninstalling the plugin would break sites due to secure-debug.php dependency

= 1.0.1-beta =
* Added: Full GridPane hosting compatibility
* Fixed: Debug constants modification for non-standard wp-config.php structures
* Fixed: Log viewer access for logs stored outside the web root
* Improved: Simplified configuration file detection logic
* Improved: Better error messages for file permission issues

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.0.1-beta =
Beta release with GridPane compatibility fix. Please test and report any issues.

= 1.0.0 =
Initial release of WP Debug Toolkit Pro. Enjoy enhanced debugging capabilities for your WordPress site!

== Additional Resources ==

For more information, documentation and support, visit [https://wpdebugtoolkit.com](https://wpdebugtoolkit.com) 