Get the most out of your Centmin Mod LEMP stack
Become a Member

Beta Branch add Cache Enabler 1.4.9 legacy cache mode option in 123.09beta01

Discussion in 'Centmin Mod Github Commits' started by eva2000, Oct 14, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    49,039
    11,235
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,488
    Local Time:
    2:28 AM
    Nginx 1.21.x
    MariaDB 10.x
    add Cache Enabler 1.4.9 legacy cache mode option in 123.09beta01

    - Add a new centmin.sh variable which defaults to CACHE_ENABLER_LEGACY_CACHE='y' which will install Cache Enabler 1.4.9 and lock to that version via block-specific-plugin-updates wordpress plugin to prevent update to Cache Enabler 1.5.1 which changes query string specifying from cache inclusion to cache exclusion method. 1.4.9 excluded all query strings unless you specified query strings to include in cache. 1.5.1 include all query strings in cache by default breaking some Wordpress plugins and requires users to specify query strings to exclude from cache. This updated option is for fresh new Cache Enabler installs via centmin.sh menu option 22 when CACHE_ENABLER_LEGACY_CACHE='y' is set (by default), or you can set CACHE_ENABLER_LEGACY_CACHE='n' in persistent config file /etc/centminmod/custom_config.inc to override this so centmin.sh menu option 22 installs Cache Enabler 1.5.1+ by default.
    - This is a temp measure until 1.5.1+ issues are sorted. You can read the discussion on 1.5.1 caches at Query string cache policy · Issue #148 · keycdn/cache-enabler
    - And existing Cache Enabler 1.5.1 users who want to downgrade to 1.4.9 can follow instructions at Cache-Enabler Plugin - Cache is not created or served or below

    replace yourdomain.com in domain variable with your Wordpress domain and run the commands in SSH until the last nprestart (nginx + PHP-FPM restarts)
    Code (Text):
    domain=yourdomain.com
    wp plugin deactivate cache-enabler --allow-root --path=/home/nginx/domains/$domain/public
    wp plugin uninstall cache-enabler --allow-root --path=/home/nginx/domains/$domain/public
    wp plugin install cache-enabler --version=1.4.9 --force --activate --allow-root --path=/home/nginx/domains/$domain/public
    nprestart
    
    wp option update cache-enabler '{"expires":6,"clear_on_upgrade":1,"new_post":1,"new_comment":1,"update_product_stock":0,"webp":0,"compress":1,"excl_ids":"","excl_paths":"","excl_cookies":"","incl_parameters":"","minify_html":0}' --format=json --allow-root --path=/home/nginx/domains/$domain/public
    
    wp option patch update cache-enabler incl_parameters '/^fbclid|ref|mc_(cid|eid)|utm_(source|medium|campaign|term|content|expid)|gclid|fb_(action_ids|action_types|source)|age-verified|ao_noptimize|usqp|cn-reloaded|_ga|_ke$/' --allow-root --path=/home/nginx/domains/$domain/public
    
    wp option pluck cache-enabler incl_parameters --format=json --allow-root --path=/home/nginx/domains/$domain/public
    
    wp option get cache-enabler --format=json --path=/home/nginx/domains/$domain/public/ | jq
    
    wp plugin install block-specific-plugin-updates --activate --allow-root --path=/home/nginx/domains/$domain/public
    
    if [ "$(\wp option get bpu_update_blocked_plugins --allow-root --path=/home/nginx/domains/$domain/public >/dev/null 2>&1; echo $?)" -ne '0' ]; then wp option update bpu_update_blocked_plugins cache-enabler/cache-enabler.php --allow-root --path=/home/nginx/domains/$domain/public; else wp option add bpu_update_blocked_plugins cache-enabler/cache-enabler.php --allow-root --path=/home/nginx/domains/$domain/public; fi
    
    nprestart

    And
    Code (Text):
    domain=yourdomain.com
    chown -R nginx:nginx /home/nginx/domains/$domain/public

    - To remove the version lock on Cache Enabler so you can update from 1.4.9 to 1.5.1 you can run
    Code (Text):
    domain=yourdomain.com
    wp option delete bpu_update_blocked_plugins --allow-root --path=/home/nginx/domains/$domain/public


    Continue reading...

    123.09beta01 branch


     
    Last edited: Oct 15, 2020
  2. eva2000

    eva2000 Administrator Staff Member

    49,039
    11,235
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,488
    Local Time:
    2:28 AM
    Nginx 1.21.x
    MariaDB 10.x
    Last edited: Oct 14, 2020
  3. David Schargel

    David Schargel New Member

    26
    8
    3
    Feb 2, 2020
    Ratings:
    +18
    Local Time:
    9:28 AM
  4. eva2000

    eva2000 Administrator Staff Member

    49,039
    11,235
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,488
    Local Time:
    2:28 AM
    Nginx 1.21.x
    MariaDB 10.x
    AFAIK those changes would be for cache enabler 1.5+ so wouldn't apply to cache enabler 1.4.9 used by Centmin Mod. Will have to look at what nginx code changes have been made for when/if Centmin Mod supports 1.5+ again.

    Problem with 1.5+ cache enabler is all query strings are cached by default unless you exclude them yourself and that would be left to end users to determine.
     
    Last edited: Mar 28, 2021
  5. David Schargel

    David Schargel New Member

    26
    8
    3
    Feb 2, 2020
    Ratings:
    +18
    Local Time:
    9:28 AM
    Ahhhh...now I understand the lock at 1.4.9!
     
  6. ct_roy

    ct_roy Premium Member Premium Member

    39
    6
    8
    Jun 21, 2020
    Ratings:
    +11
    Local Time:
    5:28 PM
    1.17.10
    10.3.22
    @eva2000
    Just dusting this one down as it's been a while since I took a look at it.
    Creating a fresh install via Menu option 22, and selecting Cache Enabler still gives me v1.4.9 on the new WP site.
    Looking at Query string cache policy · Issue #148 · keycdn/cache-enabler would suggest the battle has been lost to get the plugin to switch back to not caching query strings by default.

    Do you think you'll keep recommending using 1.4.9 for the foreseeable future (conscious there could be some vulnerabilities in there with the passage of time and issues with new versions of WP/WooCommerce etc.) or is it time to either consider updating the cmm cache enabler nginx config or consider an alternative cache plugin?

    (Sidenote: it's a real shame they went the way they did as Cache Enabler 1.4.9 has been rock solid and I infinitely prefer query strings bypassing the cache by default)
     
  7. David Schargel

    David Schargel New Member

    26
    8
    3
    Feb 2, 2020
    Ratings:
    +18
    Local Time:
    9:28 AM
    Just last week, I was pondering this myself. Is the gameplan for sticking to v1.4.9?
     
  8. eva2000

    eva2000 Administrator Staff Member

    49,039
    11,235
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,488
    Local Time:
    2:28 AM
    Nginx 1.21.x
    MariaDB 10.x
    My feelings exactly too! I prefer the old Cache Enabler <=1.4.9 method too.

    It is probably time to look at alternatives to Cache Enabler that do the same way of caching and are available for free:

    Criteria:
    1. is free
    2. is suited to command line/WP CLI command line install and configuration
    3. saves Wordpress full HTML page caching to disk so the caching can be served via Nginx without PHP-FPM involvement
    4. works well with Autoptimize Wordpress plugin
    5. allows precompressing of full HTML pages via gzip or brotli compression *.gz or &.br ending cache files, so they can be served faster via Nginx gzip_static or brotli_static directives (where a lot of Cache Enabler's speed came from). I guess if anyone here's handy with PHP coding for Wordpress too, then we could also take an existing Wordpress full HTML page caching plugin that does criteria #3 and just add a feature to the plugin to also gzip and/or brotli precompress the resulting full HTML page file too and manage deletions/purges for the precompressed versions.
    Probably something I will look at next after I iron out the new Nginx PCRE2 beta testing and changes outlined at https://community.centminmod.com/threads/centmin-mod-nginx-1-21-5-pcre2-support.22332/ and Centmin Mod user's Nginx PCRE2 beta testing contribution https://community.centminmod.com/threads/centmin-mod-nginx-1-21-5-pcre2-beta-testing.22326/ ;) The Nginx PCRE2 test patches also add Dropbox support for auto sending your Nginx upgrade logs to Dropbox via Rclone too https://community.centminmod.com/th...x-1-21-5-pcre2-beta-testing.22326/#post-91386 :)