SG Optimizer - Version 5.1.4

Version Description

Download this release

Release Info

Developer sstoqnov
Plugin Icon 128x128 SG Optimizer
Version 5.1.4
Comparing to
See all releases

Code changes from version 5.1.3 to 5.1.4

core/Cli/Cli_Optimizer.php CHANGED
@@ -174,10 +174,10 @@ class Cli_Optimizer {
174
  }
175
 
176
  if ( in_array( false, $status ) ) {
177
- return \WP_CLI::error( 'Could not Enable Lazy Loading Images' );
178
  }
179
 
180
- return \WP_CLI::success( 'Lazy Loading Images Enabled' );
181
 
182
  }
183
 
174
  }
175
 
176
  if ( in_array( false, $status ) ) {
177
+ return \WP_CLI::error( 'Could not ' . $action . ' Lazy Loading Images' );
178
  }
179
 
180
+ return \WP_CLI::success( 'Lazy Loading Images ' . ucwords( $action ) );
181
 
182
  }
183
 
core/Memcache/Memcache.php CHANGED
@@ -175,6 +175,13 @@ class Memcache {
175
  $port_file_content = $this->get_port_file_contents();
176
 
177
  if ( ! $port_file_content ) {
 
 
 
 
 
 
 
178
  return '';
179
  }
180
 
175
  $port_file_content = $this->get_port_file_contents();
176
 
177
  if ( ! $port_file_content ) {
178
+ $response = shell_exec( 'test -f /etc/yum.repos.d/baseos.repo && echo Avalon' );
179
+
180
+ // The post for our new server is aloways the same.
181
+ if ( 'Avalon' === trim( $response ) ) {
182
+ return 11211;
183
+ }
184
+
185
  return '';
186
  }
187
 
core/Rest/Rest_Helper.php CHANGED
@@ -208,6 +208,7 @@ class Rest_Helper {
208
  )
209
  );
210
  }
 
211
  // First enable the option.
212
  $result = Options::enable_option( 'siteground_optimizer_enable_memcached' );
213
 
@@ -218,6 +219,14 @@ class Rest_Helper {
218
  'message' => __( 'Memcached Enabled', 'sg-cachepress' ),
219
  )
220
  );
 
 
 
 
 
 
 
 
221
  }
222
 
223
  // Dropin cannot be created.
208
  )
209
  );
210
  }
211
+
212
  // First enable the option.
213
  $result = Options::enable_option( 'siteground_optimizer_enable_memcached' );
214
 
219
  'message' => __( 'Memcached Enabled', 'sg-cachepress' ),
220
  )
221
  );
222
+ } else {
223
+ if ( 11211 === $port ) {
224
+ wp_send_json_error(
225
+ array(
226
+ 'message' => __( 'SG Optimizer was unable to connect to the Memcached server and it was disabled. Please, check your cPanel and turn it on if disabled.', 'sg-cachepress' ),
227
+ )
228
+ );
229
+ }
230
  }
231
 
232
  // Dropin cannot be created.
core/Supercacher/Supercacher.php CHANGED
@@ -178,8 +178,7 @@ class Supercacher {
178
  }
179
 
180
  $hostname = parse_url( home_url(), PHP_URL_HOST );
181
- $ip = isset( $_SERVER['SERVER_ADDR'] ) ? $_SERVER['SERVER_ADDR'] : $hostname;
182
- $cache_server_socket = @fsockopen( $ip, 80, $errno, $errstr, 2 );
183
 
184
  if ( ! $cache_server_socket ) {
185
  return false;
178
  }
179
 
180
  $hostname = parse_url( home_url(), PHP_URL_HOST );
181
+ $cache_server_socket = @fsockopen( $hostname, 80, $errno, $errstr, 2 );
 
182
 
183
  if ( ! $cache_server_socket ) {
184
  return false;
readme.txt CHANGED
@@ -169,6 +169,11 @@ Our plugin uses a cookie in order to function properly. It does not store person
169
 
170
  == Changelog ==
171
 
 
 
 
 
 
172
  = Version 5.1.3 =
173
  * Improved Elementor support
174
  * Improved CSS optimization for inclusions without protocol
169
 
170
  == Changelog ==
171
 
172
+ = Version 5.1.4 =
173
+ * Improved WP-CLI lazy load command
174
+ * Added support for Memcached on the new SG setup
175
+ * Preparation for the next major update
176
+
177
  = Version 5.1.3 =
178
  * Improved Elementor support
179
  * Improved CSS optimization for inclusions without protocol
sg-cachepress.php CHANGED
@@ -9,7 +9,7 @@
9
  * @wordpress-plugin
10
  * Plugin Name: SG Optimizer
11
  * Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
12
- * Version: 5.1.3
13
  * Author: SiteGround
14
  * Text Domain: sg-cachepress
15
  * Domain Path: /languages
@@ -29,7 +29,7 @@ if ( ! defined( 'WPINC' ) ) {
29
 
30
  // Define version constant.
31
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
32
- define( __NAMESPACE__ . '\VERSION', '5.1.3' );
33
  }
34
 
35
  // Define slug constant.
9
  * @wordpress-plugin
10
  * Plugin Name: SG Optimizer
11
  * Description: This plugin will link your WordPress application with all the performance optimizations provided by SiteGround
12
+ * Version: 5.1.4
13
  * Author: SiteGround
14
  * Text Domain: sg-cachepress
15
  * Domain Path: /languages
29
 
30
  // Define version constant.
31
  if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) {
32
+ define( __NAMESPACE__ . '\VERSION', '5.1.4' );
33
  }
34
 
35
  // Define slug constant.