PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.2
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.2
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 1.1.5 1.1.6 1.1.7 1.1.8 All 29 releases
← All changes | includes/class-onboarding.php +61 -4 1.1.21.3.2 View file →
@@ -143,19 +143,32 @@
143 143 if ( function_exists( 'wp_set_script_translations' ) ) {
144 144 wp_set_script_translations( 'xspeed-admin', 'xspeed', XSPEED_DIR . 'languages' );
145 145 }
146 146 }
147 + // Redesign v2 tokens + fonts (see Admin::enqueue) — the wizard shares
148 + // them so it matches the dashboard identity.
149 + $theme_css = XSPEED_DIR . 'assets/theme.css';
150 + if ( file_exists( $theme_css ) ) {
151 + wp_enqueue_style(
152 + 'xspeed-theme',
153 + XSPEED_URL . 'assets/theme.css',
154 + array(),
155 + XSPEED_VERSION . '.' . filemtime( $theme_css )
156 + );
157 + }
147 158 if ( file_exists( $asset_css ) ) {
148 159 wp_enqueue_style(
149 160 'xspeed-admin',
150 161 XSPEED_URL . 'assets/admin.css',
151 - array(),
162 + array( 'xspeed-theme' ),
152 163 XSPEED_VERSION . '.' . filemtime( $asset_css )
153 164 );
154 165 }
155 166
156 - wp_localize_script(
157 - 'xspeed-admin',
167 + // Same type-preserving path as the dashboard — see
168 + // Admin::print_config(). wp_localize_script() would stringify every
169 + // scalar in this payload too. (#105)
170 + Admin::print_config(
158 171 'XSpeedConfig',
159 172 array(
160 173 'mode' => 'onboarding',
161 174 'restUrl' => esc_url_raw( rest_url( Rest_Api::NAMESPACE_V1 ) ),
@@ -167,8 +180,11 @@
167 180 'branding' => Admin::branding(),
168 181 'dashboardUrl' => admin_url( 'admin.php?page=' . Admin::PAGE_SLUG ),
169 182 'bootstrap' => array(
170 183 'settings' => Settings::get(),
184 + // Live values for every wizard toggle, so re-running the
185 + // wizard reflects the site instead of overwriting it.
186 + 'current' => self::current_choices(),
171 187 'env' => self::env_payload(),
172 188 // xSpeed Hub connection snapshot for the wizard's first
173 189 // "Connect your account" step. Guarded so core onboarding
174 190 // never hard-depends on the MCP module — if it's absent the
@@ -180,8 +196,50 @@
180 196 );
181 197 }
182 198
183 199 /**
200 + * The site's CURRENT values for every toggle the wizard can write,
201 + * in the same shape as the wizard's OnboardingChoices.
202 + *
203 + * The wizard used to seed its toggles from hard-coded preset constants,
204 + * so re-running it on a configured site showed a fiction: options the
205 + * admin had deliberately switched on rendered as off, and Apply wrote
206 + * that fiction back, silently undoing their configuration. Nothing
207 + * warned them, and the completion screen still reported success.
208 + *
209 + * The wizard couldn't have done better on its own — the bootstrap only
210 + * carried Settings::get(), which is just cache_enabled. Every other
211 + * toggle lives in a per-module option the payload never included, so
212 + * this method is what makes "show the site as it actually is" possible.
213 + *
214 + * Pure read. Mirrors the keys apply() writes, so the two stay in step.
215 + *
216 + * @return array<string,bool|int>
217 + */
218 + public static function current_choices() {
219 + $minify = Settings_Manager::get( 'minify' );
220 + $gzip = Settings_Manager::get( 'gzip' );
221 + $cache = Settings_Manager::get( 'cache' );
222 + $lazy = Settings_Manager::get( 'lazy' );
223 + $browser = Settings_Manager::get( 'browser-cache' );
224 + $hints = Settings_Manager::get( 'resource-hints' );
225 + $settings = Settings::get();
226 +
227 + return array(
228 + 'cache_enabled' => ! empty( $settings['cache_enabled'] ),
229 + 'minify_html' => ! empty( $minify['minify_html'] ),
230 + 'minify_css' => ! empty( $minify['minify_css'] ),
231 + 'minify_js' => ! empty( $minify['minify_js'] ),
232 + 'defer_js' => ! empty( $minify['defer_js'] ),
233 + 'gzip_enabled' => ! empty( $gzip['gzip_enabled'] ),
234 + 'lazy_images' => ! empty( $lazy['lazy_images'] ),
235 + 'browser_cache' => ! empty( $browser['enabled'] ),
236 + 'resource_hints' => ! empty( $hints['enabled'] ),
237 + 'cache_expiry' => isset( $cache['cache_expiry'] ) ? absint( $cache['cache_expiry'] ) : \XSpeed\Modules\Cache\CacheModule::DEFAULT_EXPIRY_HOURS,
238 + );
239 + }
240 +
241 + /**
184 242 * Environment snapshot rendered as Step 1's health rows. Pure read —
185 243 * never writes to disk, never makes outbound requests.
186 244 */
187 245 public static function env_payload() {
@@ -320,9 +378,8 @@
320 378 }
321 379 }
322 380
323 381 $install_state = Cache::toggle( $want_cache );
324 - Settings::update( array( 'cache_enabled' => $install_state['enabled'] ) );
325 382
326 383 // Recompute the unified nginx block AFTER cache_enabled is persisted.
327 384 // Cache::toggle() computes it inline, before the Settings::update()
328 385 // above writes cache_enabled — so the block in $install_state reflects