| @@ -389,8 +389,12 @@ | ||
| 389 | 389 | if ( empty( $servers ) || ! is_array( $servers ) ) { |
| 390 | 390 | continue; |
| 391 | 391 | } |
| 392 | 392 | $first = (string) ( $servers[0] ?? '' ); |
| 393 | + // A Redis socket imports whole, so there is nothing to warn about. | |
| 394 | + if ( 'redis' === $engine && '' !== Redis_Client::socket_path( $first ) ) { | |
| 395 | + continue; | |
| 396 | + } | |
| 393 | 397 | if ( ! preg_match( '#^([a-z][a-z0-9+.-]*)://#i', $first, $m ) ) { |
| 394 | 398 | continue; |
| 395 | 399 | } |
| 396 | 400 | $notes[] = sprintf( |
| @@ -744,10 +748,14 @@ | ||
| 744 | 748 | if ( ! class_exists( __NAMESPACE__ . '\\Object_Cache' ) ) { |
| 745 | 749 | return $result; |
| 746 | 750 | } |
| 747 | 751 | |
| 748 | - $opts = (array) Settings_Manager::get( 'object-cache' ); | |
| 749 | - $state = Object_Cache::enable( $opts ); | |
| 752 | + $opts = (array) Settings_Manager::get( 'object-cache' ); | |
| 753 | + // An import IS the user switching away from the source plugin, so it | |
| 754 | + // takes the same switch path: the source's own object cache is turned | |
| 755 | + // off through its settings (or the plugin deactivated) before ours goes | |
| 756 | + // in, instead of being overwritten while it stays on. (#686) | |
| 757 | + $state = Object_Cache::enable( $opts, array( 'takeover' => true ) ); | |
| 750 | 758 | |
| 751 | 759 | $result['ok'] = ! empty( $state['ok'] ); |
| 752 | 760 | $result['object_cache_ready'] = ! empty( $state['ok'] ); |
| 753 | 761 | if ( empty( $state['ok'] ) ) { |
| @@ -815,8 +823,11 @@ | ||
| 815 | 823 | 'lazy_images' => ! empty( $r['lazyload'] ), |
| 816 | 824 | 'lazy_iframes' => ! empty( $r['lazyload_iframes'] ), |
| 817 | 825 | 'lazy_videos' => ! empty( $r['lazyload_youtube'] ), |
| 818 | 826 | ); |
| 827 | + if ( ! empty( $r['lazyload_css_bg_img'] ) ) { | |
| 828 | + $patch['lazy']['lazy_background_images'] = true; | |
| 829 | + } | |
| 819 | 830 | |
| 820 | 831 | // Separate Mobile Cache — do NOT import this as ON. WP Rocket's |
| 821 | 832 | // "separate cache files for mobile" is frequently left on by habit even |
| 822 | 833 | // when the site serves identical HTML to every device, and xSpeed's |
| @@ -837,8 +848,19 @@ | ||
| 837 | 848 | $patch['preloader']['sitemap_urls'] = array_values( array_filter( array_map( 'strval', $r['sitemap_preload_url'] ) ) ); |
| 838 | 849 | } |
| 839 | 850 | } |
| 840 | 851 | |
| 852 | + // Bloat — WP Rocket's "Disable Emoji" and "Disable WordPress embeds". | |
| 853 | + $bloat = array_filter( | |
| 854 | + array( | |
| 855 | + 'disable_emojis' => ! empty( $r['emoji'] ), | |
| 856 | + 'disable_oembed' => ! empty( $r['embeds'] ), | |
| 857 | + ) | |
| 858 | + ); | |
| 859 | + if ( $bloat ) { | |
| 860 | + $patch['bloat'] = $bloat; | |
| 861 | + } | |
| 862 | + | |
| 841 | 863 | // CDN — WP Rocket stores CDN hosts in cdn_cnames (array). |
| 842 | 864 | if ( ! empty( $r['cdn'] ) && ! empty( $r['cdn_cnames'] ) && is_array( $r['cdn_cnames'] ) ) { |
| 843 | 865 | $first = (string) ( $r['cdn_cnames'][0] ?? '' ); |
| 844 | 866 | if ( '' !== $first ) { |
| @@ -1051,8 +1073,16 @@ | ||
| 1051 | 1073 | // drop-in's WP_REDIS_HOST, so the imported object cache could |
| 1052 | 1074 | // never connect. A managed Redis on TLS is the common case. |
| 1053 | 1075 | // Bracketed IPv6 is left alone — stream_socket_client() wants |
| 1054 | 1076 | // the brackets. (#224) |
| 1077 | + // W3TC writes a unix socket as `unix:/path`. Split on the | |
| 1078 | + // colon like a host:port, it imported host "unix" and port 0. | |
| 1079 | + // A socket carries no port, so only the host is set. (#566) | |
| 1080 | + $socket = 'redis' === $engine ? Redis_Client::socket_path( $first ) : ''; | |
| 1081 | + if ( '' !== $socket ) { | |
| 1082 | + $patch['object-cache']['redis_host'] = $socket; | |
| 1083 | + $first = ''; | |
| 1084 | + } | |
| 1055 | 1085 | $first = (string) preg_replace( '#^[a-z][a-z0-9+.-]*://#i', '', $first ); |
| 1056 | 1086 | $separator = strrpos( $first, ':' ); |
| 1057 | 1087 | if ( false !== $separator ) { |
| 1058 | 1088 | $host = substr( $first, 0, $separator ); |
| @@ -1472,15 +1502,14 @@ | ||
| 1472 | 1502 | $patch['fonts'] = array( 'font_display_swap' => true ); |
| 1473 | 1503 | } |
| 1474 | 1504 | |
| 1475 | 1505 | // ── Disable bloat ───────────────────────────────────────────── |
| 1476 | - // Only map the one LiteSpeed "remove" toggle with a clean xSpeed | |
| 1477 | - // equivalent: removing the emoji + oEmbed scripts ≈ disable_oembed. | |
| 1478 | - // (LiteSpeed's optm-emoji_rm strips the wp-emoji + wp-embed pair.) | |
| 1479 | - // jQuery-migrate / dashicons / XML-RPC / RSS / REST aren't | |
| 1480 | - // LiteSpeed-managed, so we don't guess at them. | |
| 1506 | + // optm-emoji_rm is LiteSpeed's only bloat toggle. It used to map to | |
| 1507 | + // disable_oembed, which turned oEmbed off unasked and left emojis on | |
| 1508 | + // (#217, #532). jQuery-migrate / dashicons / XML-RPC / RSS / REST | |
| 1509 | + // aren't LiteSpeed-managed, so we don't guess at them. | |
| 1481 | 1510 | if ( $on( 'optm-emoji_rm' ) ) { |
| 1482 | - $patch['bloat'] = array( 'disable_oembed' => true ); | |
| 1511 | + $patch['bloat'] = array( 'disable_emojis' => true ); | |
| 1483 | 1512 | } |
| 1484 | 1513 | |
| 1485 | 1514 | // ── Browser cache (LiteSpeed: cache-browser) ────────────────── |
| 1486 | 1515 | if ( $on( 'cache-browser' ) ) { |