Silver Assist Post Revalidate v1.4.0
What's New in v1.4.0
Added
- Configuration Class: New centralized post type management system
- Singleton Pattern:
Configuration::instance()for centralized access - Post Type Methods:
get_enabled_post_types(),is_post_type_enabled($type) - Label Helpers:
get_post_type_label($type),get_post_type_label_plural($type) - Future-Ready: Prepared with
@todocomments for settings UI integration - Type-Safe: Uses WordPress
WP_Post_Typeobjects - Test Coverage: 10 unit tests covering all Configuration methods
- Singleton Pattern:
- Manual Revalidation UI: New admin interface for manual cache revalidation
- Row Actions: "Revalidate" link in post list table (alongside Edit, Quick Edit, Trash, View)
- Meta Box: "Revalidate" button in post editor sidebar (Gutenberg + Classic Editor)
- AJAX Support: Real-time revalidation with loading states and feedback
- Admin Notices: WordPress-style success/error messages
- Non-AJAX Fallback: Row action works without JavaScript (accessibility)
- Security: Nonce validation +
edit_postscapability checks on all endpoints - Trigger Tracking: Log entries now include
triggerfield ('manual' vs 'auto') - Comprehensive Tests: 10 integration tests for complete feature coverage
- New Class:
ManualRevalidationhandles all manual revalidation functionality - New JavaScript:
manual-revalidate.jsprovides AJAX handler for meta box button - Performance Test Suite: Comprehensive benchmark tests for performance optimization
- 6 Performance Tests: Bulk operations, memory limits, N+1 queries, transient performance, single operations, log rotation
- Baseline Metrics: Establishes performance benchmarks for future optimization work
- Test Coverage: All tests passing with metrics within acceptable limits
- Bulk revalidation: 395ms for 100 posts (target <10s) ✅
- Memory usage: <10MB for 100 entries ✅
- N+1 queries: No linear scaling detected ✅
- Transient operations: 35ms for 100 operations ✅
- Single revalidation: 4.82ms (target <100ms) ✅
- Log rotation: 482ms with FIFO verified ✅
Changed
- Post Type Management: Refactored to use Configuration class (no more hardcoded 'post')
- All post type checks now use
Configuration::is_post_type_enabled() - Removed hardcoded
'post'strings fromRevalidate.php - Removed hardcoded
'post'strings fromManualRevalidation.php - Dynamic post type in meta box registration
- Dynamic post type in redirect URLs
- Prepared for future custom post types support
- All post type checks now use
- JavaScript Namespace: Renamed global functions to avoid collision with other Silver Assist plugins
- Function:
silverAssistCheckUpdates()→silverAssistRevalidateCheckUpdates() - Data object:
silverAssistCheckUpdatesData→silverAssistRevalidateCheckUpdatesData - Each Silver Assist plugin now uses plugin-specific function names
- Prevents function overwriting when multiple plugins are active
- Function:
- Revalidate Class: Extended with trigger parameter support
- Added
revalidate_path($path, $trigger = 'auto')method - Updated
revalidate_paths()to accept$triggerparameter - Log entries now include 'trigger' field for analytics
- Backward compatible: default trigger is 'auto'
- Added
- Test Infrastructure: Updated factory calls from
$this->factorytostatic::factory()across all test files- Fixes deprecation warnings in recent PHPUnit versions
- Updated in:
ManualRevalidation_Test,TransientCooldown_Test,Revalidate_Test,Performance_Test
Improved
- Update Check UX: Replaced JavaScript
alert()calls with WordPress-style admin notices- Added
showAdminNotice()helper function for consistent UI - Success/info notices auto-dismiss after 5 seconds
- Error/warning notices require manual dismissal
- Smooth fade animations for better user experience
- Added "Checking for updates..." notice during AJAX request
- Added 2-second delay before redirect when update available
- Added
Fixed
- Settings Hub Integration: Added missing
echostatement in update check callback- Settings Hub requires callbacks to echo JavaScript, not return it
- Ensures "Check Updates" button functions correctly in Settings Hub dashboard
- PHPStan Compliance: Fixed type error in
ManualRevalidation.php- cast post ID to string foresc_attr() - Code Quality: All PHPStan level 8 checks passing
Installation
- Download
silver-assist-post-revalidate-v1.4.0.zip - Go to WordPress Admin > Plugins > Add New > Upload Plugin
- Choose the downloaded ZIP file and click "Install Now"
- Activate the plugin
- Configure your revalidation endpoint at Settings > Post Revalidate
Automatic Updates
This plugin includes automatic update functionality. You'll receive notifications in your WordPress admin when new versions are available.
Requirements
- PHP 8.2 or higher
- WordPress 6.5 or higher