| @@ -31,9 +31,10 @@ | ||
| 31 | 31 | return array( |
| 32 | 32 | 'label' => __( 'Preloader', 'xspeed' ), |
| 33 | 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.', 'xspeed' ), | |
| 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', 'xspeed' ), | |
| 49 | - 'description' => __( 'When on, xSpeed crawls the sitemap on the schedule below and warms the page cache.', 'xspeed' ), | |
| 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', |
| @@ -58,9 +88,9 @@ | ||
| 58 | 88 | 'daily' => 'Daily', |
| 59 | 89 | 'weekly' => 'Weekly', |
| 60 | 90 | ), |
| 61 | 91 | 'label' => __( 'Schedule', 'xspeed' ), |
| 62 | - 'description' => __( 'How often to start a fresh crawl. Manual means you trigger it from the dashboard.', '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,10 +96,11 @@ | ||
| 66 | 96 | 'type' => 'int', |
| 67 | 97 | 'default' => 5, |
| 68 | 98 | 'min' => 1, |
| 69 | 99 | 'max' => 50, |
| 70 | - 'label' => __( 'Batch Size', 'xspeed' ), | |
| 71 | - 'description' => __( 'URLs warmed per cron tick. Higher = faster crawl, more load on the origin.', 'xspeed' ), | |
| 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', |
| @@ -74,9 +105,9 @@ | ||
| 74 | 105 | 'sitemap_url' => array( |
| 75 | 106 | 'type' => 'string', |
| 76 | 107 | 'default' => '', |
| 77 | 108 | 'label' => __( 'Sitemap URL (optional)', 'xspeed' ), |
| 78 | - 'description' => __( 'Override the auto-detected WordPress core sitemap (/wp-sitemap.xml). Leave blank for default.', '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', |
| @@ -81,9 +112,9 @@ | ||
| 81 | 112 | 'warm_on_publish' => array( |
| 82 | 113 | 'type' => 'bool', |
| 83 | 114 | 'default' => true, |
| 84 | 115 | 'label' => __( 'Warm new content immediately', 'xspeed' ), |
| 85 | - 'description' => __( 'When a post or page is published, fetch it once so the first visitor sees a cache HIT, not a cold MISS.', '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', |
| @@ -88,9 +119,9 @@ | ||
| 88 | 119 | 'warm_on_comment' => array( |
| 89 | 120 | 'type' => 'bool', |
| 90 | 121 | 'default' => false, |
| 91 | 122 | 'label' => __( 'Re-warm after comments', 'xspeed' ), |
| 92 | - 'description' => __( 'Re-warm a page after a comment is posted (Cache purges the page on comment; this fetches it back into cache).', '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 | } |