EWWW Image Optimizer - Version 6.1.2

Version Description

  • fixed: bug from bypass/exclusion code for bulk scanner in 6.1.1
  • fixed: running is_file on system binaries may trigger open_basedir warnings, use EWWWIO_OPEN_BASEDIR to override PHP's open_basedir restriction
Download this release

Release Info

Developer nosilver4u
Plugin Icon 128x128 EWWW Image Optimizer
Version 6.1.2
Comparing to
See all releases

Code changes from version 6.1.1 to 6.1.2

Files changed (7) hide show
  1. bulk.php +1 -0
  2. changelog.txt +4 -0
  3. common.php +37 -4
  4. ewww-image-optimizer.php +1 -1
  5. readme.txt +5 -1
  6. tests/test-utility.php +2 -1
  7. unique.php +4 -4
bulk.php CHANGED
@@ -1179,6 +1179,7 @@ function ewww_image_optimizer_media_scan( $hook = '' ) {
1179
  // Early check for bypass based on full-size path.
1180
  if ( apply_filters( 'ewww_image_optimizer_bypass', false, $file_path ) === true ) {
1181
  ewwwio_debug_message( "skipping $file_path as instructed" );
 
1182
  ewww_image_optimizer_debug_log();
1183
  continue;
1184
  }
1179
  // Early check for bypass based on full-size path.
1180
  if ( apply_filters( 'ewww_image_optimizer_bypass', false, $file_path ) === true ) {
1181
  ewwwio_debug_message( "skipping $file_path as instructed" );
1182
+ $skipped_ids[] = $selected_id;
1183
  ewww_image_optimizer_debug_log();
1184
  continue;
1185
  }
changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 6.1.1 =
2
  * change: added setting to enable adding of missing width/height dimensions, disabled by default
3
  * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
1
+ = 6.1.2 =
2
+ * fixed: bug from bypass/exclusion code for bulk scanner in 6.1.1
3
+ * fixed: running is_file on system binaries may trigger open_basedir warnings, use EWWWIO_OPEN_BASEDIR to override PHP's open_basedir restriction
4
+
5
  = 6.1.1 =
6
  * change: added setting to enable adding of missing width/height dimensions, disabled by default
7
  * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
common.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '611' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
@@ -3449,6 +3449,36 @@ function ewww_image_optimizer_filesize( $file ) {
3449
  }
3450
  }
3451
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3452
  /**
3453
  * Check if a file/directory is readable.
3454
  *
@@ -5863,7 +5893,7 @@ function ewww_image_optimizer_aux_images_loop( $attachment = null, $auto = false
5863
  }
5864
  // Retrieve the time when the optimizer starts.
5865
  $started = microtime( true );
5866
- if ( ewww_image_optimizer_stl_check() && ini_get( 'max_execution_time' ) < 60 ) {
5867
  set_time_limit( 0 );
5868
  }
5869
  // Get the next image in the queue.
@@ -10275,9 +10305,10 @@ function ewwwio_is_cf_host() {
10275
  '197.234.240.0/22',
10276
  '198.41.128.0/17',
10277
  '162.158.0.0/15',
10278
- '104.16.0.0/12',
10279
  '172.64.0.0/13',
10280
  '131.0.72.0/22',
 
 
10281
  );
10282
  if ( ! empty( $_SERVER['HTTP_CF_IPCOUNTRY'] ) ) {
10283
  ewwwio_debug_message( 'found Cloudflare host via HTTP_CF_IPCOUNTRY' );
@@ -10535,7 +10566,9 @@ function ewwwio_debug_info() {
10535
  ewwwio_debug_message( 'webp .htaccess rules not detected' );
10536
  }
10537
  }
10538
- ewwwio_debug_message( 'max_execution_time: ' . ini_get( 'max_execution_time' ) );
 
 
10539
  ewww_image_optimizer_stl_check();
10540
  ewww_image_optimizer_function_exists( 'sleep', true );
10541
  ewwwio_check_memory_available();
14
  exit;
15
  }
16
 
17
+ define( 'EWWW_IMAGE_OPTIMIZER_VERSION', '612' );
18
 
19
  // Initialize a couple globals.
20
  $eio_debug = '';
3449
  }
3450
  }
3451
 
3452
+ /**
3453
+ * Check if open_basedir restriction is in effect, and that the path is allowed and exists.
3454
+ *
3455
+ * Note that when the EWWWIO_OPEN_BASEDIR constant is defined, is_file() will be skipped.
3456
+ *
3457
+ * @param string $file The path of the file to check.
3458
+ * @return bool False if open_basedir setting cannot be retrieved, or the file is "out of bounds", true if the file exists.
3459
+ */
3460
+ function ewwwio_system_binary_exists( $file ) {
3461
+ if ( ! ewww_image_optimizer_function_exists( 'ini_get' ) && ! defined( 'EWWWIO_OPEN_BASEDIR' ) ) {
3462
+ return false;
3463
+ }
3464
+ if ( defined( 'EWWWIO_OPEN_BASEDIR' ) ) {
3465
+ $basedirs = EWWWIO_OPEN_BASEDIR;
3466
+ } else {
3467
+ $basedirs = ini_get( 'open_basedir' );
3468
+ }
3469
+ if ( empty( $basedirs ) ) {
3470
+ return defined( 'EWWWIO_OPEN_BASEDIR' ) ? true : is_file( $file );
3471
+ }
3472
+ $basedirs = explode( PATH_SEPARATOR, $basedirs );
3473
+ foreach ( $basedirs as $basedir ) {
3474
+ $basedir = trim( $basedir );
3475
+ if ( 0 === strpos( $file, $basedir ) ) {
3476
+ return defined( 'EWWWIO_OPEN_BASEDIR' ) ? true : is_file( $file );
3477
+ }
3478
+ }
3479
+ return false;
3480
+ }
3481
+
3482
  /**
3483
  * Check if a file/directory is readable.
3484
  *
5893
  }
5894
  // Retrieve the time when the optimizer starts.
5895
  $started = microtime( true );
5896
+ if ( ewww_image_optimizer_stl_check() && ewww_image_optimizer_function_exists( 'ini_get' ) && ini_get( 'max_execution_time' ) < 60 ) {
5897
  set_time_limit( 0 );
5898
  }
5899
  // Get the next image in the queue.
10305
  '197.234.240.0/22',
10306
  '198.41.128.0/17',
10307
  '162.158.0.0/15',
 
10308
  '172.64.0.0/13',
10309
  '131.0.72.0/22',
10310
+ '104.16.0.0/13',
10311
+ '104.24.0.0/14',
10312
  );
10313
  if ( ! empty( $_SERVER['HTTP_CF_IPCOUNTRY'] ) ) {
10314
  ewwwio_debug_message( 'found Cloudflare host via HTTP_CF_IPCOUNTRY' );
10566
  ewwwio_debug_message( 'webp .htaccess rules not detected' );
10567
  }
10568
  }
10569
+ if ( ewww_image_optimizer_function_exists( 'ini_get' ) ) {
10570
+ ewwwio_debug_message( 'max_execution_time: ' . ini_get( 'max_execution_time' ) );
10571
+ }
10572
  ewww_image_optimizer_stl_check();
10573
  ewww_image_optimizer_function_exists( 'sleep', true );
10574
  ewwwio_check_memory_available();
ewww-image-optimizer.php CHANGED
@@ -13,7 +13,7 @@ Plugin Name: EWWW Image Optimizer
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Exactly WWW
16
- Version: 6.1.1
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
13
  Plugin URI: https://wordpress.org/plugins/ewww-image-optimizer/
14
  Description: Reduce file sizes for images within WordPress including NextGEN Gallery and GRAND FlAGallery. Uses jpegtran, optipng/pngout, and gifsicle.
15
  Author: Exactly WWW
16
+ Version: 6.1.2
17
  Author URI: https://ewww.io/
18
  License: GPLv3
19
  */
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: optimize, image, convert, webp, resize, compress, lazy load, optimization,
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
- Stable tag: 6.1.1
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
@@ -132,6 +132,10 @@ That's not a question, but since I made it up, I'll answer it. See this resource
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io)
133
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
134
 
 
 
 
 
135
  = 6.1.1 =
136
  * change: added setting to enable adding of missing width/height dimensions, disabled by default
137
  * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
5
  Requires at least: 5.4
6
  Tested up to: 5.7
7
  Requires PHP: 7.1
8
+ Stable tag: 6.1.2
9
  License: GPLv3
10
 
11
  Smaller Images, Faster Sites, Happier Visitors. Comprehensive image optimization that doesn't require a degree in rocket science.
132
  * Feature requests can be viewed and submitted on our [feedback portal](https://feedback.ewww.io)
133
  * If you would like to help translate this plugin in your language, [join the team](https://translate.wordpress.org/projects/wp-plugins/ewww-image-optimizer/)
134
 
135
+ = 6.1.2 =
136
+ * fixed: bug from bypass/exclusion code for bulk scanner in 6.1.1
137
+ * fixed: running is_file on system binaries may trigger open_basedir warnings, use EWWWIO_OPEN_BASEDIR to override PHP's open_basedir restriction
138
+
139
  = 6.1.1 =
140
  * change: added setting to enable adding of missing width/height dimensions, disabled by default
141
  * fixed: warning from plugins using core wp_lazy_load filter without second parameter/argument
tests/test-utility.php CHANGED
@@ -129,9 +129,10 @@ class EWWWIO_Utility_Tests extends WP_UnitTestCase {
129
  '197.234.240.0/22',
130
  '198.41.128.0/17',
131
  '162.158.0.0/15',
132
- '104.16.0.0/12',
133
  '172.64.0.0/13',
134
  '131.0.72.0/22',
 
 
135
  );
136
  foreach( $latest_ips as $key => $range ) {
137
  if ( empty( $range ) ) {
129
  '197.234.240.0/22',
130
  '198.41.128.0/17',
131
  '162.158.0.0/15',
 
132
  '172.64.0.0/13',
133
  '131.0.72.0/22',
134
+ '104.16.0.0/13',
135
+ '104.24.0.0/14',
136
  );
137
  foreach( $latest_ips as $key => $range ) {
138
  if ( empty( $range ) ) {
unique.php CHANGED
@@ -1705,13 +1705,13 @@ function ewww_image_optimizer_find_nix_binary( $binary, $switch ) {
1705
  }
1706
  }
1707
  // If we still haven't found a usable binary, try a system-installed version.
1708
- if ( is_file( '/usr/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/bin/' . $binary, $switch ) ) {
1709
  return '/usr/bin/' . $binary;
1710
- } elseif ( is_file( '/usr/local/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/local/bin/' . $binary, $switch ) ) {
1711
  return '/usr/local/bin/' . $binary;
1712
- } elseif ( is_file( '/usr/gnu/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/gnu/bin/' . $binary, $switch ) ) {
1713
  return '/usr/gnu/bin/' . $binary;
1714
- } elseif ( is_file( '/usr/syno/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/syno/bin/' . $binary, $switch ) ) { // For synology diskstation OS.
1715
  return '/usr/syno/bin/' . $binary;
1716
  } elseif ( ewww_image_optimizer_tool_found( $binary, $switch ) ) {
1717
  return $binary;
1705
  }
1706
  }
1707
  // If we still haven't found a usable binary, try a system-installed version.
1708
+ if ( ewwwio_system_binary_exists( '/usr/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/bin/' . $binary, $switch ) ) {
1709
  return '/usr/bin/' . $binary;
1710
+ } elseif ( ewwwio_system_binary_exists( '/usr/local/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/local/bin/' . $binary, $switch ) ) {
1711
  return '/usr/local/bin/' . $binary;
1712
+ } elseif ( ewwwio_system_binary_exists( '/usr/gnu/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/gnu/bin/' . $binary, $switch ) ) {
1713
  return '/usr/gnu/bin/' . $binary;
1714
+ } elseif ( ewwwio_system_binary_exists( '/usr/syno/bin/' . $binary ) && ewww_image_optimizer_tool_found( '/usr/syno/bin/' . $binary, $switch ) ) { // For synology diskstation OS.
1715
  return '/usr/syno/bin/' . $binary;
1716
  } elseif ( ewww_image_optimizer_tool_found( $binary, $switch ) ) {
1717
  return $binary;