@filemtime(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-flush.txt')) { @unlink(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-flush.txt'); } return; } /* * Determine if we're on multinetwork and has object cache locking. */ if (\function_exists('nwdcx_network_ignore') && nwdcx_network_ignore()) { return; } /* * Check for object-cache-delay.txt file. */ if (@is_file(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-delay.txt')) { if (!\function_exists('add_action')) { return; } if (time() > @filemtime(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-delay.txt')) { if (!\function_exists('nwdcx_halttransient')) { // prevent from transient save to db before replace with our dropin function nwdcx_halttransient($value, $option, $old_value = '') { if (false !== strpos($option, '_transient_')) { return false; } return $value; } add_filter('pre_update_option', 'nwdcx_halttransient', \PHP_INT_MIN, 3); add_filter('pre_get_option', 'nwdcx_halttransient', \PHP_INT_MIN, 3); add_filter( 'added_option', function ($option, $value) { return nwdcx_halttransient($value, $option); }, \PHP_INT_MIN, 2 ); } if (class_exists('Nawawi\\DocketCache\\Becache')) { // early cache transient/alloptions add_action( 'shutdown', function () { try { Nawawi\DocketCache\Becache::export(); } catch (\Throwable $e) { } }, \PHP_INT_MIN ); // early cleanup transient add_action( 'shutdown', function () { try { Nawawi\DocketCache\Becache::cleanup_transient(); } catch (\Throwable $e) { } }, \PHP_INT_MAX - 1 ); } add_action( 'shutdown', function () { clearstatcache(); if (@is_file(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-delay.txt')) { @rename(DOCKET_CACHE_CONTENT_PATH.'/.object-cache-delay.txt', DOCKET_CACHE_CONTENT_PATH.'/.object-cache-after-delay.txt'); } }, \PHP_INT_MAX ); } return; } /* * Define WP Object Cache functions and classes. */ @include_once WP_PLUGIN_DIR.'/docket-cache/includes/cache.php';