PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.7
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.7
1.3.7 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 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 All 33 releases
← All changes | includes/modules/Preloader/PreloaderModule.php +65 -15 1.2.4 → 1.3.7 View file →
@@ -28,12 +28,13 @@
28 28 public const VERSION = '1.0.0';
29 29
30 30 public function ui_metadata(): array {
31 31 return array(
32 - 'label' => 'Preloader',
33 - 'tab_label' => 'Crawl Now', // its own tab on the Preloader page
32 + 'label' => __( 'Preloader', 'xspeed' ),
33 + 'tab_label' => __( 'Crawl Now', 'xspeed' ), // its own tab on the Preloader page
34 34 'icon' => 'Wand2',
35 - 'description' => 'Crawl the sitemap to warm cache so visitors never hit a cold MISS.',
35 + 'description' => __( 'Visits your pages ahead of time so visitors get fast cached pages.', 'xspeed' ),
36 + 'group' => 'cache',
36 37 // Custom panel wraps the schema-driven settings with a
37 38 // Start/Stop control surface + a live status readout
38 39 // (queue depth, last URL, recent errors).
39 40 'custom_panel' => 'PreloaderHost',
@@ -39,15 +40,44 @@
39 40 'custom_panel' => 'PreloaderHost',
40 41 );
41 42 }
42 43
44 + /**
45 + * Surface a firewall refusing our warmer.
46 + *
47 + * A 403/406 on a warm used to reach the admin only as "HTTP 403" buried
48 + * in the activity log, so a site whose every warm was refused looked
49 + * simply idle — newly published posts were never warmed and nothing said
50 + * why. The page is fine; the fix is a server rule, so the notice names
51 + * the user-agent to allow. (#481)
52 + */
53 + public function ui_notices(): array {
54 + $block = Preloader::firewall_block();
55 + if ( null === $block ) {
56 + return array();
57 + }
58 +
59 + return array(
60 + array(
61 + 'tone' => 'warn',
62 + 'title' => __( 'Your server is blocking the xSpeed cache warmer', 'xspeed' ),
63 + 'body' => sprintf(
64 + /* translators: 1: HTTP status code, 2: the user-agent xSpeed sends. */
65 + __( 'A warm request was refused with HTTP %1$d, which is how a firewall answers when it judges a request by its user-agent. Pages are not being warmed, so the first visitor to each new page waits for an uncached render. Allow the user-agent "%2$s" in your server\'s bad-bot rules — on xCloud this is the 8G firewall — or change it with the xspeed_preloader_user_agent filter. This notice clears itself once a warm gets through.', 'xspeed' ),
66 + (int) $block['code'],
67 + (string) ( $block['user_agent'] ?? Preloader::user_agent() )
68 + ),
69 + ),
70 + );
71 + }
72 +
43 73 public function settings_schema(): array {
44 74 return array(
45 75 'enabled' => array(
46 76 'type' => 'bool',
47 77 'default' => false,
48 - 'label' => 'Enable Preloader',
49 - 'description' => 'When on, xSpeed crawls the sitemap on the schedule below and warms the page cache.',
78 + 'label' => __( 'Enable preloader', 'xspeed' ),
79 + 'description' => __( 'xSpeed visits every page in your sitemap on the schedule below, so each page is cached before a visitor asks for it.', 'xspeed' ),
50 80 ),
51 81 'schedule' => array(
52 82 'type' => 'enum',
53 83 'default' => 'manual',
@@ -57,10 +87,10 @@
57 87 'hourly' => 'Hourly',
58 88 'daily' => 'Daily',
59 89 'weekly' => 'Weekly',
60 90 ),
61 - 'label' => 'Schedule',
62 - 'description' => 'How often to start a fresh crawl. Manual means you trigger it from the dashboard.',
91 + 'label' => __( 'Schedule', 'xspeed' ),
92 + 'description' => __( 'How often to visit all pages again. Manual means you start it from the dashboard.', 'xspeed' ),
63 93 'dependsOn' => array( 'field' => 'enabled' ),
64 94 ),
65 95 'batch_size' => array(
66 96 'type' => 'int',
@@ -66,31 +96,32 @@
66 96 'type' => 'int',
67 97 'default' => 5,
68 98 'min' => 1,
69 99 'max' => 50,
70 - 'label' => 'Batch Size',
71 - 'description' => 'URLs warmed per cron tick. Higher = faster crawl, more load on the origin.',
100 + 'label' => __( 'Pages per run', 'xspeed' ),
101 + 'description' => __( 'How many pages are cached on each run. A higher number finishes sooner but puts more load on your server.', 'xspeed' ),
102 + 'advanced' => true,
72 103 'dependsOn' => array( 'field' => 'enabled' ),
73 104 ),
74 105 'sitemap_url' => array(
75 106 'type' => 'string',
76 107 'default' => '',
77 - 'label' => 'Sitemap URL (optional)',
78 - 'description' => 'Override the auto-detected WordPress core sitemap (/wp-sitemap.xml). Leave blank for default.',
108 + 'label' => __( 'Sitemap URL (optional)', 'xspeed' ),
109 + 'description' => __( 'Use a different sitemap than the WordPress one (/wp-sitemap.xml). Leave blank for the default.', 'xspeed' ),
79 110 'dependsOn' => array( 'field' => 'enabled' ),
80 111 ),
81 112 'warm_on_publish' => array(
82 113 'type' => 'bool',
83 114 'default' => true,
84 - 'label' => 'Warm new content immediately',
85 - 'description' => 'When a post or page is published, fetch it once so the first visitor sees a cache HIT, not a cold MISS.',
115 + 'label' => __( 'Warm new content immediately', 'xspeed' ),
116 + 'description' => __( 'Cache a post or page as soon as you publish it, so the first visitor gets the fast cached page.', 'xspeed' ),
86 117 'dependsOn' => array( 'field' => 'enabled' ),
87 118 ),
88 119 'warm_on_comment' => array(
89 120 'type' => 'bool',
90 121 'default' => false,
91 - 'label' => 'Re-warm after comments',
92 - 'description' => 'Re-warm a page after a comment is posted (Cache purges the page on comment; this fetches it back into cache).',
122 + 'label' => __( 'Re-warm after comments', 'xspeed' ),
123 + 'description' => __( 'A new comment clears the page from the cache. This caches the page again right away.', 'xspeed' ),
93 124 'dependsOn' => array( 'field' => 'enabled' ),
94 125 ),
95 126 );
96 127 }
@@ -140,8 +171,27 @@
140 171 );
141 172 }
142 173
143 174 public function boot(): void {
175 + /*
176 + * Deferred to `init`. This module reads its own settings to decide
177 + * what to hook, and reading settings builds settings_schema(), whose
178 + * labels are declared through __(). boot() runs on `plugins_loaded`,
179 + * before `after_setup_theme` — the point WordPress 6.7+ treats as the
180 + * earliest safe moment to translate — so doing that here fires
181 + * _load_textdomain_just_in_time on every request AND resolves the
182 + * labels against a domain that is not loaded yet.
183 + *
184 + * Everything below hooks actions that fire after `init`, so running
185 + * one hook later is equivalent.
186 + */
187 + add_action( 'init', array( $this, 'boot_on_init' ) );
188 + }
189 +
190 + /**
191 + * The real boot body — see boot() for why it runs on `init`.
192 + */
193 + public function boot_on_init(): void {
144 194 add_action( Preloader::CRON_HOOK, array( Preloader::class, 'tick' ) );
145 195 add_action( 'xspeed_preloader_recurring', array( Preloader::class, 'recurring_kickoff' ) );
146 196
147 197 // Apply schedule changes immediately whenever this module's