Version Description
- 5-10-2022 =
- Fixed: An issue with detecting abandoned plugins and themes on specific setups
- Fixed: An issue with running scheduled events on specific setups
- Added: Nginx Helper to the Purge Cache system
- Added: Nitropack to the Purge Cache system
- Added: Autoptimize to the Purge Cache system
- Updated: Tested up to tag to WP 6.0
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child |
Version | 4.2.2 |
Comparing to | |
See all releases |
Code changes from version 4.2.1 to 4.2.2
- class/class-mainwp-child-cache-purge.php +121 -3
- class/class-mainwp-child-callable.php +2 -16
- class/class-mainwp-child-plugins-check.php +4 -4
- class/class-mainwp-child-themes-check.php +4 -4
- class/class-mainwp-child-updates.php +2 -18
- class/class-mainwp-child.php +2 -10
- class/class-mainwp-helper.php +39 -4
- mainwp-child.php +1 -1
- readme.txt +10 -2
class/class-mainwp-child-cache-purge.php
CHANGED
@@ -122,6 +122,9 @@ class MainWP_Child_Cache_Purge {
|
|
122 |
'w3-total-cache/w3-total-cache.php' => 'W3 Total Cache',
|
123 |
'hummingbird-performance/wp-hummingbird.php' => 'Hummingbird Performance',
|
124 |
'cache-enabler/cache-enabler.php' => 'Cache Enabler',
|
|
|
|
|
|
|
125 |
);
|
126 |
|
127 |
// Check if a supported cache plugin is active then check if CloudFlair is active.
|
@@ -143,7 +146,7 @@ class MainWP_Child_Cache_Purge {
|
|
143 |
* @used-by MainWP_Child_Updates::upgrade_plugin_theme()
|
144 |
* @used-by MainWP_Child_Updates::upgrade_wp()
|
145 |
*/
|
146 |
-
public function auto_purge_cache() {
|
147 |
// Check if Cache Control is enabled.
|
148 |
if ( get_option( 'mainwp_child_auto_purge_cache' ) == '1' ) {
|
149 |
$information = array();
|
@@ -181,6 +184,15 @@ class MainWP_Child_Cache_Purge {
|
|
181 |
case 'Cache Enabler':
|
182 |
$information = $this->cache_enabler_auto_purge_cache();
|
183 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
case 'Cloudflare':
|
185 |
$information = $this->cloudflair_auto_purge_cache();
|
186 |
break;
|
@@ -197,6 +209,111 @@ class MainWP_Child_Cache_Purge {
|
|
197 |
}
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
/**
|
201 |
* Purge WP Hummingbird cache after updates.
|
202 |
*
|
@@ -478,8 +595,9 @@ class MainWP_Child_Cache_Purge {
|
|
478 |
*/
|
479 |
public function litespeed_auto_purge_cache() {
|
480 |
// Purge all LS Cache.
|
481 |
-
|
482 |
-
|
|
|
483 |
|
484 |
// record results.
|
485 |
update_option( 'mainwp_cache_control_last_purged', time() );
|
122 |
'w3-total-cache/w3-total-cache.php' => 'W3 Total Cache',
|
123 |
'hummingbird-performance/wp-hummingbird.php' => 'Hummingbird Performance',
|
124 |
'cache-enabler/cache-enabler.php' => 'Cache Enabler',
|
125 |
+
'nginx-helper/nginx-helper.php' => 'Nginx Helper',
|
126 |
+
'nitropack/main.php' => 'Nitropack',
|
127 |
+
'autoptimize/autoptimize.php' => 'Autoptimize',
|
128 |
);
|
129 |
|
130 |
// Check if a supported cache plugin is active then check if CloudFlair is active.
|
146 |
* @used-by MainWP_Child_Updates::upgrade_plugin_theme()
|
147 |
* @used-by MainWP_Child_Updates::upgrade_wp()
|
148 |
*/
|
149 |
+
public function auto_purge_cache() { // phpcs:ignore -- Current complexity is the only way to achieve desired results, pull request solutions appreciated.
|
150 |
// Check if Cache Control is enabled.
|
151 |
if ( get_option( 'mainwp_child_auto_purge_cache' ) == '1' ) {
|
152 |
$information = array();
|
184 |
case 'Cache Enabler':
|
185 |
$information = $this->cache_enabler_auto_purge_cache();
|
186 |
break;
|
187 |
+
case 'Nginx Helper':
|
188 |
+
$information = $this->nginx_helper_auto_purge_cache();
|
189 |
+
break;
|
190 |
+
case 'Nitropack':
|
191 |
+
$information = $this->nitropack_auto_purge_cache();
|
192 |
+
break;
|
193 |
+
case 'Autoptimize':
|
194 |
+
$information = $this->autoptimize_auto_purge_cache();
|
195 |
+
break;
|
196 |
case 'Cloudflare':
|
197 |
$information = $this->cloudflair_auto_purge_cache();
|
198 |
break;
|
209 |
}
|
210 |
}
|
211 |
|
212 |
+
/**
|
213 |
+
* Purge Autoptimize cache after updates.
|
214 |
+
*/
|
215 |
+
public function autoptimize_auto_purge_cache() {
|
216 |
+
if ( class_exists( 'autoptimizeCache' ) ) {
|
217 |
+
|
218 |
+
// Clear Cache.
|
219 |
+
\autoptimizeCache::clearall();
|
220 |
+
|
221 |
+
// record results.
|
222 |
+
update_option( 'mainwp_cache_control_last_purged', time() );
|
223 |
+
return array(
|
224 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
225 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
226 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
227 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
228 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
229 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
230 |
+
'result' => 'Autoptimize Cache => Cache auto cleared on: (' . current_time( 'mysql' ) . ')',
|
231 |
+
);
|
232 |
+
} else {
|
233 |
+
return array(
|
234 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
235 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
236 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
237 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
238 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
239 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
240 |
+
'result' => 'Autoptimize Cache => There was an issue purging your cache.',
|
241 |
+
);
|
242 |
+
}
|
243 |
+
}
|
244 |
+
|
245 |
+
/**
|
246 |
+
* Purge Nitropack cache after updates.
|
247 |
+
*
|
248 |
+
* Nitropack_purge($url = NULL, $tag = NULL, $reason = NULL);
|
249 |
+
*
|
250 |
+
* In case you want to do a full purge, you must leave the values
|
251 |
+
* for URL and Tag empty. In case you want to create a targeted purge
|
252 |
+
* you can replace them with the URL or tag of the page.
|
253 |
+
*/
|
254 |
+
public function nitropack_auto_purge_cache() {
|
255 |
+
if ( function_exists( 'nitropack_purge' ) ) {
|
256 |
+
|
257 |
+
// Clear Nitropack Cache after update.
|
258 |
+
nitropack_purge();
|
259 |
+
|
260 |
+
// record results.
|
261 |
+
update_option( 'mainwp_cache_control_last_purged', time() );
|
262 |
+
return array(
|
263 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
264 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
265 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
266 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
267 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
268 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
269 |
+
'result' => 'Nitropack Cache => Cache auto cleared on: (' . current_time( 'mysql' ) . ')',
|
270 |
+
);
|
271 |
+
} else {
|
272 |
+
return array(
|
273 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
274 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
275 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
276 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
277 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
278 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
279 |
+
'result' => 'Nitropack Cache => There was an issue purging your cache.',
|
280 |
+
);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Purge Nginx Helper cache after updates.
|
286 |
+
*/
|
287 |
+
public function nginx_helper_auto_purge_cache() {
|
288 |
+
if ( class_exists( 'Nginx_Helper' ) ) {
|
289 |
+
|
290 |
+
// Clear Nginx Helper Cache after update.
|
291 |
+
do_action( 'rt_nginx_helper_purge_all' );
|
292 |
+
|
293 |
+
// record results.
|
294 |
+
update_option( 'mainwp_cache_control_last_purged', time() );
|
295 |
+
return array(
|
296 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
297 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
298 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
299 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
300 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
301 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
302 |
+
'result' => 'Nginx Helper Cache => Cache auto cleared on: (' . current_time( 'mysql' ) . ')',
|
303 |
+
);
|
304 |
+
} else {
|
305 |
+
return array(
|
306 |
+
'Last Purged' => get_option( 'mainwp_cache_control_last_purged', false ),
|
307 |
+
'Cache Solution' => get_option( 'mainwp_cache_control_cache_solution', false ),
|
308 |
+
'Cache Control Enabled' => get_option( 'mainwp_child_auto_purge_cache' ),
|
309 |
+
'Cloudflair Enabled' => get_option( 'mainwp_child_cloud_flair_enabled' ),
|
310 |
+
'CloudFlair Email' => get_option( 'mainwp_cloudflair_email' ),
|
311 |
+
'Cloudflair Key' => get_option( 'mainwp_cloudflair_key' ),
|
312 |
+
'result' => 'Nginx Helper Cache => There was an issue purging your cache.',
|
313 |
+
);
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
/**
|
318 |
* Purge WP Hummingbird cache after updates.
|
319 |
*
|
595 |
*/
|
596 |
public function litespeed_auto_purge_cache() {
|
597 |
// Purge all LS Cache.
|
598 |
+
|
599 |
+
if ( class_exists( '\LiteSpeed\Purge' ) ) {
|
600 |
+
\LiteSpeed\Purge::purge_all();
|
601 |
|
602 |
// record results.
|
603 |
update_option( 'mainwp_cache_control_last_purged', time() );
|
class/class-mainwp-child-callable.php
CHANGED
@@ -160,27 +160,13 @@ class MainWP_Child_Callable {
|
|
160 |
|
161 |
// Fire off the called function.
|
162 |
if ( $auth && isset( $_POST['function'] ) && $callable ) {
|
163 |
-
|
164 |
-
/**
|
165 |
-
* Checks whether cron is in progress.
|
166 |
-
*
|
167 |
-
* @const ( bool ) Default: true
|
168 |
-
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child_Callable.html
|
169 |
-
*/
|
170 |
-
define( 'DOING_CRON', true );
|
171 |
-
|
172 |
MainWP_Utility::handle_fatal_error();
|
173 |
MainWP_Utility::fix_for_custom_themes();
|
174 |
$this->call_function( $call_func );
|
175 |
} elseif ( isset( $_POST['function'] ) && $callable_no_auth ) {
|
176 |
|
177 |
-
|
178 |
-
* Checks whether cron is in progress.
|
179 |
-
*
|
180 |
-
* @const ( bool ) Default: true
|
181 |
-
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child_Callable.html
|
182 |
-
*/
|
183 |
-
define( 'DOING_CRON', true );
|
184 |
|
185 |
MainWP_Utility::fix_for_custom_themes();
|
186 |
$this->call_function_no_auth( $call_func );
|
160 |
|
161 |
// Fire off the called function.
|
162 |
if ( $auth && isset( $_POST['function'] ) && $callable ) {
|
163 |
+
MainWP_Helper::maybe_set_doing_cron();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
MainWP_Utility::handle_fatal_error();
|
165 |
MainWP_Utility::fix_for_custom_themes();
|
166 |
$this->call_function( $call_func );
|
167 |
} elseif ( isset( $_POST['function'] ) && $callable_no_auth ) {
|
168 |
|
169 |
+
MainWP_Helper::maybe_set_doing_cron();
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
MainWP_Utility::fix_for_custom_themes();
|
172 |
$this->call_function_no_auth( $call_func );
|
class/class-mainwp-child-plugins-check.php
CHANGED
@@ -162,7 +162,7 @@ class MainWP_Child_Plugins_Check {
|
|
162 |
* @throws \Exception Error message on failure.
|
163 |
*/
|
164 |
public function perform_watchdog() {
|
165 |
-
if (
|
166 |
$last_run = get_option( $this->option_name_last_daily_run );
|
167 |
|
168 |
if ( false === $last_run || ! is_integer( $last_run ) ) {
|
@@ -215,7 +215,7 @@ class MainWP_Child_Plugins_Check {
|
|
215 |
}
|
216 |
}
|
217 |
if ( $update ) {
|
218 |
-
set_transient( $this->tran_name_plugin_timestamps, $plugins_outdate,
|
219 |
}
|
220 |
|
221 |
return $plugins_outdate;
|
@@ -320,12 +320,12 @@ class MainWP_Child_Plugins_Check {
|
|
320 |
}
|
321 |
|
322 |
// Store the master response for usage in the plugin table.
|
323 |
-
set_transient( $this->tran_name_plugin_timestamps, $responses,
|
324 |
|
325 |
if ( 0 === count( $all_plugins ) ) {
|
326 |
delete_transient( $this->tran_name_plugins_to_batch );
|
327 |
} else {
|
328 |
-
set_transient( $this->tran_name_plugins_to_batch, $all_plugins,
|
329 |
wp_schedule_single_event( time(), $this->cron_name_batching );
|
330 |
}
|
331 |
}
|
162 |
* @throws \Exception Error message on failure.
|
163 |
*/
|
164 |
public function perform_watchdog() {
|
165 |
+
if ( ! wp_next_scheduled( $this->cron_name_batching ) ) {
|
166 |
$last_run = get_option( $this->option_name_last_daily_run );
|
167 |
|
168 |
if ( false === $last_run || ! is_integer( $last_run ) ) {
|
215 |
}
|
216 |
}
|
217 |
if ( $update ) {
|
218 |
+
set_transient( $this->tran_name_plugin_timestamps, $plugins_outdate, 2 * DAY_IN_SECONDS );
|
219 |
}
|
220 |
|
221 |
return $plugins_outdate;
|
320 |
}
|
321 |
|
322 |
// Store the master response for usage in the plugin table.
|
323 |
+
set_transient( $this->tran_name_plugin_timestamps, $responses, 2 * DAY_IN_SECONDS );
|
324 |
|
325 |
if ( 0 === count( $all_plugins ) ) {
|
326 |
delete_transient( $this->tran_name_plugins_to_batch );
|
327 |
} else {
|
328 |
+
set_transient( $this->tran_name_plugins_to_batch, $all_plugins, 2 * DAY_IN_SECONDS );
|
329 |
wp_schedule_single_event( time(), $this->cron_name_batching );
|
330 |
}
|
331 |
}
|
class/class-mainwp-child-themes-check.php
CHANGED
@@ -159,7 +159,7 @@ class MainWP_Child_Themes_Check {
|
|
159 |
* @throws \Exception Error message on failure.
|
160 |
*/
|
161 |
public function perform_watchdog() {
|
162 |
-
if (
|
163 |
$last_run = get_option( $this->option_name_last_daily_run );
|
164 |
if ( false === $last_run || ! is_integer( $last_run ) ) {
|
165 |
$last_run = false;
|
@@ -208,7 +208,7 @@ class MainWP_Child_Themes_Check {
|
|
208 |
}
|
209 |
}
|
210 |
if ( $update ) {
|
211 |
-
set_transient( $this->tran_name_theme_timestamps, $themes_outdate,
|
212 |
}
|
213 |
|
214 |
return $themes_outdate;
|
@@ -287,12 +287,12 @@ class MainWP_Child_Themes_Check {
|
|
287 |
}
|
288 |
|
289 |
// Store the master response for usage in the plugin table.
|
290 |
-
set_transient( $this->tran_name_theme_timestamps, $responses,
|
291 |
|
292 |
if ( 0 === count( $all_themes ) ) {
|
293 |
delete_transient( $this->tran_name_themes_to_batch );
|
294 |
} else {
|
295 |
-
set_transient( $this->tran_name_themes_to_batch, $all_themes,
|
296 |
wp_schedule_single_event( time(), $this->cron_name_batching );
|
297 |
|
298 |
}
|
159 |
* @throws \Exception Error message on failure.
|
160 |
*/
|
161 |
public function perform_watchdog() {
|
162 |
+
if ( ! wp_next_scheduled( $this->cron_name_batching ) ) {
|
163 |
$last_run = get_option( $this->option_name_last_daily_run );
|
164 |
if ( false === $last_run || ! is_integer( $last_run ) ) {
|
165 |
$last_run = false;
|
208 |
}
|
209 |
}
|
210 |
if ( $update ) {
|
211 |
+
set_transient( $this->tran_name_theme_timestamps, $themes_outdate, 2 * DAY_IN_SECONDS );
|
212 |
}
|
213 |
|
214 |
return $themes_outdate;
|
287 |
}
|
288 |
|
289 |
// Store the master response for usage in the plugin table.
|
290 |
+
set_transient( $this->tran_name_theme_timestamps, $responses, 2 * DAY_IN_SECONDS );
|
291 |
|
292 |
if ( 0 === count( $all_themes ) ) {
|
293 |
delete_transient( $this->tran_name_themes_to_batch );
|
294 |
} else {
|
295 |
+
set_transient( $this->tran_name_themes_to_batch, $all_themes, 2 * DAY_IN_SECONDS );
|
296 |
wp_schedule_single_event( time(), $this->cron_name_batching );
|
297 |
|
298 |
}
|
class/class-mainwp-child-updates.php
CHANGED
@@ -111,17 +111,7 @@ class MainWP_Child_Updates {
|
|
111 |
* @uses \MainWP\Child\MainWP_Helper::write()
|
112 |
*/
|
113 |
public function upgrade_plugin_theme() {
|
114 |
-
|
115 |
-
if ( ! defined( 'DOING_CRON' ) ) {
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Checks whether cron is in progress.
|
119 |
-
*
|
120 |
-
* @const ( bool ) Default: true
|
121 |
-
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child_Updates.html
|
122 |
-
*/
|
123 |
-
define( 'DOING_CRON', true );
|
124 |
-
}
|
125 |
|
126 |
MainWP_Helper::get_wp_filesystem();
|
127 |
|
@@ -1002,13 +992,7 @@ class MainWP_Child_Updates {
|
|
1002 |
* @uses \MainWP\Child\MainWP_Helper::write()
|
1003 |
*/
|
1004 |
public function upgrade_translation() {
|
1005 |
-
|
1006 |
-
* Checks whether cron is in progress.
|
1007 |
-
*
|
1008 |
-
* @const ( bool ) Default: true
|
1009 |
-
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child_Callable.html
|
1010 |
-
*/
|
1011 |
-
define( 'DOING_CRON', true );
|
1012 |
|
1013 |
MainWP_Helper::get_wp_filesystem();
|
1014 |
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
|
111 |
* @uses \MainWP\Child\MainWP_Helper::write()
|
112 |
*/
|
113 |
public function upgrade_plugin_theme() {
|
114 |
+
MainWP_Helper::maybe_set_doing_cron();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
MainWP_Helper::get_wp_filesystem();
|
117 |
|
992 |
* @uses \MainWP\Child\MainWP_Helper::write()
|
993 |
*/
|
994 |
public function upgrade_translation() {
|
995 |
+
MainWP_Helper::maybe_set_doing_cron();
|
|
|
|
|
|
|
|
|
|
|
|
|
996 |
|
997 |
MainWP_Helper::get_wp_filesystem();
|
998 |
include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php';
|
class/class-mainwp-child.php
CHANGED
@@ -33,7 +33,7 @@ class MainWP_Child {
|
|
33 |
*
|
34 |
* @var string MainWP Child plugin version.
|
35 |
*/
|
36 |
-
public static $version = '4.2.
|
37 |
|
38 |
/**
|
39 |
* Private variable containing the latest MainWP Child update version.
|
@@ -285,15 +285,7 @@ class MainWP_Child {
|
|
285 |
|
286 |
// Register does not require auth, so we register here.
|
287 |
if ( isset( $_POST['function'] ) && 'register' === $_POST['function'] ) {
|
288 |
-
|
289 |
-
/**
|
290 |
-
* Checks whether cron is in progress.
|
291 |
-
*
|
292 |
-
* @const ( bool ) Default: true
|
293 |
-
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child.html
|
294 |
-
*/
|
295 |
-
define( 'DOING_CRON', true );
|
296 |
-
|
297 |
MainWP_Utility::fix_for_custom_themes();
|
298 |
MainWP_Connect::instance()->register_site(); // register the site and exit.
|
299 |
}
|
33 |
*
|
34 |
* @var string MainWP Child plugin version.
|
35 |
*/
|
36 |
+
public static $version = '4.2.2';
|
37 |
|
38 |
/**
|
39 |
* Private variable containing the latest MainWP Child update version.
|
285 |
|
286 |
// Register does not require auth, so we register here.
|
287 |
if ( isset( $_POST['function'] ) && 'register' === $_POST['function'] ) {
|
288 |
+
MainWP_Helper::maybe_set_doing_cron();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
MainWP_Utility::fix_for_custom_themes();
|
290 |
MainWP_Connect::instance()->register_site(); // register the site and exit.
|
291 |
}
|
class/class-mainwp-helper.php
CHANGED
@@ -58,11 +58,11 @@ class MainWP_Helper {
|
|
58 |
public static function write( $value ) {
|
59 |
if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) :
|
60 |
$output = wp_json_encode( $value );
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
|
65 |
-
|
66 |
}
|
67 |
|
68 |
/**
|
@@ -750,6 +750,41 @@ class MainWP_Helper {
|
|
750 |
return function_exists( 'is_wpe' ) && is_wpe();
|
751 |
}
|
752 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
753 |
/**
|
754 |
* Method check_files_exists()
|
755 |
*
|
58 |
public static function write( $value ) {
|
59 |
if ( isset( $_REQUEST['json_result'] ) && true == $_REQUEST['json_result'] ) :
|
60 |
$output = wp_json_encode( $value );
|
61 |
+
else :
|
62 |
+
$output = serialize( $value ); // phpcs:ignore -- Required for backwards compatibility.
|
63 |
+
endif;
|
64 |
|
65 |
+
die( '<mainwp>' . base64_encode( $output ) . '</mainwp>' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for backwards compatibility.
|
66 |
}
|
67 |
|
68 |
/**
|
750 |
return function_exists( 'is_wpe' ) && is_wpe();
|
751 |
}
|
752 |
|
753 |
+
/**
|
754 |
+
* Method is_wp_engine_php8()
|
755 |
+
*
|
756 |
+
* Check if the child site is hosted on the WP Engine server and PHP8.
|
757 |
+
*
|
758 |
+
* @return bool true|false If the child site is hosted on the WP Engine and PHP8, return true, if not, return false.
|
759 |
+
*/
|
760 |
+
public static function is_wp_engine_php8() {
|
761 |
+
if ( self::is_wp_engine() && version_compare( phpversion(), '8.0', '>=' ) ) {
|
762 |
+
return true;
|
763 |
+
}
|
764 |
+
return false;
|
765 |
+
}
|
766 |
+
|
767 |
+
/**
|
768 |
+
* Method maybe_set_doing_cron()
|
769 |
+
*
|
770 |
+
* May be define doing cron.
|
771 |
+
*/
|
772 |
+
public static function maybe_set_doing_cron() {
|
773 |
+
if ( ! self::is_wp_engine_php8() ) {
|
774 |
+
// Prevent disable/re-enable.
|
775 |
+
if ( ! defined( 'DOING_CRON' ) ) {
|
776 |
+
/**
|
777 |
+
* Checks whether cron is in progress.
|
778 |
+
*
|
779 |
+
* @const ( bool ) Default: true
|
780 |
+
* @source https://code-reference.mainwp.com/classes/MainWP.Child.MainWP_Child_Updates.html
|
781 |
+
*/
|
782 |
+
define( 'DOING_CRON', true );
|
783 |
+
}
|
784 |
+
}
|
785 |
+
}
|
786 |
+
|
787 |
+
|
788 |
/**
|
789 |
* Method check_files_exists()
|
790 |
*
|
mainwp-child.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* Author: MainWP
|
13 |
* Author URI: https://mainwp.com
|
14 |
* Text Domain: mainwp-child
|
15 |
-
* Version: 4.2.
|
16 |
* Requires at least: 5.4
|
17 |
* Requires PHP: 7.0
|
18 |
*/
|
12 |
* Author: MainWP
|
13 |
* Author URI: https://mainwp.com
|
14 |
* Text Domain: mainwp-child
|
15 |
+
* Version: 4.2.2
|
16 |
* Requires at least: 5.4
|
17 |
* Requires PHP: 7.0
|
18 |
*/
|
readme.txt
CHANGED
@@ -5,9 +5,9 @@ Author: mainwp
|
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 5.4
|
8 |
-
Tested up to:
|
9 |
Requires PHP: 7.0
|
10 |
-
Stable tag: 4.2.
|
11 |
License: GPLv3 or later
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
@@ -111,6 +111,14 @@ Sure we have a quick FAQ with a lot more questions and answers [here](https://ma
|
|
111 |
|
112 |
== Changelog ==
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
= 4.2.1 - 4-14-2022 =
|
115 |
* Fixed: An issue with setting BackupBuddy plugin Settings
|
116 |
* Fixed: An issue with generating client reports on setups with large amount of data
|
5 |
Author URI: https://mainwp.com
|
6 |
Plugin URI: https://mainwp.com
|
7 |
Requires at least: 5.4
|
8 |
+
Tested up to: 6.0
|
9 |
Requires PHP: 7.0
|
10 |
+
Stable tag: 4.2.2
|
11 |
License: GPLv3 or later
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
111 |
|
112 |
== Changelog ==
|
113 |
|
114 |
+
= 4.2.2 - 5-10-2022 =
|
115 |
+
* Fixed: An issue with detecting abandoned plugins and themes on specific setups
|
116 |
+
* Fixed: An issue with running scheduled events on specific setups
|
117 |
+
* Added: Nginx Helper to the Purge Cache system
|
118 |
+
* Added: Nitropack to the Purge Cache system
|
119 |
+
* Added: Autoptimize to the Purge Cache system
|
120 |
+
* Updated: Tested up to tag to WP 6.0
|
121 |
+
|
122 |
= 4.2.1 - 4-14-2022 =
|
123 |
* Fixed: An issue with setting BackupBuddy plugin Settings
|
124 |
* Fixed: An issue with generating client reports on setups with large amount of data
|