Version Description
- 5-25-18 =
- Fixed: UpdraftPlus 1.14.10 compatibility issue that caused child sites to disconnect
- Added: support for the new MainWP Branding Extension option
- Updated: compatibility with the new Wordfence plugin version
- Updated: compatibility with the new WP Rocket plugin version
Download this release
Release Info
Developer | mainwp |
Plugin | MainWP Child |
Version | 3.4.7.1 |
Comparing to | |
See all releases |
Code changes from version 3.4.7 to 3.4.7.1
- class/class-mainwp-child-branding.php +12 -0
- class/class-mainwp-child-ithemes-security.php +15 -0
- class/class-mainwp-child-updraft-plus-backups.php +462 -20
- class/class-mainwp-child-wordfence.php +11 -1
- class/class-mainwp-child-wp-rocket.php +14 -4
- class/class-mainwp-child.php +18 -5
- class/class-mainwp-helper.php +12 -1
- mainwp-child.php +1 -1
- readme.txt +7 -1
class/class-mainwp-child-branding.php
CHANGED
@@ -132,6 +132,7 @@ class MainWP_Child_Branding {
|
|
132 |
'remove_widget_activity' => $settings['child_remove_widget_activity'],
|
133 |
'remove_widget_quick' => $settings['child_remove_widget_quick'],
|
134 |
'remove_widget_news' => $settings['child_remove_widget_news'],
|
|
|
135 |
'site_generator' => $settings['child_site_generator'],
|
136 |
'generator_link' => $settings['child_generator_link'],
|
137 |
'admin_css' => $settings['child_admin_css'],
|
@@ -339,6 +340,7 @@ class MainWP_Child_Branding {
|
|
339 |
add_action( 'login_enqueue_scripts', array( &$this, 'custom_login_css' ) );
|
340 |
add_filter( 'gettext', array( &$this, 'custom_gettext' ), 99, 3 );
|
341 |
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
|
|
|
342 |
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
343 |
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
344 |
//remove_filter( 'update_footer', 'core_update_footer' );
|
@@ -564,6 +566,16 @@ class MainWP_Child_Branding {
|
|
564 |
}
|
565 |
}
|
566 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
567 |
function custom_gettext( $translations, $text, $domain = 'default' ) {
|
568 |
$extra_setting = $this->settings['extra_settings'];
|
569 |
$texts_replace = $extra_setting['texts_replace'];
|
132 |
'remove_widget_activity' => $settings['child_remove_widget_activity'],
|
133 |
'remove_widget_quick' => $settings['child_remove_widget_quick'],
|
134 |
'remove_widget_news' => $settings['child_remove_widget_news'],
|
135 |
+
'login_image_link' => $settings['child_login_image_link'],
|
136 |
'site_generator' => $settings['child_site_generator'],
|
137 |
'generator_link' => $settings['child_generator_link'],
|
138 |
'admin_css' => $settings['child_admin_css'],
|
340 |
add_action( 'login_enqueue_scripts', array( &$this, 'custom_login_css' ) );
|
341 |
add_filter( 'gettext', array( &$this, 'custom_gettext' ), 99, 3 );
|
342 |
add_action( 'login_head', array( &$this, 'custom_login_logo' ) );
|
343 |
+
add_filter( 'login_headerurl', array( &$this, 'custom_login_headerurl' ) );
|
344 |
add_action( 'wp_head', array( &$this, 'custom_favicon_frontend' ) );
|
345 |
if ( isset( $extra_setting['dashboard_footer'] ) && ! empty( $extra_setting['dashboard_footer'] ) ) {
|
346 |
//remove_filter( 'update_footer', 'core_update_footer' );
|
566 |
}
|
567 |
}
|
568 |
|
569 |
+
function custom_login_headerurl( $value ) {
|
570 |
+
|
571 |
+
$extra_setting = $this->settings['extra_settings'];
|
572 |
+
if ( isset( $extra_setting['login_image_link'] ) && ! empty( $extra_setting['login_image_link'] ) ) {
|
573 |
+
return $extra_setting['login_image_link'];
|
574 |
+
}
|
575 |
+
|
576 |
+
return $value;
|
577 |
+
}
|
578 |
+
|
579 |
function custom_gettext( $translations, $text, $domain = 'default' ) {
|
580 |
$extra_setting = $this->settings['extra_settings'];
|
581 |
$texts_replace = $extra_setting['texts_replace'];
|
class/class-mainwp-child-ithemes-security.php
CHANGED
@@ -134,6 +134,11 @@ class MainWP_Child_iThemes_Security {
|
|
134 |
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
135 |
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
136 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
}
|
139 |
|
@@ -156,6 +161,16 @@ class MainWP_Child_iThemes_Security {
|
|
156 |
remove_menu_page( 'itsec' );
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
function save_settings() {
|
160 |
|
161 |
if ( ! class_exists( 'ITSEC_Lib' ) ) {
|
134 |
add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
|
135 |
add_action( 'admin_menu', array( $this, 'remove_menu' ) );
|
136 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
137 |
+
add_action( 'admin_head', array( &$this, 'custom_admin_css' ) );
|
138 |
+
if ( isset($_GET['page']) && ($_GET['page'] == 'itsec' || $_GET['page'] == 'itsec-logs' || $_GET['page'] == 'itsec-security-check') ) {
|
139 |
+
wp_redirect( get_option( 'siteurl' ) . '/wp-admin/index.php' );
|
140 |
+
exit();
|
141 |
+
}
|
142 |
}
|
143 |
}
|
144 |
|
161 |
remove_menu_page( 'itsec' );
|
162 |
}
|
163 |
|
164 |
+
function custom_admin_css() {
|
165 |
+
?>
|
166 |
+
<style type="text/css">
|
167 |
+
#wp-admin-bar-itsec_admin_bar_menu{
|
168 |
+
display: none !important;
|
169 |
+
}
|
170 |
+
</style>
|
171 |
+
<?php
|
172 |
+
}
|
173 |
+
|
174 |
function save_settings() {
|
175 |
|
176 |
if ( ! class_exists( 'ITSEC_Lib' ) ) {
|
class/class-mainwp-child-updraft-plus-backups.php
CHANGED
@@ -112,7 +112,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
112 |
case 'restore_alldownloaded':
|
113 |
$information = $this->restore_alldownloaded();
|
114 |
break;
|
115 |
-
case 'restorebackup':
|
116 |
$information = $this->restoreBackup();
|
117 |
break;
|
118 |
case 'extradbtestconnection':
|
@@ -1259,8 +1259,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1259 |
}
|
1260 |
|
1261 |
public function build_historystatus() {
|
1262 |
-
$backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
1263 |
-
$backup_history = ( is_array( $backup_history ) ) ? $backup_history : array();
|
|
|
|
|
1264 |
$output = $this->existing_backup_table( $backup_history );
|
1265 |
|
1266 |
if ( ! empty( $messages ) && is_array( $messages ) ) {
|
@@ -1285,8 +1287,9 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1285 |
$messages = $this->rebuildBackupHistory( $remotescan );
|
1286 |
}
|
1287 |
|
1288 |
-
$backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
1289 |
-
$backup_history = ( is_array( $backup_history ) ) ? $backup_history : array();
|
|
|
1290 |
$output = $this->existing_backup_table( $backup_history );
|
1291 |
|
1292 |
if ( ! empty( $messages ) && is_array( $messages ) ) {
|
@@ -1547,7 +1550,11 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1547 |
|
1548 |
if ( isset( $elements['db'] ) ) {
|
1549 |
// Analyse the header of the database file + display results
|
1550 |
-
|
|
|
|
|
|
|
|
|
1551 |
$mess = array_merge( $mess, $mess2 );
|
1552 |
$warn = array_merge( $warn, $warn2 );
|
1553 |
$err = array_merge( $err, $err2 );
|
@@ -1652,7 +1659,8 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1652 |
);
|
1653 |
}
|
1654 |
}
|
1655 |
-
|
|
|
1656 |
public function restoreBackup() {
|
1657 |
|
1658 |
global $updraftplus_admin, $updraftplus;
|
@@ -1699,13 +1707,15 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
1699 |
|
1700 |
}
|
1701 |
|
|
|
1702 |
// Return values: false = 'not yet' (not necessarily terminal); WP_Error = terminal failure; true = success
|
1703 |
private function restore_backup( $timestamp ) {
|
1704 |
|
1705 |
@set_time_limit( 900 );
|
1706 |
|
1707 |
global $wp_filesystem, $updraftplus;
|
1708 |
-
$backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
|
|
1709 |
if ( ! is_array( $backup_history[ $timestamp ] ) ) {
|
1710 |
echo wp_kses_post( '<p>' . esc_html__( 'This backup does not exist in the backup history - restoration aborted. Timestamp:', 'updraftplus' ) . " $timestamp</p><br/>" );
|
1711 |
|
@@ -2064,8 +2074,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
2064 |
|
2065 |
return true;
|
2066 |
}
|
2067 |
-
|
2068 |
-
|
2069 |
public function option_filter_template( $val ) {
|
2070 |
global $updraftplus;
|
2071 |
|
@@ -2201,7 +2210,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
2201 |
echo '<div class="updraftmessage ' . $class . '">' . "<p>$message</p></div>";
|
2202 |
}
|
2203 |
|
2204 |
-
private function
|
2205 |
|
2206 |
$mess = array();
|
2207 |
$warn = array();
|
@@ -2436,7 +2445,441 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
2436 |
|
2437 |
}
|
2438 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2439 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2440 |
private function gzopen_for_read( $file, &$warn, &$err ) {
|
2441 |
if ( ! function_exists( 'gzopen' ) || ! function_exists( 'gzread' ) ) {
|
2442 |
$missing = '';
|
@@ -2527,11 +2970,10 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|
2527 |
global $updraftplus;
|
2528 |
|
2529 |
if ( false === $backup_history ) {
|
2530 |
-
$backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
2531 |
-
|
2532 |
-
if ( ! is_array( $backup_history ) ) {
|
2533 |
-
$backup_history = array();
|
2534 |
}
|
|
|
2535 |
if ( empty( $backup_history ) ) {
|
2536 |
return '<p><em>' . __( 'You have not yet made any backups.', 'updraftplus' ) . '</em></p>';
|
2537 |
}
|
@@ -2607,10 +3049,12 @@ ENDHERE;
|
|
2607 |
|
2608 |
// Set a flag according to whether or not $backup['db'] ends in .crypt, then pick this up in the display of the decrypt field.
|
2609 |
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
|
2610 |
-
if (
|
|
|
|
|
2611 |
$entities .= '/dbcrypted=1/';
|
2612 |
}
|
2613 |
-
|
2614 |
$ret .= $this->download_db_button( 'db', $key, $esc_pretty_date, $nonce_field, $backup, $accept );
|
2615 |
} else {
|
2616 |
// $ret .= sprintf(_x('(No %s)','Message shown when no such object is available','updraftplus'), __('database', 'updraftplus'));
|
@@ -2679,9 +3123,7 @@ ENDHERE;
|
|
2679 |
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
2680 |
}
|
2681 |
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
2682 |
-
$ret .= '<button title="' . __( '
|
2683 |
-
jQuery('#updraft_restore_timestamp').val('$key'); jQuery('.updraft_restore_date').html('$show_data'); ";
|
2684 |
-
$ret .= "mwp_updraft_restore_stage = 1; jQuery('#mwp-updraft-restore-modal').dialog('open'); jQuery('#mwp-updraft-restore-modal-stage1').show();jQuery('#mwp-updraft-restore-modal-stage2').hide(); jQuery('#mwp-updraft-restore-modal-stage2a').html(''); mainwp_updraft_activejobs_update(true);\">" . __( 'Restore', 'updraftplus' ) . '</button>';
|
2685 |
}
|
2686 |
$ret .= "</form></div>\n";
|
2687 |
|
112 |
case 'restore_alldownloaded':
|
113 |
$information = $this->restore_alldownloaded();
|
114 |
break;
|
115 |
+
case 'restorebackup': // not used
|
116 |
$information = $this->restoreBackup();
|
117 |
break;
|
118 |
case 'extradbtestconnection':
|
1259 |
}
|
1260 |
|
1261 |
public function build_historystatus() {
|
1262 |
+
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
1263 |
+
// $backup_history = ( is_array( $backup_history ) ) ? $backup_history : array();
|
1264 |
+
$backup_history = UpdraftPlus_Backup_History::get_history();
|
1265 |
+
|
1266 |
$output = $this->existing_backup_table( $backup_history );
|
1267 |
|
1268 |
if ( ! empty( $messages ) && is_array( $messages ) ) {
|
1287 |
$messages = $this->rebuildBackupHistory( $remotescan );
|
1288 |
}
|
1289 |
|
1290 |
+
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
1291 |
+
// $backup_history = ( is_array( $backup_history ) ) ? $backup_history : array();
|
1292 |
+
$backup_history = UpdraftPlus_Backup_History::get_history();
|
1293 |
$output = $this->existing_backup_table( $backup_history );
|
1294 |
|
1295 |
if ( ! empty( $messages ) && is_array( $messages ) ) {
|
1550 |
|
1551 |
if ( isset( $elements['db'] ) ) {
|
1552 |
// Analyse the header of the database file + display results
|
1553 |
+
if ( class_exists( 'UpdraftPlus_Encryption' )) {
|
1554 |
+
list ( $mess2, $warn2, $err2, $info ) = $updraftplus->analyse_db_file( $timestamp, $res );
|
1555 |
+
} else {
|
1556 |
+
list ( $mess2, $warn2, $err2, $info ) = $this->analyse_db_file_old( $timestamp, $res );
|
1557 |
+
}
|
1558 |
$mess = array_merge( $mess, $mess2 );
|
1559 |
$warn = array_merge( $warn, $warn2 );
|
1560 |
$err = array_merge( $err, $err2 );
|
1659 |
);
|
1660 |
}
|
1661 |
}
|
1662 |
+
|
1663 |
+
// not used
|
1664 |
public function restoreBackup() {
|
1665 |
|
1666 |
global $updraftplus_admin, $updraftplus;
|
1707 |
|
1708 |
}
|
1709 |
|
1710 |
+
// not used
|
1711 |
// Return values: false = 'not yet' (not necessarily terminal); WP_Error = terminal failure; true = success
|
1712 |
private function restore_backup( $timestamp ) {
|
1713 |
|
1714 |
@set_time_limit( 900 );
|
1715 |
|
1716 |
global $wp_filesystem, $updraftplus;
|
1717 |
+
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
1718 |
+
$backup_history = UpdraftPlus_Backup_History::get_history();
|
1719 |
if ( ! is_array( $backup_history[ $timestamp ] ) ) {
|
1720 |
echo wp_kses_post( '<p>' . esc_html__( 'This backup does not exist in the backup history - restoration aborted. Timestamp:', 'updraftplus' ) . " $timestamp</p><br/>" );
|
1721 |
|
2074 |
|
2075 |
return true;
|
2076 |
}
|
2077 |
+
|
|
|
2078 |
public function option_filter_template( $val ) {
|
2079 |
global $updraftplus;
|
2080 |
|
2210 |
echo '<div class="updraftmessage ' . $class . '">' . "<p>$message</p></div>";
|
2211 |
}
|
2212 |
|
2213 |
+
private function analyse_db_file_old( $timestamp, $res, $db_file = false, $header_only = false ) {
|
2214 |
|
2215 |
$mess = array();
|
2216 |
$warn = array();
|
2445 |
|
2446 |
}
|
2447 |
|
2448 |
+
|
2449 |
+
public function analyse_db_file($timestamp, $res, $db_file = false, $header_only = false) {
|
2450 |
+
global $updraftplus;
|
2451 |
+
|
2452 |
+
$mess = array();
|
2453 |
+
$warn = array();
|
2454 |
+
$err = array();
|
2455 |
+
$info = array();
|
2456 |
+
$wp_version = $updraftplus->get_wordpress_version();
|
2457 |
+
global $wpdb;
|
2458 |
+
|
2459 |
+
$updraft_dir = $updraftplus->backups_dir_location();
|
2460 |
+
|
2461 |
+
if (false === $db_file) {
|
2462 |
+
// This attempts to raise the maximum packet size. This can't be done within the session, only globally. Therefore, it has to be done before the session starts; in our case, during the pre-analysis.
|
2463 |
+
$updraftplus->get_max_packet_size();
|
2464 |
+
|
2465 |
+
$backup = UpdraftPlus_Backup_History::get_history($timestamp);
|
2466 |
+
if (!isset($backup['nonce']) || !isset($backup['db'])) return array($mess, $warn, $err, $info);
|
2467 |
+
|
2468 |
+
$db_file = (is_string($backup['db'])) ? $updraft_dir.'/'.$backup['db'] : $updraft_dir.'/'.$backup['db'][0];
|
2469 |
+
}
|
2470 |
+
|
2471 |
+
if (!is_readable($db_file)) return array($mess, $warn, $err, $info);
|
2472 |
+
|
2473 |
+
// Encrypted - decrypt it
|
2474 |
+
if (UpdraftPlus_Encryption::is_file_encrypted($db_file)) {
|
2475 |
+
|
2476 |
+
$encryption = empty($res['updraft_encryptionphrase']) ? UpdraftPlus_Options::get_updraft_option('updraft_encryptionphrase') : $res['updraft_encryptionphrase'];
|
2477 |
+
|
2478 |
+
if (!$encryption) {
|
2479 |
+
if (class_exists('UpdraftPlus_Addon_MoreDatabase')) {
|
2480 |
+
$err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted, but you have no encryption key entered.', 'updraftplus'));
|
2481 |
+
} else {
|
2482 |
+
$err[] = sprintf(__('Error: %s', 'updraftplus'), __('Decryption failed. The database file is encrypted.', 'updraftplus'));
|
2483 |
+
}
|
2484 |
+
return array($mess, $warn, $err, $info);
|
2485 |
+
}
|
2486 |
+
|
2487 |
+
$decrypted_file = UpdraftPlus_Encryption::decrypt($db_file, $encryption);
|
2488 |
+
|
2489 |
+
if (is_array($decrypted_file)) {
|
2490 |
+
$db_file = $decrypted_file['fullpath'];
|
2491 |
+
} else {
|
2492 |
+
$err[] = __('Decryption failed. The most likely cause is that you used the wrong key.', 'updraftplus');
|
2493 |
+
return array($mess, $warn, $err, $info);
|
2494 |
+
}
|
2495 |
+
}
|
2496 |
+
|
2497 |
+
// Even the empty schema when gzipped comes to 1565 bytes; a blank WP 3.6 install at 5158. But we go low, in case someone wants to share single tables.
|
2498 |
+
if (filesize($db_file) < 1000) {
|
2499 |
+
$err[] = sprintf(__('The database is too small to be a valid WordPress database (size: %s Kb).', 'updraftplus'), round(filesize($db_file)/1024, 1));
|
2500 |
+
return array($mess, $warn, $err, $info);
|
2501 |
+
}
|
2502 |
+
|
2503 |
+
$is_plain = ('.gz' == substr($db_file, -3, 3)) ? false : true;
|
2504 |
+
|
2505 |
+
$dbhandle = ($is_plain) ? fopen($db_file, 'r') : $this->gzopen_for_read($db_file, $warn, $err);
|
2506 |
+
if (!is_resource($dbhandle)) {
|
2507 |
+
$err[] = __('Failed to open database file.', 'updraftplus');
|
2508 |
+
return array($mess, $warn, $err, $info);
|
2509 |
+
}
|
2510 |
+
|
2511 |
+
$info['timestamp'] = $timestamp;
|
2512 |
+
|
2513 |
+
// Analyse the file, print the results.
|
2514 |
+
|
2515 |
+
$line = 0;
|
2516 |
+
$old_siteurl = '';
|
2517 |
+
$old_home = '';
|
2518 |
+
$old_table_prefix = '';
|
2519 |
+
$old_siteinfo = array();
|
2520 |
+
$gathering_siteinfo = true;
|
2521 |
+
$old_wp_version = '';
|
2522 |
+
$old_php_version = '';
|
2523 |
+
|
2524 |
+
$tables_found = array();
|
2525 |
+
$db_charsets_found = array();
|
2526 |
+
|
2527 |
+
// TODO: If the backup is the right size/checksum, then we could restore the $line <= 100 in the 'while' condition and not bother scanning the whole thing? Or better: sort the core tables to be first so that this usually terminates early
|
2528 |
+
|
2529 |
+
$wanted_tables = array('terms', 'term_taxonomy', 'term_relationships', 'commentmeta', 'comments', 'links', 'options', 'postmeta', 'posts', 'users', 'usermeta');
|
2530 |
+
|
2531 |
+
$migration_warning = false;
|
2532 |
+
$processing_create = false;
|
2533 |
+
$db_version = $wpdb->db_version();
|
2534 |
+
|
2535 |
+
// Don't set too high - we want a timely response returned to the browser
|
2536 |
+
// Until April 2015, this was always 90. But we've seen a few people with ~1GB databases (uncompressed), and 90s is not enough. Note that we don't bother checking here if it's compressed - having a too-large timeout when unexpected is harmless, as it won't be hit. On very large dbs, they're expecting it to take a while.
|
2537 |
+
// "120 or 240" is a first attempt at something more useful than just fixed at 90 - but should be sufficient (as 90 was for everyone without ~1GB databases)
|
2538 |
+
$default_dbscan_timeout = (filesize($db_file) < 31457280) ? 120 : 240;
|
2539 |
+
$dbscan_timeout = (defined('UPDRAFTPLUS_DBSCAN_TIMEOUT') && is_numeric(UPDRAFTPLUS_DBSCAN_TIMEOUT)) ? UPDRAFTPLUS_DBSCAN_TIMEOUT : $default_dbscan_timeout;
|
2540 |
+
@set_time_limit($dbscan_timeout);
|
2541 |
+
|
2542 |
+
// We limit the time that we spend scanning the file for character sets
|
2543 |
+
$db_charset_collate_scan_timeout = (defined('UPDRAFTPLUS_DB_CHARSET_COLLATE_SCAN_TIMEOUT') && is_numeric(UPDRAFTPLUS_DB_CHARSET_COLLATE_SCAN_TIMEOUT)) ? UPDRAFTPLUS_DB_CHARSET_COLLATE_SCAN_TIMEOUT : 10;
|
2544 |
+
$charset_scan_start_time = microtime(true);
|
2545 |
+
$db_supported_character_sets_res = $GLOBALS['wpdb']->get_results('SHOW CHARACTER SET', OBJECT_K);
|
2546 |
+
$db_supported_character_sets = (null !== $db_supported_character_sets_res) ? $db_supported_character_sets_res : array();
|
2547 |
+
$db_charsets_found = array();
|
2548 |
+
$db_supported_collations_res = $GLOBALS['wpdb']->get_results('SHOW COLLATION', OBJECT_K);
|
2549 |
+
$db_supported_collations = (null !== $db_supported_collations_res) ? $db_supported_collations_res : array();
|
2550 |
+
$db_charsets_found = array();
|
2551 |
+
$db_collates_found = array();
|
2552 |
+
$db_supported_charset_related_to_unsupported_collation = false;
|
2553 |
+
$db_supported_charsets_related_to_unsupported_collations = array();
|
2554 |
+
while ((($is_plain && !feof($dbhandle)) || (!$is_plain && !gzeof($dbhandle))) && ($line<100 || (!$header_only && count($wanted_tables)>0) || ((microtime(true) - $charset_scan_start_time) < $db_charset_collate_scan_timeout && !empty($db_supported_character_sets)))) {
|
2555 |
+
$line++;
|
2556 |
+
// Up to 1MB
|
2557 |
+
$buffer = ($is_plain) ? rtrim(fgets($dbhandle, 1048576)) : rtrim(gzgets($dbhandle, 1048576));
|
2558 |
+
// Comments are what we are interested in
|
2559 |
+
if (substr($buffer, 0, 1) == '#') {
|
2560 |
+
$processing_create = false;
|
2561 |
+
if ('' == $old_siteurl && preg_match('/^\# Backup of: (http(.*))$/', $buffer, $matches)) {
|
2562 |
+
$old_siteurl = untrailingslashit($matches[1]);
|
2563 |
+
$mess[] = __('Backup of:', 'updraftplus').' '.htmlspecialchars($old_siteurl).((!empty($old_wp_version)) ? ' '.sprintf(__('(version: %s)', 'updraftplus'), $old_wp_version) : '');
|
2564 |
+
// Check for should-be migration
|
2565 |
+
if (untrailingslashit(site_url()) != $old_siteurl) {
|
2566 |
+
if (!$migration_warning) {
|
2567 |
+
$migration_warning = true;
|
2568 |
+
$info['migration'] = true;
|
2569 |
+
// && !class_exists('UpdraftPlus_Addons_Migrator')
|
2570 |
+
if (UpdraftPlus_Manipulation_Functions::normalise_url($old_siteurl) == UpdraftPlus_Manipulation_Functions::normalise_url(site_url())) {
|
2571 |
+
// Same site migration with only http/https difference
|
2572 |
+
$info['same_url'] = false;
|
2573 |
+
$old_siteurl_parsed = parse_url($old_siteurl);
|
2574 |
+
$actual_siteurl_parsed = parse_url(site_url());
|
2575 |
+
if ((stripos($old_siteurl_parsed['host'], 'www.') === 0 && stripos($actual_siteurl_parsed['host'], 'www.') !== 0) || (stripos($old_siteurl_parsed['host'], 'www.') !== 0 && stripos($actual_siteurl_parsed['host'], 'www.') === 0)) {
|
2576 |
+
$powarn = sprintf(__('The website address in the backup set (%s) is slightly different from that of the site now (%s). This is not expected to be a problem for restoring the site, as long as visits to the former address still reach the site.', 'updraftplus'), $old_siteurl, site_url()).' ';
|
2577 |
+
} else {
|
2578 |
+
$powarn = '';
|
2579 |
+
}
|
2580 |
+
if (('https' == $old_siteurl_parsed['scheme'] && 'http' == $actual_siteurl_parsed['scheme']) || ('http' == $old_siteurl_parsed['scheme'] && 'https' == $actual_siteurl_parsed['scheme'])) {
|
2581 |
+
$powarn .= sprintf(__('This backup set is of this site, but at the time of the backup you were using %s, whereas the site now uses %s.', 'updraftplus'), $old_siteurl_parsed['scheme'], $actual_siteurl_parsed['scheme']);
|
2582 |
+
if ('https' == $old_siteurl_parsed['scheme']) {
|
2583 |
+
$powarn .= ' '.apply_filters('updraftplus_https_to_http_additional_warning', sprintf(__('This restoration will work if you still have an SSL certificate (i.e. can use https) to access the site. Otherwise, you will want to use %s to search/replace the site address so that the site can be visited without https.', 'updraftplus'), '<a href="https://updraftplus.com/shop/migrator/">'.__('the migrator add-on', 'updraftplus').'</a>'));
|
2584 |
+
} else {
|
2585 |
+
$powarn .= ' '.apply_filters('updraftplus_http_to_https_additional_warning', sprintf(__('As long as your web hosting allows http (i.e. non-SSL access) or will forward requests to https (which is almost always the case), this is no problem. If that is not yet set up, then you should set it up, or use %s so that the non-https links are automatically replaced.', 'updraftplus'), apply_filters('updraftplus_migrator_addon_link', '<a href="https://updraftplus.com/shop/migrator/">'.__('the migrator add-on', 'updraftplus').'</a>')));
|
2586 |
+
}
|
2587 |
+
} else {
|
2588 |
+
$powarn .= apply_filters('updraftplus_dbscan_urlchange_www_append_warning', '');
|
2589 |
+
}
|
2590 |
+
$warn[] = $powarn;
|
2591 |
+
} else {
|
2592 |
+
// For completely different site migration
|
2593 |
+
$info['same_url'] = false;
|
2594 |
+
$warn[] = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">'.__('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus').'</a>', $old_siteurl, $res);
|
2595 |
+
}
|
2596 |
+
if (!class_exists('UpdraftPlus_Addons_Migrator')) {
|
2597 |
+
$warn[] .= '<strong><a href="'.apply_filters('updraftplus_com_link', "https://updraftplus.com/faqs/tell-me-more-about-the-search-and-replace-site-location-in-the-database-option/").'">'.__('You can search and replace your database (for migrating a website to a new location/URL) with the Migrator add-on - follow this link for more information', 'updraftplus').'</a></strong>';
|
2598 |
+
}
|
2599 |
+
}
|
2600 |
+
|
2601 |
+
if ($updraftplus->mod_rewrite_unavailable(false)) {
|
2602 |
+
$warn[] = sprintf(__('You are using the %s webserver, but do not seem to have the %s module loaded.', 'updraftplus'), 'Apache', 'mod_rewrite').' '.sprintf(__('You should enable %s to make any pretty permalinks (e.g. %s) work', 'updraftplus'), 'mod_rewrite', 'http://example.com/my-page/');
|
2603 |
+
}
|
2604 |
+
|
2605 |
+
} else {
|
2606 |
+
// For exactly same URL site restoration
|
2607 |
+
$info['same_url'] = true;
|
2608 |
+
}
|
2609 |
+
} elseif ('' == $old_home && preg_match('/^\# Home URL: (http(.*))$/', $buffer, $matches)) {
|
2610 |
+
$old_home = untrailingslashit($matches[1]);
|
2611 |
+
// Check for should-be migration
|
2612 |
+
if (!$migration_warning && home_url() != $old_home) {
|
2613 |
+
$migration_warning = true;
|
2614 |
+
$powarn = apply_filters('updraftplus_dbscan_urlchange', '<a href="https://updraftplus.com/shop/migrator/">'.__('This backup set is from a different site - this is not a restoration, but a migration. You need the Migrator add-on in order to make this work.', 'updraftplus').'</a>', $old_home, $res);
|
2615 |
+
if (!empty($powarn)) $warn[] = $powarn;
|
2616 |
+
}
|
2617 |
+
} elseif (!isset($info['created_by_version']) && preg_match('/^\# Created by UpdraftPlus version ([\d\.]+)/', $buffer, $matches)) {
|
2618 |
+
$info['created_by_version'] = trim($matches[1]);
|
2619 |
+
} elseif ('' == $old_wp_version && preg_match('/^\# WordPress Version: ([0-9]+(\.[0-9]+)+)(-[-a-z0-9]+,)?(.*)$/', $buffer, $matches)) {
|
2620 |
+
$old_wp_version = $matches[1];
|
2621 |
+
if (!empty($matches[3])) $old_wp_version .= substr($matches[3], 0, strlen($matches[3])-1);
|
2622 |
+
if (version_compare($old_wp_version, $wp_version, '>')) {
|
2623 |
+
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
2624 |
+
$warn[] = sprintf(__('You are importing from a newer version of WordPress (%s) into an older one (%s). There are no guarantees that WordPress can handle this.', 'updraftplus'), $old_wp_version, $wp_version);
|
2625 |
+
}
|
2626 |
+
if (preg_match('/running on PHP ([0-9]+\.[0-9]+)(\s|\.)/', $matches[4], $nmatches) && preg_match('/^([0-9]+\.[0-9]+)(\s|\.)/', PHP_VERSION, $cmatches)) {
|
2627 |
+
$old_php_version = $nmatches[1];
|
2628 |
+
$current_php_version = $cmatches[1];
|
2629 |
+
if (version_compare($old_php_version, $current_php_version, '>')) {
|
2630 |
+
// $mess[] = sprintf(__('%s version: %s', 'updraftplus'), 'WordPress', $old_wp_version);
|
2631 |
+
$warn[] = sprintf(__('The site in this backup was running on a webserver with version %s of %s. ', 'updraftplus'), $old_php_version, 'PHP').' '.sprintf(__('This is significantly newer than the server which you are now restoring onto (version %s).', 'updraftplus'), PHP_VERSION).' '.sprintf(__('You should only proceed if you cannot update the current server and are confident (or willing to risk) that your plugins/themes/etc. are compatible with the older %s version.', 'updraftplus'), 'PHP').' '.sprintf(__('Any support requests to do with %s should be raised with your web hosting company.', 'updraftplus'), 'PHP');
|
2632 |
+
}
|
2633 |
+
}
|
2634 |
+
} elseif ('' == $old_table_prefix && (preg_match('/^\# Table prefix: (\S+)$/', $buffer, $matches) || preg_match('/^-- Table prefix: (\S+)$/i', $buffer, $matches))) {
|
2635 |
+
$old_table_prefix = $matches[1];
|
2636 |
+
// echo '<strong>'.__('Old table prefix:', 'updraftplus').'</strong> '.htmlspecialchars($old_table_prefix).'<br>';
|
2637 |
+
} elseif (empty($info['label']) && preg_match('/^\# Label: (.*)$/', $buffer, $matches)) {
|
2638 |
+
$info['label'] = $matches[1];
|
2639 |
+
$mess[] = __('Backup label:', 'updraftplus').' '.htmlspecialchars($info['label']);
|
2640 |
+
} elseif ($gathering_siteinfo && preg_match('/^\# Site info: (\S+)$/', $buffer, $matches)) {
|
2641 |
+
if ('end' == $matches[1]) {
|
2642 |
+
$gathering_siteinfo = false;
|
2643 |
+
// Sanity checks
|
2644 |
+
if (isset($old_siteinfo['multisite']) && !$old_siteinfo['multisite'] && is_multisite()) {
|
2645 |
+
// Just need to check that you're crazy
|
2646 |
+
// if (!defined('UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE') || !UPDRAFTPLUS_EXPERIMENTAL_IMPORTINTOMULTISITE) {
|
2647 |
+
// $err[] = sprintf(__('Error: %s', 'updraftplus'), __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus'));
|
2648 |
+
// return array($mess, $warn, $err, $info);
|
2649 |
+
// } else {
|
2650 |
+
$warn[] = __('You are running on WordPress multisite - but your backup is not of a multisite site.', 'updraftplus').' '.__('It will be imported as a new site.', 'updraftplus').' <a href="https://updraftplus.com/information-on-importing-a-single-site-wordpress-backup-into-a-wordpress-network-i-e-multisite/">'.__('Please read this link for important information on this process.', 'updraftplus').'</a>';
|
2651 |
+
// }
|
2652 |
+
// Got the needed code?
|
2653 |
+
if (!class_exists('UpdraftPlusAddOn_MultiSite') || !class_exists('UpdraftPlus_Addons_Migrator')) {
|
2654 |
+
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('To import an ordinary WordPress site into a multisite installation requires %s.', 'updraftplus'), 'UpdraftPlus Premium'));
|
2655 |
+
return array($mess, $warn, $err, $info);
|
2656 |
+
}
|
2657 |
+
} elseif (isset($old_siteinfo['multisite']) && $old_siteinfo['multisite'] && !is_multisite()) {
|
2658 |
+
$warn[] = __('Warning:', 'updraftplus').' '.__('Your backup is of a WordPress multisite install; but this site is not. Only the first site of the network will be accessible.', 'updraftplus').' <a href="https://codex.wordpress.org/Create_A_Network">'.__('If you want to restore a multisite backup, you should first set up your WordPress installation as a multisite.', 'updraftplus').'</a>';
|
2659 |
+
}
|
2660 |
+
} elseif (preg_match('/^([^=]+)=(.*)$/', $matches[1], $kvmatches)) {
|
2661 |
+
$key = $kvmatches[1];
|
2662 |
+
$val = $kvmatches[2];
|
2663 |
+
if ('multisite' == $key) {
|
2664 |
+
$info['multisite'] = $val ? true : false;
|
2665 |
+
if ($val) $mess[] = '<strong>'.__('Site information:', 'updraftplus').'</strong> '.'backup is of a WordPress Network';
|
2666 |
+
}
|
2667 |
+
$old_siteinfo[$key] = $val;
|
2668 |
+
}
|
2669 |
+
} elseif (preg_match('/^\# Skipped tables: (.*)$/', $buffer, $matches)) {
|
2670 |
+
$skipped_tables = explode(',', $matches[1]);
|
2671 |
+
}
|
2672 |
+
|
2673 |
+
} elseif (preg_match('/^\s*create table \`?([^\`\(]*)\`?\s*\(/i', $buffer, $matches)) {
|
2674 |
+
$table = $matches[1];
|
2675 |
+
$tables_found[] = $table;
|
2676 |
+
if ($old_table_prefix) {
|
2677 |
+
// Remove prefix
|
2678 |
+
$table = UpdraftPlus_Manipulation_Functions::str_replace_once($old_table_prefix, '', $table);
|
2679 |
+
if (in_array($table, $wanted_tables)) {
|
2680 |
+
$wanted_tables = array_diff($wanted_tables, array($table));
|
2681 |
+
}
|
2682 |
+
}
|
2683 |
+
if (';' != substr($buffer, -1, 1)) {
|
2684 |
+
$processing_create = true;
|
2685 |
+
$db_supported_charset_related_to_unsupported_collation = true;
|
2686 |
+
}
|
2687 |
+
} elseif ($processing_create) {
|
2688 |
+
if (!empty($db_supported_collations)) {
|
2689 |
+
if (preg_match('/ COLLATE=([^\s;]+)/i', $buffer, $collate_match)) {
|
2690 |
+
$db_collates_found[] = $collate_match[1];
|
2691 |
+
if (!isset($db_supported_collations[$collate_match[1]])) {
|
2692 |
+
$db_supported_charset_related_to_unsupported_collation = true;
|
2693 |
+
}
|
2694 |
+
}
|
2695 |
+
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+),/i', $buffer, $collate_match)) {
|
2696 |
+
$db_collates_found[] = $collate_match[1];
|
2697 |
+
if (!isset($db_supported_collations[$collate_match[1]])) {
|
2698 |
+
$db_supported_charset_related_to_unsupported_collation = true;
|
2699 |
+
}
|
2700 |
+
}
|
2701 |
+
if (preg_match('/ COLLATE ([a-zA-Z0-9._-]+) /i', $buffer, $collate_match)) {
|
2702 |
+
$db_collates_found[] = $collate_match[1];
|
2703 |
+
if (!isset($db_supported_collations[$collate_match[1]])) {
|
2704 |
+
$db_supported_charset_related_to_unsupported_collation = true;
|
2705 |
+
}
|
2706 |
+
}
|
2707 |
+
}
|
2708 |
+
if (!empty($db_supported_character_sets)) {
|
2709 |
+
if (preg_match('/ CHARSET=([^\s;]+)/i', $buffer, $charset_match)) {
|
2710 |
+
$db_charsets_found[] = $charset_match[1];
|
2711 |
+
if ($db_supported_charset_related_to_unsupported_collation && !in_array($charset_match[1], $db_supported_charsets_related_to_unsupported_collations)) {
|
2712 |
+
$db_supported_charsets_related_to_unsupported_collations[] = $charset_match[1];
|
2713 |
+
}
|
2714 |
+
}
|
2715 |
+
}
|
2716 |
+
if (';' == substr($buffer, -1, 1)) {
|
2717 |
+
$processing_create = false;
|
2718 |
+
$db_supported_charset_related_to_unsupported_collation = false;
|
2719 |
+
}
|
2720 |
+
static $mysql_version_warned = false;
|
2721 |
+
if (!$mysql_version_warned && version_compare($db_version, '5.2.0', '<') && preg_match('/(CHARSET|COLLATE)[= ]utf8mb4/', $buffer)) {
|
2722 |
+
$mysql_version_warned = true;
|
2723 |
+
$err[] = sprintf(__('Error: %s', 'updraftplus'), sprintf(__('The database backup uses MySQL features not available in the old MySQL version (%s) that this site is running on.', 'updraftplus'), $db_version).' '.__('You must upgrade MySQL to be able to use this database.', 'updraftplus'));
|
2724 |
+
}
|
2725 |
+
}
|
2726 |
+
}
|
2727 |
+
if ($is_plain) {
|
2728 |
+
@fclose($dbhandle);
|
2729 |
+
} else {
|
2730 |
+
@gzclose($dbhandle);
|
2731 |
+
}
|
2732 |
+
if (!empty($db_supported_character_sets)) {
|
2733 |
+
$db_charsets_found_unique = array_unique($db_charsets_found);
|
2734 |
+
$db_unsupported_charset = array();
|
2735 |
+
$db_charset_forbidden = false;
|
2736 |
+
foreach ($db_charsets_found_unique as $db_charset) {
|
2737 |
+
if (!isset($db_supported_character_sets[$db_charset])) {
|
2738 |
+
$db_unsupported_charset[] = $db_charset;
|
2739 |
+
$db_charset_forbidden = true;
|
2740 |
+
}
|
2741 |
+
}
|
2742 |
+
if ($db_charset_forbidden) {
|
2743 |
+
$db_unsupported_charset_unique = array_unique($db_unsupported_charset);
|
2744 |
+
$warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the character set (%s) which you are trying to import.", "The database server that this WordPress site is running on doesn't support the character sets (%s) which you are trying to import.", count($db_unsupported_charset_unique), 'updraftplus'), implode(', ', $db_unsupported_charset_unique)).' '.__('You can choose another suitable character set instead and continue with the restoration at your own risk.', 'updraftplus').' <a target="_blank" href="https://updraftplus.com/faqs/implications-changing-tables-character-set/">'.__('Go here for more information.', 'updraftplus').'</a>'.' <a target="_blank" href="https://updraftplus.com/faqs/implications-changing-tables-character-set/">'.__('Go here for more information.', 'updraftplus').'</a>';
|
2745 |
+
$db_supported_character_sets = array_keys($db_supported_character_sets);
|
2746 |
+
$similar_type_charset = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_charset_unique, $db_supported_character_sets, true);
|
2747 |
+
if (empty($similar_type_charset)) {
|
2748 |
+
$row = $GLOBALS['wpdb']->get_row('show variables like "character_set_database"');
|
2749 |
+
$similar_type_charset = (null !== $row) ? $row->Value : '';
|
2750 |
+
}
|
2751 |
+
if (empty($similar_type_charset) && !empty($db_supported_character_sets[0])) {
|
2752 |
+
$similar_type_charset = $db_supported_character_sets[0];
|
2753 |
+
}
|
2754 |
+
$charset_select_html = '<label>'.__('Your chosen character set to use instead:', 'updraftplus').'</label> ';
|
2755 |
+
$charset_select_html .= '<select name="updraft_restorer_charset" id="updraft_restorer_charset">';
|
2756 |
+
if (is_array($db_supported_character_sets)) {
|
2757 |
+
foreach ($db_supported_character_sets as $character_set) {
|
2758 |
+
$charset_select_html .= '<option value="'.esc_attr($character_set).'" '.selected($character_set, $similar_type_charset, false).'>'.esc_html($character_set).'</option>';
|
2759 |
+
}
|
2760 |
+
}
|
2761 |
+
$charset_select_html .= '</select>';
|
2762 |
+
if (empty($info['addui'])) $info['addui'] = '';
|
2763 |
+
$info['addui'] .= $charset_select_html;
|
2764 |
+
}
|
2765 |
+
}
|
2766 |
+
if (!empty($db_supported_collations)) {
|
2767 |
+
$db_collates_found_unique = array_unique($db_collates_found);
|
2768 |
+
$db_unsupported_collate = array();
|
2769 |
+
$db_collate_forbidden = false;
|
2770 |
+
foreach ($db_collates_found_unique as $db_collate) {
|
2771 |
+
if (!isset($db_supported_collations[$db_collate])) {
|
2772 |
+
$db_unsupported_collate[] = $db_collate;
|
2773 |
+
$db_collate_forbidden = true;
|
2774 |
+
}
|
2775 |
+
}
|
2776 |
+
if ($db_collate_forbidden) {
|
2777 |
+
$db_unsupported_collate_unique = array_unique($db_unsupported_collate);
|
2778 |
+
$warn[] = sprintf(_n("The database server that this WordPress site is running on doesn't support the collation (%s) used in the database which you are trying to import.", "The database server that this WordPress site is running on doesn't support multiple collations (%s) used in the database which you are trying to import.", count($db_unsupported_collate_unique), 'updraftplus'), implode(', ', $db_unsupported_collate_unique)).' '.__('You can choose another suitable collation instead and continue with the restoration (at your own risk).', 'updraftplus');
|
2779 |
+
$similar_type_collate = '';
|
2780 |
+
if ($db_charset_forbidden && !empty($similar_type_charset)) {
|
2781 |
+
$similar_type_collate = $updraftplus->get_similar_collate_related_to_charset($db_supported_collations, $db_unsupported_collate_unique, $similar_type_charset);
|
2782 |
+
}
|
2783 |
+
if (empty($similar_type_collate) && !empty($db_supported_charsets_related_to_unsupported_collations)) {
|
2784 |
+
$db_supported_collations_related_to_charset = array();
|
2785 |
+
foreach ($db_supported_collations as $db_supported_collation => $db_supported_collations_info_obj) {
|
2786 |
+
if (isset($db_supported_collations_info_obj->Charset) && in_array($db_supported_collations_info_obj->Charset, $db_supported_charsets_related_to_unsupported_collations)) {
|
2787 |
+
$db_supported_collations_related_to_charset[] = $db_supported_collation;
|
2788 |
+
}
|
2789 |
+
}
|
2790 |
+
if (!empty($db_supported_collations_related_to_charset)) {
|
2791 |
+
$similar_type_collate = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_collate_unique, $db_supported_collations_related_to_charset, false);
|
2792 |
+
}
|
2793 |
+
}
|
2794 |
+
if (empty($similar_type_collate)) {
|
2795 |
+
$similar_type_collate = $updraftplus->get_similar_collate_based_on_ocuurence_count($db_collates_found, $db_supported_collations, $db_supported_charsets_related_to_unsupported_collations);
|
2796 |
+
}
|
2797 |
+
if (empty($similar_type_collate)) {
|
2798 |
+
$similar_type_collate = UpdraftPlus_Manipulation_Functions::get_matching_str_from_array_elems($db_unsupported_collate_unique, array_keys($db_supported_collations), false);
|
2799 |
+
}
|
2800 |
+
|
2801 |
+
$collate_select_html = '<label>'.__('Your chosen replacement collation', 'updraftplus').':</label>';
|
2802 |
+
$collate_select_html .= '<select name="updraft_restorer_collate" id="updraft_restorer_collate">';
|
2803 |
+
foreach ($db_supported_collations as $collate => $collate_info_obj) {
|
2804 |
+
$option_other_attr = array();
|
2805 |
+
if ($db_charset_forbidden && isset($collate_info_obj->Charset)) {
|
2806 |
+
$option_other_attr[] = 'data-charset='.esc_attr($collate_info_obj->Charset);
|
2807 |
+
if ($similar_type_charset != $collate_info_obj->Charset) {
|
2808 |
+
$option_other_attr[] = 'style="display:none;"';
|
2809 |
+
}
|
2810 |
+
}
|
2811 |
+
$collate_select_html .= '<option value="'.esc_attr($collate).'" '.selected($collate, $similar_type_collate, $echo = false).' '.implode(' ', $option_other_attr).'>'.esc_html($collate).'</option>';
|
2812 |
+
}
|
2813 |
+
$collate_select_html .= '</select>';
|
2814 |
+
|
2815 |
+
$info['addui'] = empty($info['addui']) ? $collate_select_html : $info['addui'].'<br>'.$collate_select_html;
|
2816 |
+
|
2817 |
+
if ($db_charset_forbidden) {
|
2818 |
+
$collate_change_on_charset_selection_data = array(
|
2819 |
+
'db_supported_collations' => $db_supported_collations,
|
2820 |
+
'db_unsupported_collate_unique' => $db_unsupported_collate_unique,
|
2821 |
+
'db_collates_found' => $db_collates_found,
|
2822 |
+
);
|
2823 |
+
$info['addui'] .= '<input type="hidden" name="collate_change_on_charset_selection_data" id="collate_change_on_charset_selection_data" value="'.esc_attr(json_encode($collate_change_on_charset_selection_data)).'">';
|
2824 |
+
}
|
2825 |
+
}
|
2826 |
+
}
|
2827 |
+
/* $blog_tables = "CREATE TABLE $wpdb->terms (
|
2828 |
+
CREATE TABLE $wpdb->term_taxonomy (
|
2829 |
+
CREATE TABLE $wpdb->term_relationships (
|
2830 |
+
CREATE TABLE $wpdb->commentmeta (
|
2831 |
+
CREATE TABLE $wpdb->comments (
|
2832 |
+
CREATE TABLE $wpdb->links (
|
2833 |
+
CREATE TABLE $wpdb->options (
|
2834 |
+
CREATE TABLE $wpdb->postmeta (
|
2835 |
+
CREATE TABLE $wpdb->posts (
|
2836 |
+
$users_single_table = "CREATE TABLE $wpdb->users (
|
2837 |
+
$users_multi_table = "CREATE TABLE $wpdb->users (
|
2838 |
+
$usermeta_table = "CREATE TABLE $wpdb->usermeta (
|
2839 |
+
$ms_global_tables = "CREATE TABLE $wpdb->blogs (
|
2840 |
+
CREATE TABLE $wpdb->blog_versions (
|
2841 |
+
CREATE TABLE $wpdb->registration_log (
|
2842 |
+
CREATE TABLE $wpdb->site (
|
2843 |
+
CREATE TABLE $wpdb->sitemeta (
|
2844 |
+
CREATE TABLE $wpdb->signups (
|
2845 |
+
*/
|
2846 |
+
if (!isset($skipped_tables)) $skipped_tables = array();
|
2847 |
+
$missing_tables = array();
|
2848 |
+
if ($old_table_prefix) {
|
2849 |
+
if (!$header_only) {
|
2850 |
+
foreach ($wanted_tables as $table) {
|
2851 |
+
if (!in_array($old_table_prefix.$table, $tables_found)) {
|
2852 |
+
$missing_tables[] = $table;
|
2853 |
+
}
|
2854 |
+
}
|
2855 |
|
2856 |
+
foreach ($missing_tables as $key => $value) {
|
2857 |
+
if (in_array($old_table_prefix.$value, $skipped_tables)) {
|
2858 |
+
unset($missing_tables[$key]);
|
2859 |
+
}
|
2860 |
+
}
|
2861 |
+
|
2862 |
+
if (count($missing_tables)>0) {
|
2863 |
+
$warn[] = sprintf(__('This database backup is missing core WordPress tables: %s', 'updraftplus'), implode(', ', $missing_tables));
|
2864 |
+
}
|
2865 |
+
if (count($skipped_tables)>0) {
|
2866 |
+
$warn[] = sprintf(__('This database backup has the following WordPress tables excluded: %s', 'updraftplus'), implode(', ', $skipped_tables));
|
2867 |
+
}
|
2868 |
+
}
|
2869 |
+
} else {
|
2870 |
+
if (empty($backup['meta_foreign'])) {
|
2871 |
+
$warn[] = __('UpdraftPlus was unable to find the table prefix when scanning the database backup.', 'updraftplus');
|
2872 |
+
}
|
2873 |
+
}
|
2874 |
+
|
2875 |
+
// //need to make sure that we reset the file back to .crypt before clean temp files
|
2876 |
+
// $db_file = $decrypted_file['fullpath'].'.crypt';
|
2877 |
+
// unlink($decrypted_file['fullpath']);
|
2878 |
+
|
2879 |
+
return array($mess, $warn, $err, $info);
|
2880 |
+
}
|
2881 |
+
|
2882 |
+
|
2883 |
private function gzopen_for_read( $file, &$warn, &$err ) {
|
2884 |
if ( ! function_exists( 'gzopen' ) || ! function_exists( 'gzread' ) ) {
|
2885 |
$missing = '';
|
2970 |
global $updraftplus;
|
2971 |
|
2972 |
if ( false === $backup_history ) {
|
2973 |
+
// $backup_history = UpdraftPlus_Options::get_updraft_option( 'updraft_backup_history' );
|
2974 |
+
$backup_history = UpdraftPlus_Backup_History::get_history();
|
|
|
|
|
2975 |
}
|
2976 |
+
|
2977 |
if ( empty( $backup_history ) ) {
|
2978 |
return '<p><em>' . __( 'You have not yet made any backups.', 'updraftplus' ) . '</em></p>';
|
2979 |
}
|
3049 |
|
3050 |
// Set a flag according to whether or not $backup['db'] ends in .crypt, then pick this up in the display of the decrypt field.
|
3051 |
$db = is_array( $backup['db'] ) ? $backup['db'][0] : $backup['db'];
|
3052 |
+
if ( class_exists( 'UpdraftPlus_Encryption')) {
|
3053 |
+
if (UpdraftPlus_Encryption::is_file_encrypted($db)) $entities .= '/dbcrypted=1/';
|
3054 |
+
} else if ( $updraftplus->is_db_encrypted( $db ) ) {
|
3055 |
$entities .= '/dbcrypted=1/';
|
3056 |
}
|
3057 |
+
|
3058 |
$ret .= $this->download_db_button( 'db', $key, $esc_pretty_date, $nonce_field, $backup, $accept );
|
3059 |
} else {
|
3060 |
// $ret .= sprintf(_x('(No %s)','Message shown when no such object is available','updraftplus'), __('database', 'updraftplus'));
|
3123 |
$show_data .= ' ' . __( '(backup set imported from remote storage)', 'updraftplus' );
|
3124 |
}
|
3125 |
# jQuery('#updraft_restore_label_wpcore').html('".esc_js($wpcore_restore_descrip)."');
|
3126 |
+
$ret .= '<button title="' . __( 'Go to Restore', 'updraftplus' ) . '" type="button" class="button-primary mwp-updraftplus-restore-btn" >' . __( 'Restore', 'updraftplus' ) . '</button>';
|
|
|
|
|
3127 |
}
|
3128 |
$ret .= "</form></div>\n";
|
3129 |
|
class/class-mainwp-child-wordfence.php
CHANGED
@@ -22,6 +22,7 @@ class MainWP_Child_Wordfence {
|
|
22 |
'alertOn_block',
|
23 |
'alertOn_critical',
|
24 |
'alertOn_loginLockout',
|
|
|
25 |
'alertOn_lostPasswdForm',
|
26 |
'alertOn_nonAdminLogin',
|
27 |
'alertOn_firstNonAdminLoginOnly',
|
@@ -43,10 +44,13 @@ class MainWP_Child_Wordfence {
|
|
43 |
"notification_productUpdates",
|
44 |
"notification_scanStatus",
|
45 |
'loginSec_lockInvalidUsers',
|
|
|
|
|
46 |
'loginSec_lockoutMins',
|
47 |
'loginSec_maskLoginErrors',
|
48 |
'loginSec_maxFailures',
|
49 |
'loginSec_maxForgotPasswd',
|
|
|
50 |
'loginSec_strongPasswds',
|
51 |
'loginSec_userBlacklist',
|
52 |
'loginSecurityEnabled',
|
@@ -114,6 +118,7 @@ class MainWP_Child_Wordfence {
|
|
114 |
'debugOn',
|
115 |
'deleteTablesOnDeact',
|
116 |
'disableCookies',
|
|
|
117 |
'startScansRemotely',
|
118 |
//'disableConfigCaching',
|
119 |
//'addCacheComment', // removed
|
@@ -437,6 +442,7 @@ class MainWP_Child_Wordfence {
|
|
437 |
'other_hideWPVersion',
|
438 |
'disableCodeExecutionUploads',
|
439 |
'disableCookies',
|
|
|
440 |
'actUpdateInterval',
|
441 |
'other_bypassLitespeedNoabort',
|
442 |
'deleteTablesOnDeact',
|
@@ -452,6 +458,7 @@ class MainWP_Child_Wordfence {
|
|
452 |
'alertOn_warnings',
|
453 |
'alertOn_block',
|
454 |
'alertOn_loginLockout',
|
|
|
455 |
'alertOn_lostPasswdForm',
|
456 |
'alertOn_adminLogin',
|
457 |
'alertOn_firstAdminLoginOnly',
|
@@ -507,8 +514,11 @@ class MainWP_Child_Wordfence {
|
|
507 |
'loginSec_countFailMins',
|
508 |
'loginSec_lockoutMins',
|
509 |
'loginSec_lockInvalidUsers',
|
|
|
|
|
510 |
'loginSec_userBlacklist',
|
511 |
-
|
|
|
512 |
'loginSec_maskLoginErrors',
|
513 |
'loginSec_blockAdminReg',
|
514 |
'loginSec_disableAuthorScan',
|
22 |
'alertOn_block',
|
23 |
'alertOn_critical',
|
24 |
'alertOn_loginLockout',
|
25 |
+
'alertOn_breachLogin',
|
26 |
'alertOn_lostPasswdForm',
|
27 |
'alertOn_nonAdminLogin',
|
28 |
'alertOn_firstNonAdminLoginOnly',
|
44 |
"notification_productUpdates",
|
45 |
"notification_scanStatus",
|
46 |
'loginSec_lockInvalidUsers',
|
47 |
+
'loginSec_breachPasswds_enabled',
|
48 |
+
'loginSec_breachPasswds',
|
49 |
'loginSec_lockoutMins',
|
50 |
'loginSec_maskLoginErrors',
|
51 |
'loginSec_maxFailures',
|
52 |
'loginSec_maxForgotPasswd',
|
53 |
+
'loginSec_strongPasswds_enabled',
|
54 |
'loginSec_strongPasswds',
|
55 |
'loginSec_userBlacklist',
|
56 |
'loginSecurityEnabled',
|
118 |
'debugOn',
|
119 |
'deleteTablesOnDeact',
|
120 |
'disableCookies',
|
121 |
+
'liveActivityPauseEnabled',
|
122 |
'startScansRemotely',
|
123 |
//'disableConfigCaching',
|
124 |
//'addCacheComment', // removed
|
442 |
'other_hideWPVersion',
|
443 |
'disableCodeExecutionUploads',
|
444 |
'disableCookies',
|
445 |
+
'liveActivityPauseEnabled',
|
446 |
'actUpdateInterval',
|
447 |
'other_bypassLitespeedNoabort',
|
448 |
'deleteTablesOnDeact',
|
458 |
'alertOn_warnings',
|
459 |
'alertOn_block',
|
460 |
'alertOn_loginLockout',
|
461 |
+
'alertOn_breachLogin',
|
462 |
'alertOn_lostPasswdForm',
|
463 |
'alertOn_adminLogin',
|
464 |
'alertOn_firstAdminLoginOnly',
|
514 |
'loginSec_countFailMins',
|
515 |
'loginSec_lockoutMins',
|
516 |
'loginSec_lockInvalidUsers',
|
517 |
+
'loginSec_breachPasswds_enabled',
|
518 |
+
'loginSec_breachPasswds',
|
519 |
'loginSec_userBlacklist',
|
520 |
+
'loginSec_strongPasswds_enabled',
|
521 |
+
'loginSec_strongPasswds',
|
522 |
'loginSec_maskLoginErrors',
|
523 |
'loginSec_blockAdminReg',
|
524 |
'loginSec_disableAuthorScan',
|
class/class-mainwp-child-wp-rocket.php
CHANGED
@@ -181,21 +181,27 @@ class MainWP_Child_WP_Rocket {
|
|
181 |
}
|
182 |
}
|
183 |
|
184 |
-
function purge_cache_all() {
|
185 |
if ( function_exists( 'rocket_clean_domain' ) || function_exists( 'rocket_clean_minify' ) || function_exists( 'create_rocket_uniqid' ) ) {
|
|
|
186 |
// Remove all cache files
|
187 |
rocket_clean_domain();
|
188 |
|
189 |
// Remove all minify cache files
|
190 |
rocket_clean_minify();
|
191 |
|
|
|
|
|
|
|
|
|
|
|
192 |
// Generate a new random key for minify cache file
|
193 |
$options = get_option( WP_ROCKET_SLUG );
|
194 |
$options['minify_css_key'] = create_rocket_uniqid();
|
195 |
$options['minify_js_key'] = create_rocket_uniqid();
|
196 |
remove_all_filters( 'update_option_' . WP_ROCKET_SLUG );
|
197 |
update_option( WP_ROCKET_SLUG, $options );
|
198 |
-
|
199 |
|
200 |
return array( 'result' => 'SUCCESS' );
|
201 |
} else {
|
@@ -301,15 +307,18 @@ class MainWP_Child_WP_Rocket {
|
|
301 |
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
302 |
'exclude_css' => array(),
|
303 |
'exclude_js' => array(),
|
|
|
304 |
'defer_all_js' => 0,
|
|
|
305 |
'critical_css' => '',
|
306 |
'deferred_js_files' => array(),
|
307 |
'lazyload' => 0,
|
308 |
'lazyload_iframes' => 0,
|
|
|
309 |
'minify_css' => 0,
|
310 |
// 'minify_css_key' => $minify_css_key,
|
311 |
'minify_concatenate_css' => 0,
|
312 |
-
'minify_css_combine_all' => 0,
|
313 |
'minify_css_legacy' => 0,
|
314 |
'minify_js' => 0,
|
315 |
// 'minify_js_key' => $minify_js_key,
|
@@ -324,7 +333,7 @@ class MainWP_Child_WP_Rocket {
|
|
324 |
'cdn' => 0,
|
325 |
'cdn_cnames' => array(),
|
326 |
'cdn_zone' => array(),
|
327 |
-
'cdn_ssl' => 0,
|
328 |
'cdn_reject_files' => array(),
|
329 |
'do_cloudflare' => 0,
|
330 |
'cloudflare_email' => '',
|
@@ -336,6 +345,7 @@ class MainWP_Child_WP_Rocket {
|
|
336 |
'cloudflare_auto_settings' => 0,
|
337 |
'cloudflare_old_settings' => 0,
|
338 |
'do_beta' => 0,
|
|
|
339 |
);
|
340 |
}
|
341 |
}
|
181 |
}
|
182 |
}
|
183 |
|
184 |
+
function purge_cache_all() {
|
185 |
if ( function_exists( 'rocket_clean_domain' ) || function_exists( 'rocket_clean_minify' ) || function_exists( 'create_rocket_uniqid' ) ) {
|
186 |
+
set_transient( 'rocket_clear_cache', 'all', HOUR_IN_SECONDS );
|
187 |
// Remove all cache files
|
188 |
rocket_clean_domain();
|
189 |
|
190 |
// Remove all minify cache files
|
191 |
rocket_clean_minify();
|
192 |
|
193 |
+
// Remove cache busting files.
|
194 |
+
if ( function_exists( 'rocket_clean_cache_busting' )) {
|
195 |
+
rocket_clean_cache_busting();
|
196 |
+
}
|
197 |
+
|
198 |
// Generate a new random key for minify cache file
|
199 |
$options = get_option( WP_ROCKET_SLUG );
|
200 |
$options['minify_css_key'] = create_rocket_uniqid();
|
201 |
$options['minify_js_key'] = create_rocket_uniqid();
|
202 |
remove_all_filters( 'update_option_' . WP_ROCKET_SLUG );
|
203 |
update_option( WP_ROCKET_SLUG, $options );
|
204 |
+
rocket_dismiss_box( 'rocket_warning_plugin_modification' );
|
205 |
|
206 |
return array( 'result' => 'SUCCESS' );
|
207 |
} else {
|
307 |
'purge_cron_unit' => 'HOUR_IN_SECONDS',
|
308 |
'exclude_css' => array(),
|
309 |
'exclude_js' => array(),
|
310 |
+
'async_css' => 0,
|
311 |
'defer_all_js' => 0,
|
312 |
+
'defer_all_js_safe' => 1,
|
313 |
'critical_css' => '',
|
314 |
'deferred_js_files' => array(),
|
315 |
'lazyload' => 0,
|
316 |
'lazyload_iframes' => 0,
|
317 |
+
'lazyload_youtube' =>0,
|
318 |
'minify_css' => 0,
|
319 |
// 'minify_css_key' => $minify_css_key,
|
320 |
'minify_concatenate_css' => 0,
|
321 |
+
//'minify_css_combine_all' => 0,
|
322 |
'minify_css_legacy' => 0,
|
323 |
'minify_js' => 0,
|
324 |
// 'minify_js_key' => $minify_js_key,
|
333 |
'cdn' => 0,
|
334 |
'cdn_cnames' => array(),
|
335 |
'cdn_zone' => array(),
|
336 |
+
//'cdn_ssl' => 0,
|
337 |
'cdn_reject_files' => array(),
|
338 |
'do_cloudflare' => 0,
|
339 |
'cloudflare_email' => '',
|
345 |
'cloudflare_auto_settings' => 0,
|
346 |
'cloudflare_old_settings' => 0,
|
347 |
'do_beta' => 0,
|
348 |
+
'analytics_enabled' => 1,
|
349 |
);
|
350 |
}
|
351 |
}
|
class/class-mainwp-child.php
CHANGED
@@ -84,7 +84,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
|
84 |
}
|
85 |
|
86 |
class MainWP_Child {
|
87 |
-
public static $version = '3.4.7';
|
88 |
private $update_version = '1.3';
|
89 |
|
90 |
private $callableFunctions = array(
|
@@ -150,7 +150,8 @@ class MainWP_Child {
|
|
150 |
'backup_buddy' => 'backup_buddy',
|
151 |
'get_site_icon' => 'get_site_icon',
|
152 |
'vulner_checker' => 'vulner_checker',
|
153 |
-
'wp_staging' => 'wp_staging'
|
|
|
154 |
);
|
155 |
|
156 |
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
@@ -1858,6 +1859,11 @@ class MainWP_Child {
|
|
1858 |
global $wp_current_filter;
|
1859 |
$wp_current_filter[] = 'load-plugins.php';
|
1860 |
@wp_update_plugins();
|
|
|
|
|
|
|
|
|
|
|
1861 |
$information['plugin_updates'] = get_plugin_updates();
|
1862 |
|
1863 |
$plugins = explode( ',', urldecode( $_POST['list'] ) );
|
@@ -4743,7 +4749,7 @@ class MainWP_Child {
|
|
4743 |
}
|
4744 |
}
|
4745 |
|
4746 |
-
function deactivation() {
|
4747 |
$to_delete = array(
|
4748 |
'mainwp_child_pubkey',
|
4749 |
'mainwp_child_nonce',
|
@@ -4761,7 +4767,9 @@ class MainWP_Child {
|
|
4761 |
wp_cache_delete( $delete, 'options' );
|
4762 |
}
|
4763 |
}
|
4764 |
-
|
|
|
|
|
4765 |
}
|
4766 |
|
4767 |
function getWPFilesystem() {
|
@@ -5473,7 +5481,12 @@ class MainWP_Child {
|
|
5473 |
function wp_staging() {
|
5474 |
MainWP_Child_Staging::Instance()->action();
|
5475 |
}
|
5476 |
-
|
|
|
|
|
|
|
|
|
|
|
5477 |
static function fix_for_custom_themes() {
|
5478 |
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
5479 |
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
|
84 |
}
|
85 |
|
86 |
class MainWP_Child {
|
87 |
+
public static $version = '3.4.7.1';
|
88 |
private $update_version = '1.3';
|
89 |
|
90 |
private $callableFunctions = array(
|
150 |
'backup_buddy' => 'backup_buddy',
|
151 |
'get_site_icon' => 'get_site_icon',
|
152 |
'vulner_checker' => 'vulner_checker',
|
153 |
+
'wp_staging' => 'wp_staging',
|
154 |
+
'disconnect' => 'disconnect',
|
155 |
);
|
156 |
|
157 |
private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.';
|
1859 |
global $wp_current_filter;
|
1860 |
$wp_current_filter[] = 'load-plugins.php';
|
1861 |
@wp_update_plugins();
|
1862 |
+
|
1863 |
+
// trick to prevent some premium plugins re-create update info
|
1864 |
+
remove_all_filters('pre_set_site_transient_update_plugins');
|
1865 |
+
|
1866 |
+
|
1867 |
$information['plugin_updates'] = get_plugin_updates();
|
1868 |
|
1869 |
$plugins = explode( ',', urldecode( $_POST['list'] ) );
|
4749 |
}
|
4750 |
}
|
4751 |
|
4752 |
+
function deactivation( $deact = true) {
|
4753 |
$to_delete = array(
|
4754 |
'mainwp_child_pubkey',
|
4755 |
'mainwp_child_nonce',
|
4767 |
wp_cache_delete( $delete, 'options' );
|
4768 |
}
|
4769 |
}
|
4770 |
+
|
4771 |
+
if ($deact)
|
4772 |
+
do_action( 'mainwp_child_deactivation' );
|
4773 |
}
|
4774 |
|
4775 |
function getWPFilesystem() {
|
5481 |
function wp_staging() {
|
5482 |
MainWP_Child_Staging::Instance()->action();
|
5483 |
}
|
5484 |
+
|
5485 |
+
function disconnect() {
|
5486 |
+
$this->deactivation(false);
|
5487 |
+
MainWP_Helper::write( array( 'result' => 'success' ) );
|
5488 |
+
}
|
5489 |
+
|
5490 |
static function fix_for_custom_themes() {
|
5491 |
if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) {
|
5492 |
include_once( ABSPATH . '/wp-admin/includes/screen.php' );
|
class/class-mainwp-helper.php
CHANGED
@@ -211,7 +211,18 @@ class MainWP_Helper {
|
|
211 |
|
212 |
static function createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) {
|
213 |
global $current_user;
|
214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
$wprocket_activated = false;
|
216 |
if ( MainWP_Child_WP_Rocket::isActivated() ) {
|
217 |
if ( function_exists( 'get_rocket_option' ) ) {
|
211 |
|
212 |
static function createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) {
|
213 |
global $current_user;
|
214 |
+
// Options fields.
|
215 |
+
$wprocket_fields = array(
|
216 |
+
'lazyload',
|
217 |
+
'lazyload_iframes',
|
218 |
+
'minify_html',
|
219 |
+
'minify_css',
|
220 |
+
'minify_js',
|
221 |
+
'cdn',
|
222 |
+
'async_css',
|
223 |
+
'defer_all_js',
|
224 |
+
);
|
225 |
+
|
226 |
$wprocket_activated = false;
|
227 |
if ( MainWP_Child_WP_Rocket::isActivated() ) {
|
228 |
if ( function_exists( 'get_rocket_option' ) ) {
|
mainwp-child.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
-
Version: 3.4.7
|
10 |
*/
|
11 |
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
12 |
header( 'X-Frame-Options: ALLOWALL' );
|
6 |
Author: MainWP
|
7 |
Author URI: https://mainwp.com
|
8 |
Text Domain: mainwp-child
|
9 |
+
Version: 3.4.7.1
|
10 |
*/
|
11 |
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
12 |
header( 'X-Frame-Options: ALLOWALL' );
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Author URI: https://mainwp.com
|
|
7 |
Plugin URI: https://mainwp.com
|
8 |
Requires at least: 3.6
|
9 |
Tested up to: 4.9.5
|
10 |
-
Stable tag: 3.4.7
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
@@ -71,6 +71,12 @@ To see full documentation and FAQs please visit [MainWP Documentation](https://m
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 3.4.7 - 4-17-18 =
|
75 |
* Fixed: multiple cloning issues
|
76 |
* Fixed: timezone issue backup timestamp
|
7 |
Plugin URI: https://mainwp.com
|
8 |
Requires at least: 3.6
|
9 |
Tested up to: 4.9.5
|
10 |
+
Stable tag: 3.4.7.1
|
11 |
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
71 |
|
72 |
== Changelog ==
|
73 |
|
74 |
+
= 3.4.7.1 - 5-25-18 =
|
75 |
+
* Fixed: UpdraftPlus 1.14.10 compatibility issue that caused child sites to disconnect
|
76 |
+
* Added: support for the new MainWP Branding Extension option
|
77 |
+
* Updated: compatibility with the new Wordfence plugin version
|
78 |
+
* Updated: compatibility with the new WP Rocket plugin version
|
79 |
+
|
80 |
= 3.4.7 - 4-17-18 =
|
81 |
* Fixed: multiple cloning issues
|
82 |
* Fixed: timezone issue backup timestamp
|