Beispiel #1
0
 public function setSchedule($args = "")
 {
     if ($args) {
         $rule = json_decode($args);
         if ($rule->prefix == "all") {
             $this->deleteCache();
         } else {
             if ($rule->prefix == "homepage") {
                 @unlink($this->getWpContentDir() . "/cache/all/index.html");
                 @unlink($this->getWpContentDir() . "/cache/wpfc-mobile-cache/index.html");
                 if (isset($this->options->wpFastestCachePreload_homepage) && $this->options->wpFastestCachePreload_homepage) {
                     $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload Bot - After Cache Timeout");
                     $this->wpfc_remote_get(get_option("home"), "WP Fastest Cache Preload iPhone Mobile Bot - After Cache Timeout");
                 }
             } else {
                 if ($rule->prefix == "startwith") {
                 } else {
                     if ($rule->prefix == "exact") {
                         if (!is_dir($this->getWpContentDir() . "/cache/tmpWpfc")) {
                             if (@mkdir($this->getWpContentDir() . "/cache/tmpWpfc", 0755, true)) {
                             }
                         }
                         @rename($this->getWpContentDir() . "/cache/all/" . $rule->content, $this->getWpContentDir() . "/cache/tmpWpfc/" . time());
                         @rename($this->getWpContentDir() . "/cache/wpfc-mobile-cache/" . $rule->content, $this->getWpContentDir() . "/cache/tmpWpfc/mobile_" . time());
                         wp_schedule_single_event(time() + 60, $this->slug() . "_TmpDelete_" . time());
                     }
                 }
             }
         }
         if ($rule->prefix != "all") {
             if ($this->isPluginActive("wp-fastest-cache-premium/wpFastestCachePremium.php")) {
                 include_once $this->get_premium_path("logs.php");
                 $log = new WpFastestCacheLogs("delete");
                 $log->action($rule);
             }
         }
     } else {
         //for old cron job
         $this->deleteCache();
     }
 }
 public function deleteCache($minified = false)
 {
     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/" . 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");
     }
 }