Fast Velocity Minify - Version 3.1.7

Version Description

[2021.04.26] = * more php notices fixes

Download this release

Release Info

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

Code changes from version 3.1.6 to 3.1.7

Files changed (4) hide show
  1. fvm.php +2 -2
  2. inc/common.php +12 -4
  3. inc/wp-cli.php +2 -2
  4. readme.txt +5 -2
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.1.6
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
@@ -55,7 +55,7 @@ if (defined('WP_CLI') && WP_CLI) {
55
  $fvm_settings = fvm_get_settings();
56
 
57
  # site url, domain name
58
- $fvm_urls = array('wp_site_url'=>site_url(), 'wp_domain'=>fvm_get_domain());
59
 
60
 
61
  # only on backend
6
  Author: Raul Peixoto
7
  Author URI: http://fastvelocity.com
8
  Text Domain: fast-velocity-minify
9
+ Version: 3.1.7
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
55
  $fvm_settings = fvm_get_settings();
56
 
57
  # site url, domain name
58
+ $fvm_urls = array('wp_site_url'=>trailingslashit(site_url()), 'wp_domain'=>fvm_get_domain());
59
 
60
 
61
  # only on backend
inc/common.php CHANGED
@@ -394,8 +394,11 @@ function fvm_generate_min_url($url, $tkey, $type, $code) {
394
  # files first, but only for js/css types
395
  if(function_exists('wp_upload_dir')) {
396
 
 
 
 
397
  # parse uripath and check if it matches against our rewrite format
398
- $filename = $tkey .'.'. $type;
399
 
400
  # set cache on the uploads directory
401
  $upload_dir = wp_upload_dir();
@@ -497,6 +500,9 @@ function fvm_purge_static_files() {
497
 
498
  # process
499
  if( function_exists('wp_upload_dir') ) {
 
 
 
500
 
501
  $upload_dir = wp_upload_dir();
502
  if(isset($upload_dir['basedir']) && isset($upload_dir['baseurl']) && !empty($upload_dir['basedir'])) {
@@ -514,12 +520,14 @@ function fvm_purge_static_files() {
514
  $cache_dir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'fvm-cache'. DIRECTORY_SEPARATOR . 'min';
515
  $fileSystemDirect = new WP_Filesystem_Direct(false);
516
 
517
- # older than 3 days
518
  $list = $fileSystemDirect->dirlist($cache_dir, false, true);
519
  if(is_array($list) && count($list) > 0) {
520
  foreach($list as $k=>$arr) {
521
  if(isset($arr['lastmodunix']) && $arr['type'] == 'f' && intval($arr['lastmodunix']) <= time()-86400) {
522
- $fileSystemDirect->delete($cache_dir . DIRECTORY_SEPARATOR . $arr['name'], false, 'f');
 
 
523
  }
524
  }
525
  }
@@ -779,7 +787,7 @@ function fvm_save_log($arr) {
779
 
780
  # check if exists before inserting
781
  $result = $wpdb->get_row($wpdb->prepare("SELECT id FROM ".$wpdb->prefix."fvm_logs WHERE uid = %s LIMIT 1", $arr['uid']));
782
- if(is_null($check) || !isset($result->id)) {
783
 
784
  # prepare and insert to database
785
  $wpdb->query($wpdb->prepare("INSERT IGNORE INTO ".$wpdb->prefix."fvm_logs (".implode(', ', $fld).") VALUES (".implode(', ', $tpe).")", $vls));
394
  # files first, but only for js/css types
395
  if(function_exists('wp_upload_dir')) {
396
 
397
+ # cache date
398
+ $tvers = get_option('fvm_last_cache_update', '0');
399
+
400
  # parse uripath and check if it matches against our rewrite format
401
+ $filename = $tvers.'-'.$tkey .'.'. $type;
402
 
403
  # set cache on the uploads directory
404
  $upload_dir = wp_upload_dir();
500
 
501
  # process
502
  if( function_exists('wp_upload_dir') ) {
503
+
504
+ # current timestamp
505
+ $tvers = get_option('fvm_last_cache_update', '0');
506
 
507
  $upload_dir = wp_upload_dir();
508
  if(isset($upload_dir['basedir']) && isset($upload_dir['baseurl']) && !empty($upload_dir['basedir'])) {
520
  $cache_dir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'fvm-cache'. DIRECTORY_SEPARATOR . 'min';
521
  $fileSystemDirect = new WP_Filesystem_Direct(false);
522
 
523
+ # older than 24h and not matching current timestamp
524
  $list = $fileSystemDirect->dirlist($cache_dir, false, true);
525
  if(is_array($list) && count($list) > 0) {
526
  foreach($list as $k=>$arr) {
527
  if(isset($arr['lastmodunix']) && $arr['type'] == 'f' && intval($arr['lastmodunix']) <= time()-86400) {
528
+ if(substr($arr['name'], 0, 10) !== $tvers) {
529
+ $fileSystemDirect->delete($cache_dir . DIRECTORY_SEPARATOR . $arr['name'], false, 'f');
530
+ }
531
  }
532
  }
533
  }
787
 
788
  # check if exists before inserting
789
  $result = $wpdb->get_row($wpdb->prepare("SELECT id FROM ".$wpdb->prefix."fvm_logs WHERE uid = %s LIMIT 1", $arr['uid']));
790
+ if(!isset($result->id)) {
791
 
792
  # prepare and insert to database
793
  $wpdb->query($wpdb->prepare("INSERT IGNORE INTO ".$wpdb->prefix."fvm_logs (".implode(', ', $fld).") VALUES (".implode(', ', $tpe).")", $vls));
inc/wp-cli.php CHANGED
@@ -15,11 +15,11 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
15
  # purge files + cache
16
  public function purge() {
17
  WP_CLI::success( __( 'FVM and other caches were purged.', 'fast-velocity-minify' ) );
18
- fvm_purge_minification();
19
  fvm_purge_others();
20
 
21
  # purge everything
22
- $cache = fvm_purge_minification();
23
  $others = fvm_purge_others();
24
 
25
  # notices
15
  # purge files + cache
16
  public function purge() {
17
  WP_CLI::success( __( 'FVM and other caches were purged.', 'fast-velocity-minify' ) );
18
+ fvm_purge_static_files();
19
  fvm_purge_others();
20
 
21
  # purge everything
22
+ $cache = fvm_purge_static_files();
23
  $others = fvm_purge_others();
24
 
25
  # notices
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.1.6
7
  Tested up to: 5.7.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
@@ -55,8 +55,11 @@ Version 3.0 is a major code rewrite to improve JS and CSS merging, but it requir
55
 
56
  == Changelog ==
57
 
 
 
 
58
  = 3.1.6 [2021.04.25] =
59
- * fixed a notice on wp-admin
60
  * better http2 support
61
 
62
  = 3.1.5 [2021.04.24] =
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.1.7
7
  Tested up to: 5.7.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
55
 
56
  == Changelog ==
57
 
58
+ = 3.1.7 [2021.04.26] =
59
+ * more php notices fixes
60
+
61
  = 3.1.6 [2021.04.25] =
62
+ * php notices fixes
63
  * better http2 support
64
 
65
  = 3.1.5 [2021.04.24] =