WPIntell

Source evidence

Feature – SpinupWP

The Cache Purger · support · 2024-08-30T10:10:00+00:00

mixedsentiment
highseverity
0.94relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

6 / 35 rows with source links

17.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
jordantrizz resolved
Are you able to add SpinupWP to the list of providers. <?php /* * Add this to your theme functions.php, or add to a plugin. * */ /** * Clear the SpinupWP Cache for the entire website. */ function clear_spinup_cache(): bool { if (! class_exists('SpinupWp\Cache')) { return false; } $class_spinup_admin = new SpinupWp\AdminBar('/wp-content/plugins/spinupwp/'); $class_spinup_cli = new SpinupWp\Cli; $class_spinup_cache = new SpinupWp\Cache($class_spinup_admin, $class_spinup_cli); if ($class_spinup_cache->is_page_cache_enabled()) { $purge = $GLOBALS['spinupwp']->cache->purge_page_cache(); $type = 'Page cache'; $res = $purge ? 'Cleared' : 'Not Cleared'; helpers\log("Purging {$type} result: {$res}"); } if ($class_spinup_cache->is_object_cache_enabled()) { $purge = $GLOBALS['spinupwp']->cache->purge_object_cache(); $type = 'Object cache'; $res = $purge ? 'Cleared' : 'Not Cleared'; // Commenting out because this helper class is unique to stafflink. //helpers\log("Purging {$type} result: {$res}"); } return true; } /** * Clear the cache for the specific URL only. */ function clear_spinup_cache_for_this_url(): bool { // exit quickly if spinup plugin does not exist if (! class_exists('SpinupWp\Cache')) { return false; } $url = home_url().'/wp-content/plugins/spinupwp/'; $class_spinup_admin = new SpinupWp\AdminBar($url); $class_spinup_cli = new SpinupWp\Cli; $class_spinup_cache = new SpinupWp\Cache($class_spinup_admin, $class_spinup_cli); if ($class_spinup_cache->is_page_cache_enabled()) { $url = $_SERVER['HTTP_REFERER']; $purge = $GLOBALS['spinupwp']->cache->purge_url($url); $type = 'URL page cache'; $res = $purge ? 'Cleared' : 'Not Cleared'; // Log page cache if success // Commented out because this helper class is unique to STAFFLINK. //helpers\log("Purging {$type} result: {$res}"); } } I will take a look Thanks This will be in the next version… will be out soon @kevp75 Thanks for adding this! Just a heads up that SpinupWP does disable opcache_get_status() by default , so this will throw a fatal php error (specifically it happened for me when trying to save a menu): Error Details ============= An error of type E_ERROR was caused in line 126 of the file /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php. Error message: Uncaught Error: Call to undefined function opcache_get_status() in /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php:126 Stack trace: #0 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php(65): KP_Cache_Purge->purge_php_opcache() #1 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/kp-cache-purge.php(123): KP_Cache_Purge->purge_php_caches() #2 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/kp-cache-purge-processor.php(606): KP_Cache_Purge->kp_do_purge() #3 /sites/nda-mn.org/files/wp-includes/class-wp-hook.php(326): KP_Cache_Purge_Processor->{closure}() #4 /sites/nda-mn.org/files/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #5 /sites/nda-mn.org/files/wp-includes/plugin.php(517): WP_Hook->do_action() #6 /sites/nda-mn.org/files/wp-includes/taxonomy.php(3474): do_action() #7 /sites/nda-mn.org/files/wp-includes/nav-menu.php(386): wp_update_term() #8 /sites/nda-mn.org/files/wp-admin/nav-menus.php(486): wp_update_nav_menu_object() #9 {main} thrown The server admin can remove this in the php.ini to fix the fatal error which is what I ended up doing. I’m not sure if this function is crucial for your plugin to work but maybe it would be worth doing a function_exists('opcache_get_status') on it first to avoid the fatal error? Thanks again! Interesting… It shouldn’t have been erroring at all, I tossed an @ before it which should have been silencing any error output. However, even doing as you suggested will not correct the underlying issue. We need that method to ensure opcache is actually being utilized in order to clear it. It has a flag: opcache_enabled I’m not sure that I will correct this… maybe the error from popping, but I can’t correct anything beyond that… but even correcting that will not fulfill the purpose of the plugin, in that… opcache needs to be cleared… I’ll think on this and see if I can come up with some other way…

Comments

4 shown
Kevin Pirnie 2024-08-30T10:28:00+00:00

I will take a look Thanks

Kevin Pirnie 2024-09-19T11:03:00+00:00

This will be in the next version… will be out soon

Ryan Tvenge 2024-10-02T15:16:00+00:00

@kevp75 Thanks for adding this! Just a heads up that SpinupWP does disable opcache_get_status() by default , so this will throw a fatal php error (specifically it happened for me when trying to save a menu): Error Details ============= An error of type E_ERROR was caused in line 126 of the file /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php. Error message: Uncaught Error: Call to undefined function opcache_get_status() in /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php:126 Stack trace: #0 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/modules/php.php(65): KP_Cache_Purge->purge_php_opcache() #1 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/kp-cache-purge.php(123): KP_Cache_Purge->purge_php_caches() #2 /sites/nda-mn.org/files/wp-content/plugins/the-cache-purger/work/inc/kp-cache-purge-processor.php(606): KP_Cache_Purge->kp_do_purge() #3 /sites/nda-mn.org/files/wp-includes/class-wp-hook.php(326): KP_Cache_Purge_Processor->{closure}() #4 /sites/nda-mn.org/files/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #5 /sites/nda-mn.org/files/wp-includes/plugin.php(517): WP_Hook->do_action() #6 /sites/nda-mn.org/files/wp-includes/taxonomy.php(3474): do_action() #7 /sites/nda-mn.org/files/wp-includes/nav-menu.php(386): wp_update_term() #8 /sites/nda-mn.org/files/wp-admin/nav-menus.php(486): wp_update_nav_menu_object() #9 {main} thrown The server admin can remove this in the php.ini to fix the fatal error which is what I ended up doing. I’m not sure if this function is crucial for your plugin to work but maybe it would be worth doing a function_exists('opcache_get_status') on it first to avoid the fatal error? Thanks again!

Kevin Pirnie 2024-10-02T15:56:00+00:00

Interesting… It shouldn’t have been erroring at all, I tossed an @ before it which should have been silencing any error output. However, even doing as you suggested will not correct the underlying issue. We need that method to ensure opcache is actually being utilized in order to clear it. It has a flag: opcache_enabled I’m not sure that I will correct this… maybe the error from popping, but I can’t correct anything beyond that… but even correcting that will not fulfill the purpose of the plugin, in that… opcache needs to be cleared… I’ll think on this and see if I can come up with some other way…