| @@ -678,8 +678,22 @@ | ||
| 678 | 678 | private const OPTIONAL_FOR_HANDOVER = array( |
| 679 | 679 | 'object-cache', |
| 680 | 680 | 'cdn', |
| 681 | 681 | 'preloader', |
| 682 | + /* | |
| 683 | + * `cache` is optional for the HANDOVER decision specifically, and it | |
| 684 | + * has to be, because the source itself is usually why it failed: the | |
| 685 | + * source holds advanced-cache.php, so page cache cannot apply, so we | |
| 686 | + * refuse to deactivate the source, so it keeps holding the drop-in. | |
| 687 | + * That loop is what left sites with no cache at all (#391). | |
| 688 | + * | |
| 689 | + * Deactivating first and enabling after is the resolution -- see | |
| 690 | + * MigrationModule::restore_own_environment(), which now turns caching | |
| 691 | + * on once the field is free. A cache failure is still reported to the | |
| 692 | + * user either way; it just no longer vetoes the switch-off the notice | |
| 693 | + * already promised. | |
| 694 | + */ | |
| 695 | + 'cache', | |
| 682 | 696 | ); |
| 683 | 697 | |
| 684 | 698 | /** |
| 685 | 699 | * Is it safe to switch the source plugin off? |
| @@ -801,8 +815,11 @@ | ||
| 801 | 815 | 'lazy_images' => ! empty( $r['lazyload'] ), |
| 802 | 816 | 'lazy_iframes' => ! empty( $r['lazyload_iframes'] ), |
| 803 | 817 | 'lazy_videos' => ! empty( $r['lazyload_youtube'] ), |
| 804 | 818 | ); |
| 819 | + if ( ! empty( $r['lazyload_css_bg_img'] ) ) { | |
| 820 | + $patch['lazy']['lazy_background_images'] = true; | |
| 821 | + } | |
| 805 | 822 | |
| 806 | 823 | // Separate Mobile Cache — do NOT import this as ON. WP Rocket's |
| 807 | 824 | // "separate cache files for mobile" is frequently left on by habit even |
| 808 | 825 | // when the site serves identical HTML to every device, and xSpeed's |
| @@ -823,8 +840,19 @@ | ||
| 823 | 840 | $patch['preloader']['sitemap_urls'] = array_values( array_filter( array_map( 'strval', $r['sitemap_preload_url'] ) ) ); |
| 824 | 841 | } |
| 825 | 842 | } |
| 826 | 843 | |
| 844 | + // Bloat — WP Rocket's "Disable Emoji" and "Disable WordPress embeds". | |
| 845 | + $bloat = array_filter( | |
| 846 | + array( | |
| 847 | + 'disable_emojis' => ! empty( $r['emoji'] ), | |
| 848 | + 'disable_oembed' => ! empty( $r['embeds'] ), | |
| 849 | + ) | |
| 850 | + ); | |
| 851 | + if ( $bloat ) { | |
| 852 | + $patch['bloat'] = $bloat; | |
| 853 | + } | |
| 854 | + | |
| 827 | 855 | // CDN — WP Rocket stores CDN hosts in cdn_cnames (array). |
| 828 | 856 | if ( ! empty( $r['cdn'] ) && ! empty( $r['cdn_cnames'] ) && is_array( $r['cdn_cnames'] ) ) { |
| 829 | 857 | $first = (string) ( $r['cdn_cnames'][0] ?? '' ); |
| 830 | 858 | if ( '' !== $first ) { |
| @@ -1458,15 +1486,14 @@ | ||
| 1458 | 1486 | $patch['fonts'] = array( 'font_display_swap' => true ); |
| 1459 | 1487 | } |
| 1460 | 1488 | |
| 1461 | 1489 | // ── Disable bloat ───────────────────────────────────────────── |
| 1462 | - // Only map the one LiteSpeed "remove" toggle with a clean xSpeed | |
| 1463 | - // equivalent: removing the emoji + oEmbed scripts ≈ disable_oembed. | |
| 1464 | - // (LiteSpeed's optm-emoji_rm strips the wp-emoji + wp-embed pair.) | |
| 1465 | - // jQuery-migrate / dashicons / XML-RPC / RSS / REST aren't | |
| 1466 | - // LiteSpeed-managed, so we don't guess at them. | |
| 1490 | + // optm-emoji_rm is LiteSpeed's only bloat toggle. It used to map to | |
| 1491 | + // disable_oembed, which turned oEmbed off unasked and left emojis on | |
| 1492 | + // (#217, #532). jQuery-migrate / dashicons / XML-RPC / RSS / REST | |
| 1493 | + // aren't LiteSpeed-managed, so we don't guess at them. | |
| 1467 | 1494 | if ( $on( 'optm-emoji_rm' ) ) { |
| 1468 | - $patch['bloat'] = array( 'disable_oembed' => true ); | |
| 1495 | + $patch['bloat'] = array( 'disable_emojis' => true ); | |
| 1469 | 1496 | } |
| 1470 | 1497 | |
| 1471 | 1498 | // ── Browser cache (LiteSpeed: cache-browser) ────────────────── |
| 1472 | 1499 | if ( $on( 'cache-browser' ) ) { |