Cache bust for home page when updating conditions develop
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 21 Sep 2018 18:19:39 +0000 (14:19 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 21 Sep 2018 18:19:39 +0000 (14:19 -0400)
remove cache files for the home page.

models/admin/conditions/index.php

index 05872a8..c40f000 100644 (file)
@@ -218,6 +218,18 @@ class GlmMembersAdmin_conditions_index extends GlmDataConditions
 
     public function writeHighLoadPage()
     {
+        $site_path = get_home_path();
+        // Need to look for and remove the home page cache from WPSuper cache
+        $host_name = $_SERVER['HTTP_HOST'];
+
+        $search = glob( $site_path . "/wp-content/cache/supercache/$host_name/*.php" );
+
+        if ( $search ) {
+            foreach ( $search as $cache_file ) {
+                unlink( $cache_file );
+            }
+        }
+
         // Setup the Smarty Engine
         $smarty   = new smartyTemplateSupport();
         $viewPath = GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/views';
@@ -248,7 +260,6 @@ class GlmMembersAdmin_conditions_index extends GlmDataConditions
         $htmlOutput = $smarty->template->fetch( $viewFile );
 
         // Write the file out
-        $site_path = get_home_path();
         file_put_contents( $site_path . 'HLP.html', $htmlOutput );
     }