). * 'nginx-container' — nginx running inside the same container * as PHP. User pastes the snippet into the * container's nginx config (typically * docker/nginx.conf in the site's * docker-compose dir). Host nginx (if any) * is a reverse-proxy that just forwards * bytes — snippet does NOT go there. * 'unknown' — IIS or undetected; treat as manual. */ public static function rewrite_topology(): string { $type = self::type(); if ( self::APACHE === $type || self::LITESPEED === $type ) { return 'htaccess'; } if ( self::NGINX === $type ) { return self::is_containerized() ? 'nginx-container' : 'nginx-host'; } return 'unknown'; } private static function server_signature() { return isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : ''; } /** * Detect active caching plugins that would conflict with xSpeed. Returns * a list of human-readable labels for any conflicting plugin currently * active; empty array means the field is clear. Used by the onboarding * wizard's Step 1 health check and (Phase 2.1) the main dashboard's * Health card. * * The detection key is the plugin's main file path relative to the * plugins directory — the same value WordPress uses internally in * `active_plugins`. Folder-only checks (`is_plugin_active('foo/')`) * would false-positive on disabled plugins still on disk. */ public static function conflicts() { if ( ! function_exists( 'is_plugin_active' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $known = array( 'wp-rocket/wp-rocket.php' => 'WP Rocket', 'w3-total-cache/w3-total-cache.php' => 'W3 Total Cache', 'wp-super-cache/wp-cache.php' => 'WP Super Cache', 'wp-fastest-cache/wpFastestCache.php' => 'WP Fastest Cache', 'litespeed-cache/litespeed-cache.php' => 'LiteSpeed Cache', 'cache-enabler/cache-enabler.php' => 'Cache Enabler', 'comet-cache/comet-cache.php' => 'Comet Cache', 'hummingbird-performance/wp-hummingbird.php' => 'Hummingbird', 'sg-cachepress/sg-cachepress.php' => 'SG Optimizer', 'breeze/breeze.php' => 'Breeze', 'autoptimize/autoptimize.php' => 'Autoptimize', 'flying-press/flying-press.php' => 'FlyingPress', 'nitropack/main.php' => 'NitroPack', ); $active = array(); foreach ( $known as $file => $label ) { if ( is_plugin_active( $file ) ) { $active[] = $label; } } return $active; } }