Ejemplo n.º 1
0
 public function deleteCache($minified = false)
 {
     $this->set_preload();
     delete_option("WpFastestCacheHTML");
     delete_option("WpFastestCacheHTMLSIZE");
     delete_option("WpFastestCacheMOBILE");
     delete_option("WpFastestCacheMOBILESIZE");
     if (class_exists("WpFcMobileCache")) {
         $wpfc_mobile = new WpFcMobileCache();
         $wpfc_mobile->delete_cache($this->getWpContentDir());
         wp_schedule_single_event(time() + 60, $this->slug() . "_TmpDelete_" . time());
     }
     $deleted = false;
     $cache_path = $this->getWpContentDir() . "/cache/all";
     $minified_cache_path = $this->getWpContentDir() . "/cache/wpfc-minified";
     if (!is_dir($this->getWpContentDir() . "/cache/tmpWpfc")) {
         if (@mkdir($this->getWpContentDir() . "/cache/tmpWpfc", 0755, true)) {
             //
         } else {
             $this->systemMessage = array("Permission of <strong>/wp-content/cache</strong> must be <strong>755</strong>", "error");
         }
     }
     if (is_dir($cache_path)) {
         rename($cache_path, $this->getWpContentDir() . "/cache/tmpWpfc/" . time());
         $deleted = true;
     }
     if (is_dir($minified_cache_path)) {
         if ($minified) {
             rename($minified_cache_path, $this->getWpContentDir() . "/cache/tmpWpfc/m" . time());
             $deleted = true;
         }
     }
     if ($deleted) {
         wp_schedule_single_event(time() + 60, $this->slug() . "_TmpDelete_" . time());
         $this->systemMessage = array("All cache files have been deleted", "success");
         if ($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")) {
             include_once $this->get_premium_path("logs.php");
             $log = new WpFastestCacheLogs("delete");
             $log->action();
         }
     } else {
         $this->systemMessage = array("Already deleted", "success");
     }
 }
Ejemplo n.º 2
0
 public function deleteCache($minified = false)
 {
     $this->set_preload();
     $created_tmpWpfc = false;
     $cache_deleted = false;
     $minifed_deleted = false;
     $cache_path = $this->getWpContentDir() . "/cache/all";
     $minified_cache_path = $this->getWpContentDir() . "/cache/wpfc-minified";
     if (class_exists("WpFcMobileCache")) {
         $wpfc_mobile = new WpFcMobileCache();
         $wpfc_mobile->delete_cache($this->getWpContentDir());
     }
     if (!is_dir($this->getWpContentDir() . "/cache/tmpWpfc")) {
         if (@mkdir($this->getWpContentDir() . "/cache/tmpWpfc", 0755, true)) {
             $created_tmpWpfc = true;
         } else {
             $created_tmpWpfc = false;
             //$this->systemMessage = array("Permission of <strong>/wp-content/cache</strong> must be <strong>755</strong>", "error");
         }
     } else {
         $created_tmpWpfc = true;
     }
     if (is_dir($cache_path)) {
         if (@rename($cache_path, $this->getWpContentDir() . "/cache/tmpWpfc/" . time())) {
             delete_option("WpFastestCacheHTML");
             delete_option("WpFastestCacheHTMLSIZE");
             delete_option("WpFastestCacheMOBILE");
             delete_option("WpFastestCacheMOBILESIZE");
             $cache_deleted = true;
         }
     } else {
         $cache_deleted = true;
     }
     if ($minified) {
         if (is_dir($minified_cache_path)) {
             if (@rename($minified_cache_path, $this->getWpContentDir() . "/cache/tmpWpfc/m" . time())) {
                 delete_option("WpFastestCacheCSS");
                 delete_option("WpFastestCacheCSSSIZE");
                 delete_option("WpFastestCacheJS");
                 delete_option("WpFastestCacheJSSIZE");
                 $minifed_deleted = true;
             }
         } else {
             $minifed_deleted = true;
         }
     } else {
         $minifed_deleted = true;
     }
     if ($created_tmpWpfc && $cache_deleted && $minifed_deleted) {
         $this->systemMessage = array("All cache files have been deleted", "success");
         if ($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")) {
             include_once $this->get_premium_path("logs.php");
             $log = new WpFastestCacheLogs("delete");
             $log->action();
         }
     } else {
         $this->systemMessage = array("Permissions Problem: <a href='http://www.wpfastestcache.com/warnings/delete-cache-problem-related-to-permission/' target='_blank'>Read More</a>", "error", array("light_box" => "delete_cache_permission_error"));
     }
     // for ajax request
     if (isset($_GET["action"]) && in_array($_GET["action"], array("wpfc_delete_cache", "wpfc_delete_cache_and_minified"))) {
         die(json_encode($this->systemMessage));
     }
 }