Cache Enabler – WordPress Cache - Version 1.7.2

Version Description

  • Update string to be translatable (#235 @timse201)
  • Add cache_enabler_mkdir_mode filter hook (#233)
Download this release

Release Info

Developer keycdn
Plugin Icon 128x128 Cache Enabler – WordPress Cache
Version 1.7.2
Comparing to
See all releases

Code changes from version 1.7.1 to 1.7.2

cache-enabler.php CHANGED
@@ -6,7 +6,7 @@ Description: Simple and fast WordPress caching plugin.
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
- Version: 1.7.1
10
  */
11
 
12
  /*
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  }
33
 
34
  // constants
35
- define( 'CACHE_ENABLER_VERSION', '1.7.1' );
36
  define( 'CACHE_ENABLER_MIN_PHP', '5.6' );
37
  define( 'CACHE_ENABLER_MIN_WP', '5.1' );
38
  define( 'CACHE_ENABLER_FILE', __FILE__ );
6
  Author: KeyCDN
7
  Author URI: https://www.keycdn.com
8
  License: GPLv2 or later
9
+ Version: 1.7.2
10
  */
11
 
12
  /*
32
  }
33
 
34
  // constants
35
+ define( 'CACHE_ENABLER_VERSION', '1.7.2' );
36
  define( 'CACHE_ENABLER_MIN_PHP', '5.6' );
37
  define( 'CACHE_ENABLER_MIN_WP', '5.1' );
38
  define( 'CACHE_ENABLER_FILE', __FILE__ );
inc/cache_enabler.class.php CHANGED
@@ -750,7 +750,7 @@ final class Cache_Enabler {
750
  * add plugin metadata in the plugins list table
751
  *
752
  * @since 1.0.0
753
- * @change 1.7.0
754
  *
755
  * @param array $plugin_meta plugin metadata, including the version, author, author URI, and plugin URI
756
  * @param string $plugin_file path to the plugin file relative to the plugins directory
@@ -767,7 +767,7 @@ final class Cache_Enabler {
767
  // append metadata
768
  $plugin_meta = wp_parse_args(
769
  array(
770
- '<a href="https://www.keycdn.com/support/wordpress-cache-enabler-plugin" target="_blank" rel="nofollow noopener">Documentation</a>',
771
  ),
772
  $plugin_meta
773
  );
750
  * add plugin metadata in the plugins list table
751
  *
752
  * @since 1.0.0
753
+ * @change 1.7.2
754
  *
755
  * @param array $plugin_meta plugin metadata, including the version, author, author URI, and plugin URI
756
  * @param string $plugin_file path to the plugin file relative to the plugins directory
767
  // append metadata
768
  $plugin_meta = wp_parse_args(
769
  array(
770
+ '<a href="https://www.keycdn.com/support/wordpress-cache-enabler-plugin" target="_blank" rel="nofollow noopener">' . esc_html__( 'Documentation', 'cache-enabler' ) . '</a>',
771
  ),
772
  $plugin_meta
773
  );
inc/cache_enabler_disk.class.php CHANGED
@@ -912,7 +912,7 @@ final class Cache_Enabler_Disk {
912
  * makes directory recursively based on directory path
913
  *
914
  * @since 1.7.0
915
- * @change 1.7.0
916
  *
917
  * @param string $dir directory path to create
918
  * @return boolean true if the directory either already exists or was created and has the correct permissions, false otherwise
@@ -920,11 +920,13 @@ final class Cache_Enabler_Disk {
920
 
921
  private static function mkdir_p( $dir ) {
922
 
923
- $parent_dir = dirname( $dir );
924
- $fs = self::get_filesystem();
 
 
925
 
926
- // check if directory and its parent have 755 permissions
927
- if ( $fs->is_dir( $dir ) && $fs->getchmod( $dir ) === '755' && $fs->getchmod( $parent_dir ) === '755' ) {
928
  return true;
929
  }
930
 
@@ -934,13 +936,13 @@ final class Cache_Enabler_Disk {
934
  }
935
 
936
  // check parent directory permissions
937
- if ( $fs->getchmod( $parent_dir ) !== '755' ) {
938
- return $fs->chmod( $parent_dir, 0755, true );
939
  }
940
 
941
  // check directory permissions
942
- if ( $fs->getchmod( $dir ) !== '755' ) {
943
- return $fs->chmod( $dir, 0755 );
944
  }
945
 
946
  return true;
912
  * makes directory recursively based on directory path
913
  *
914
  * @since 1.7.0
915
+ * @change 1.7.2
916
  *
917
  * @param string $dir directory path to create
918
  * @return boolean true if the directory either already exists or was created and has the correct permissions, false otherwise
920
 
921
  private static function mkdir_p( $dir ) {
922
 
923
+ $fs = self::get_filesystem();
924
+ $mode_octal = apply_filters( 'cache_enabler_mkdir_mode', 0755 );
925
+ $mode_string = decoct( $mode_octal ); // get last three digits (e.g. '755')
926
+ $parent_dir = dirname( $dir );
927
 
928
+ // check if directory and its parent have correct permissions
929
+ if ( $fs->is_dir( $dir ) && $fs->getchmod( $dir ) === $mode_string && $fs->getchmod( $parent_dir ) === $mode_string ) {
930
  return true;
931
  }
932
 
936
  }
937
 
938
  // check parent directory permissions
939
+ if ( $fs->getchmod( $parent_dir ) !== $mode_string ) {
940
+ return $fs->chmod( $parent_dir, $mode_octal, true );
941
  }
942
 
943
  // check directory permissions
944
+ if ( $fs->getchmod( $dir ) !== $mode_string ) {
945
+ return $fs->chmod( $dir, $mode_octal );
946
  }
947
 
948
  return true;
readme.txt CHANGED
@@ -55,6 +55,10 @@ Cache Enabler captures page contents and saves it as a static HTML file on the s
55
 
56
  == Changelog ==
57
 
 
 
 
 
58
  = 1.7.1 =
59
  * Fix directory creation handling (#221 @stevegrunwell)
60
 
55
 
56
  == Changelog ==
57
 
58
+ = 1.7.2 =
59
+ * Update string to be translatable (#235 @timse201)
60
+ * Add `cache_enabler_mkdir_mode` filter hook (#233)
61
+
62
  = 1.7.1 =
63
  * Fix directory creation handling (#221 @stevegrunwell)
64