WP Fastest Cache - Version 1.0.2

Version Description

  • to add WP-CLI command for clearing cache of a post [Details]
  • to fix Warning scandir() at wpFastestCache.php:302
  • to fix Warning file_put_contents(/cache/wpfc-minified/index.html) at cache.php:1090
  • to fix Warning unlink(wp-cache-config.php) admin.php:885
Download this release

Release Info

Developer emrevona
Plugin Icon 128x128 WP Fastest Cache
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (5) hide show
  1. inc/admin.php +3 -1
  2. inc/cache.php +9 -1
  3. inc/cli.php +11 -1
  4. readme.txt +7 -1
  5. wpFastestCache.php +23 -16
inc/admin.php CHANGED
@@ -882,7 +882,9 @@
882
  if($this->isPluginActive('wp-super-cache/wp-cache.php')){
883
  return array("WP Super Cache needs to be deactive", "error");
884
  }else{
885
- @unlink($path."wp-content/wp-cache-config.php");
 
 
886
 
887
  $message = "";
888
 
882
  if($this->isPluginActive('wp-super-cache/wp-cache.php')){
883
  return array("WP Super Cache needs to be deactive", "error");
884
  }else{
885
+ if(file_exists($path."wp-content/wp-cache-config.php")){
886
+ @unlink($path."wp-content/wp-cache-config.php");
887
+ }
888
 
889
  $message = "";
890
 
inc/cache.php CHANGED
@@ -1086,9 +1086,17 @@
1086
  @file_put_contents($this->getWpContentDir("/cache/index.html"), "");
1087
  }
1088
  }else{
 
1089
  if(!file_exists($this->getWpContentDir("/cache/wpfc-minified/index.html"))){
1090
- @file_put_contents($this->getWpContentDir("/cache/wpfc-minified/index.html"), "");
 
 
 
 
 
 
1091
  }
 
1092
  }
1093
 
1094
  }else{
1086
  @file_put_contents($this->getWpContentDir("/cache/index.html"), "");
1087
  }
1088
  }else{
1089
+
1090
  if(!file_exists($this->getWpContentDir("/cache/wpfc-minified/index.html"))){
1091
+ if(!is_dir($this->getWpContentDir("/cache/wpfc-minified/"))){
1092
+ @mkdir($this->getWpContentDir("/cache/wpfc-minified/"), 0755, true);
1093
+ }
1094
+
1095
+ if(is_dir($this->getWpContentDir("/cache/wpfc-minified/"))){
1096
+ @file_put_contents($this->getWpContentDir("/cache/wpfc-minified/index.html"), "");
1097
+ }
1098
  }
1099
+
1100
  }
1101
 
1102
  }else{
inc/cli.php CHANGED
@@ -41,7 +41,17 @@ class wpfcCLI extends \WP_CLI_Command
41
  public function clear($args, $args_assoc){
42
  if(isset($GLOBALS['wp_fastest_cache'])){
43
  if(method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')){
44
- if(isset($args[0])){
 
 
 
 
 
 
 
 
 
 
45
  if($args[0] == "all"){
46
  if(isset($args[1]) && isset($args[2])){
47
  if($args[1] == "and" && $args[2] == "minified"){
41
  public function clear($args, $args_assoc){
42
  if(isset($GLOBALS['wp_fastest_cache'])){
43
  if(method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')){
44
+ if(isset($args_assoc["post_id"])){
45
+ $post_ids = explode(',' , $args_assoc['post_id'] );
46
+
47
+ foreach($post_ids as $post_id){
48
+
49
+ WP_CLI::line("Clearing the cache of the post with ID number ".$post_id);
50
+ $GLOBALS['wp_fastest_cache']->singleDeleteCache(false, $post_id);
51
+ WP_CLI::success("The cache has been cleared!");
52
+ }
53
+
54
+ }else if(isset($args[0])){
55
  if($args[0] == "all"){
56
  if(isset($args[1]) && isset($args[2])){
57
  if($args[1] == "and" && $args[2] == "minified"){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://profiles.wordpress.org/emrevona/
4
  Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,6 +125,12 @@ The free version is enough to speed up your site but in the premium version ther
125
 
126
  == Changelog ==
127
 
 
 
 
 
 
 
128
  = 1.0.1 =
129
  * to clear only cache of post/page even if the "update post" option is disabled
130
 
4
  Tags: cache, caching, performance, wp-cache, total cache, super cache, cdn
5
  Requires at least: 3.3
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
125
 
126
  == Changelog ==
127
 
128
+ = 1.0.2 =
129
+ * to add WP-CLI command for clearing cache of a post [<a target="_blank" href="https://www.wpfastestcache.com/features/wp-cli-commands/">Details</a>]
130
+ * to fix Warning scandir() at wpFastestCache.php:302
131
+ * to fix Warning file_put_contents(/cache/wpfc-minified/index.html) at cache.php:1090
132
+ * to fix Warning unlink(wp-cache-config.php) admin.php:885
133
+
134
  = 1.0.1 =
135
  * to clear only cache of post/page even if the "update post" option is disabled
136
 
wpFastestCache.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Fastest Cache
4
  Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
5
  Description: The simplest and fastest WP Cache system
6
- Version: 1.0.1
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
@@ -299,20 +299,22 @@ GNU General Public License for more details.
299
  die("May be Directory Traversal Attack");
300
  }
301
 
302
- if($sources = @scandir($this->getWpContentDir("/cache/wpfc-minified/").$path[1], 1)){
303
- if(isset($sources[0])){
304
- // $exist_url = str_replace($path[2], $sources[0], $this->current_url());
305
- // header('Location: ' . $exist_url, true, 301);
306
- // exit;
307
-
308
- if(preg_match("/\.css/", $this->current_url())){
309
- header('Content-type: text/css');
310
- }else if(preg_match("/\.js/", $this->current_url())){
311
- header('Content-type: text/js');
 
 
 
 
 
312
  }
313
-
314
- echo file_get_contents($this->getWpContentDir("/cache/wpfc-minified/").$path[1]."/".$sources[0]);
315
- exit;
316
  }
317
  }
318
 
@@ -1435,8 +1437,13 @@ GNU General Public License for more details.
1435
  $store_url_path = trim($store_url_path, "/");
1436
 
1437
  if($store_url_path){
1438
- @unlink($this->getWpContentDir("/cache/all/").$store_url_path."/index.html");
1439
- @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html");
 
 
 
 
 
1440
 
1441
  //to clear pagination of store homepage cache
1442
  $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$store_url_path."/page");
3
  Plugin Name: WP Fastest Cache
4
  Plugin URI: http://wordpress.org/plugins/wp-fastest-cache/
5
  Description: The simplest and fastest WP Cache system
6
+ Version: 1.0.2
7
  Author: Emre Vona
8
  Author URI: http://tr.linkedin.com/in/emrevona
9
  Text Domain: wp-fastest-cache
299
  die("May be Directory Traversal Attack");
300
  }
301
 
302
+ if(is_dir($this->getWpContentDir("/cache/wpfc-minified/").$path[1])){
303
+ if($sources = @scandir($this->getWpContentDir("/cache/wpfc-minified/").$path[1], 1)){
304
+ if(isset($sources[0])){
305
+ // $exist_url = str_replace($path[2], $sources[0], $this->current_url());
306
+ // header('Location: ' . $exist_url, true, 301);
307
+ // exit;
308
+
309
+ if(preg_match("/\.css/", $this->current_url())){
310
+ header('Content-type: text/css');
311
+ }else if(preg_match("/\.js/", $this->current_url())){
312
+ header('Content-type: text/js');
313
+ }
314
+
315
+ echo file_get_contents($this->getWpContentDir("/cache/wpfc-minified/").$path[1]."/".$sources[0]);
316
+ exit;
317
  }
 
 
 
318
  }
319
  }
320
 
1437
  $store_url_path = trim($store_url_path, "/");
1438
 
1439
  if($store_url_path){
1440
+ if(file_exists($this->getWpContentDir("/cache/all/").$store_url_path."/index.html")){
1441
+ @unlink($this->getWpContentDir("/cache/all/").$store_url_path."/index.html");
1442
+ }
1443
+
1444
+ if(file_exists($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html")){
1445
+ @unlink($this->getWpContentDir("/cache/wpfc-mobile-cache/").$store_url_path."/index.html");
1446
+ }
1447
 
1448
  //to clear pagination of store homepage cache
1449
  $this->rm_folder_recursively($this->getWpContentDir("/cache/all/").$store_url_path."/page");