This PR does a few things with the goal of eliminating a bunch of purge requests that don't need to be sent:
Switches the save_post hook to transition_post_status to allow us to only run the purge when an old or a new post status was public. If the post was not public before and isn't now, then there shouldn't be any purges sent. This eliminates the multiple purge requests that are currently sent when a new post is created, or a draft is saved.
Adds a use_file_cache() helper function to simplify the repeated uses of false === strpos( dirname( __FILE__ ), 'public_html' ) and make it clear what that means
Moves the logic from purge_all() to a new purge_dir() function to make it specifically about purging all the content of a single directory. This allows us to more accurately purge date archives in the save_post() call, rather than purging the entire site.
Makes purge_all() now make use of either the purge_dir() function on filesystem cache environments, or a call to purge_single() using a wildcard path of /* when the caching is done in NGINX.
This PR does a few things with the goal of eliminating a bunch of purge requests that don't need to be sent:
save_post
hook totransition_post_status
to allow us to only run the purge when an old or a new post status was public. If the post was not public before and isn't now, then there shouldn't be any purges sent. This eliminates the multiple purge requests that are currently sent when a new post is created, or a draft is saved.use_file_cache()
helper function to simplify the repeated uses offalse === strpos( dirname( __FILE__ ), 'public_html' )
and make it clear what that meanspurge_all()
to a newpurge_dir()
function to make it specifically about purging all the content of a single directory. This allows us to more accurately purge date archives in thesave_post()
call, rather than purging the entire site.purge_all()
now make use of either thepurge_dir()
function on filesystem cache environments, or a call topurge_single()
using a wildcard path of/*
when the caching is done in NGINX.