PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / trunk
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN vtrunk
1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2.0 1.2.1 1.2.2 1.2.3
xspeed / includes / modules / CacheCoverage / CacheCoverageModule.php

CacheCoverageModule.php in xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN trunk, at includes/modules/CacheCoverage/CacheCoverageModule.php

75 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Cache Coverage — a sidebar row that gathers the Pro features which
4 * extend Page Cache beyond the default HTML-for-anonymous-visitors
5 * behaviour (FBS-83633).
6 *
7 * A thin Free container: it owns no settings. Its panel renders the
8 * existing coverage section (CacheExtras) with its three tabs —
9 * What to cache / Feeds & API / Rules & bypass — each embedding the
10 * Pro module that owns those settings. Being a Free container, the row
11 * is never a locked dead-end; the individual tabs unlock in place.
12 *
13 * This lives as its own Cache sub-item (rather than stacked at the foot
14 * of the Page Cache page) so the coverage features are reachable
15 * directly from the sidebar.
16 *
17 * @package XSpeed
18 */
19
20 declare(strict_types=1);
21
22 namespace XSpeed\Modules\CacheCoverage;
23
24 defined( 'ABSPATH' ) || exit;
25
26 use XSpeed\Module;
27
28 final class CacheCoverageModule extends Module {
29
30 public const SLUG = 'cache-coverage';
31 public const TIER = self::TIER_FREE;
32 public const VERSION = '1.0.0';
33
34 public function ui_metadata(): array {
35 return array(
36 'label' => 'Advanced Cache',
37 'icon' => 'Layers',
38 'description' => 'Cache 404s, search, feeds, and the REST API, plus custom rules and maintenance bypass.',
39 'custom_panel' => 'CacheCoveragePanel',
40 );
41 }
42
43 /** Container owns no settings; each tab persists through its own module. */
44 public function settings_schema(): array {
45 return array();
46 }
47
48 public function cli_commands(): array {
49 return array(
50 array(
51 'name' => 'xspeed cache-coverage',
52 'callback' => array( $this, 'cli_handler' ),
53 'shortdesc' => 'Show which cache-coverage features are available (404 / search / feed / REST / rules / maintenance).',
54 'ai_hint' => 'Which page types beyond normal posts/pages can be cached here (404s, search, feeds, REST, maintenance)? Use when asked why a particular kind of URL is never cached.',
55 'synopsis' => array(),
56 ),
57 );
58 }
59
60 public function cli_handler( array $args, array $assoc ): void {
61 $features = array(
62 'cache-404' => '404 Caching',
63 'search-cache' => 'Search Caching',
64 'feed-cache' => 'Feed Caching',
65 'rest-cache' => 'REST API Cache',
66 'custom-rules' => 'Custom Cache Rules',
67 'maintenance-cache' => 'Maintenance Mode',
68 );
69 foreach ( $features as $slug => $label ) {
70 $present = \XSpeed\Module_Registry::has( $slug ) ? 'available' : 'locked';
71 \WP_CLI::log( sprintf( '%-20s %-14s %s', $slug, $present, $label ) );
72 }
73 }
74 }
75