Fast Velocity Minify - Version 3.2.6

Version Description

[2022.02.06] = * cache purging fixes

Download this release

Release Info

Developer Alignak
Plugin Icon 128x128 Fast Velocity Minify
Version 3.2.6
Comparing to
See all releases

Code changes from version 3.2.5 to 3.2.6

Files changed (3) hide show
  1. fvm.php +1 -1
  2. inc/common.php +6 -49
  3. readme.txt +4 -1
fvm.php CHANGED
@@ -6,7 +6,7 @@ Description: Improve your speed score on GTmetrix, Pingdom Tools and Google Page
6
  Author: Raul Peixoto
7
  Author URI: http://fastvelocity.com
8
  Text Domain: fast-velocity-minify
9
- Version: 3.2.5
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
6
  Author: Raul Peixoto
7
  Author URI: http://fastvelocity.com
8
  Text Domain: fast-velocity-minify
9
+ Version: 3.2.6
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
inc/common.php CHANGED
@@ -528,21 +528,9 @@ function fvm_generate_min_url($url, $tkey, $type, $code) {
528
  $file = $ch_info['ch_dir'] . DIRECTORY_SEPARATOR . $filename;
529
  $public = $ch_info['ch_url'] . '/' .$filename;
530
 
531
- # direct system
532
- if(class_exists('WP_Filesystem_Direct')) {
533
-
534
- # wp
535
- $wpfs = new WP_Filesystem_Direct(null);
536
- if(!$wpfs->exists($file) || ($wpfs->exists($file) && $wpfs->mtime($file) < $tvers)) { $wpfs->put_contents($file, $code); }
537
- if($wpfs->exists($file)) { return $public; }
538
-
539
- } else {
540
-
541
- # php
542
- if(!file_exists($file) || (file_exists($file) && filemtime($file) < $tvers)) { file_put_contents($file, $code); }
543
- if(file_exists($file)) { return $public; }
544
-
545
- }
546
 
547
  }
548
  }
@@ -607,7 +595,7 @@ function fvm_purge_static_files() {
607
  $sqlb_table_name = $wpdb->prefix . 'fvm_logs';
608
 
609
  # test if at least one table exists and empty them
610
- if (!$wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $sqla_table_name)) === $sqla_table_name) {
611
  $wpdb->query("TRUNCATE TABLE {$sqla_table_name}");
612
  $wpdb->query("TRUNCATE TABLE {$sqlb_table_name}");
613
  }
@@ -628,40 +616,9 @@ function fvm_purge_static_files() {
628
 
629
  # instant purge
630
  if(isset($fvm_settings['cache']['min_instant_purge']) && $fvm_settings['cache']['min_instant_purge'] == true) {
631
-
632
- # direct system
633
- if(class_exists('WP_Filesystem_Direct')) {
634
- $wpfs = new WP_Filesystem_Direct(null);
635
- $wpfs->rmdir($ch_info['ch_dir'], true);
636
- return true;
637
- } else {
638
- # iterator fallback
639
- fvm_rrmdir($ch_info['ch_dir']);
640
- }
641
-
642
  } else {
643
-
644
- # older than 7 days and not matching current timestamp
645
-
646
- # direct system
647
- if(class_exists('WP_Filesystem_Direct')) {
648
- $wpfs = new WP_Filesystem_Direct(null);
649
- $list = $wpfs->dirlist($ch_info['ch_dir'], false, true);
650
- if(is_array($list) && count($list) > 0) {
651
- foreach($list as $k=>$arr) {
652
- if(isset($arr['lastmodunix']) && $arr['type'] == 'f' && intval($arr['lastmodunix']) <= $tver-86400*7) {
653
- if(substr($arr['name'], 0, 10) !== time()) {
654
- $wpfs->delete($ch_info['ch_dir'] . DIRECTORY_SEPARATOR . $arr['name'], false, 'f');
655
- }
656
- }
657
- }
658
- }
659
-
660
- } else {
661
- # iterator fallback
662
- fvm_rrmdir($ch_info['ch_dir'], $tver);
663
- }
664
-
665
  }
666
 
667
  }
528
  $file = $ch_info['ch_dir'] . DIRECTORY_SEPARATOR . $filename;
529
  $public = $ch_info['ch_url'] . '/' .$filename;
530
 
531
+ # php
532
+ if(!file_exists($file) || (file_exists($file) && filemtime($file) < $tvers)) { file_put_contents($file, $code); }
533
+ if(file_exists($file)) { return $public; }
 
 
 
 
 
 
 
 
 
 
 
 
534
 
535
  }
536
  }
595
  $sqlb_table_name = $wpdb->prefix . 'fvm_logs';
596
 
597
  # test if at least one table exists and empty them
598
+ if ($wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $sqla_table_name)) === $sqla_table_name) {
599
  $wpdb->query("TRUNCATE TABLE {$sqla_table_name}");
600
  $wpdb->query("TRUNCATE TABLE {$sqlb_table_name}");
601
  }
616
 
617
  # instant purge
618
  if(isset($fvm_settings['cache']['min_instant_purge']) && $fvm_settings['cache']['min_instant_purge'] == true) {
619
+ fvm_rrmdir($ch_info['ch_dir']);
 
 
 
 
 
 
 
 
 
 
620
  } else {
621
+ fvm_rrmdir($ch_info['ch_dir'], $tver); # 7 days
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  }
623
 
624
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Alignak
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, Merging, Minification, Optimization, Speed, Performance, FVM
4
  Requires at least: 4.9
5
  Requires PHP: 5.6
6
- Stable tag: 3.2.5
7
  Tested up to: 5.9.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
@@ -49,6 +49,9 @@ You need a public directory to store and serve minified cache files. If you need
49
 
50
  == Changelog ==
51
 
 
 
 
52
  = 3.2.5 [2022.02.01] =
53
  * changed writing the css/js files to WP_Filesystem_Direct with a secondary fallback method
54
  * fixed a bug when merging css/js can break the site layout if the plugin failed to write the cache file (there will be an html comment on the footer if this happens)
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, Merging, Minification, Optimization, Speed, Performance, FVM
4
  Requires at least: 4.9
5
  Requires PHP: 5.6
6
+ Stable tag: 3.2.6
7
  Tested up to: 5.9.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
49
 
50
  == Changelog ==
51
 
52
+ = 3.2.6 [2022.02.06] =
53
+ * cache purging fixes
54
+
55
  = 3.2.5 [2022.02.01] =
56
  * changed writing the css/js files to WP_Filesystem_Direct with a secondary fallback method
57
  * fixed a bug when merging css/js can break the site layout if the plugin failed to write the cache file (there will be an html comment on the footer if this happens)