mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-05 09:19:53 +08:00
Merge with branch1 + version update
This commit is contained in:
parent
d218895cda
commit
7f5448790c
14 changed files with 845 additions and 197 deletions
|
@ -198,8 +198,6 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
HM\BackUpWordPress\Path::get_instance()->cleanup();
|
||||
|
||||
if (method_exists($schedule, 'get_running_backup_filename' )) {
|
||||
$information['scheduleStatus'] = $schedule->get_status();
|
||||
} else {
|
||||
|
@ -217,6 +215,9 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
if (function_exists('hmbkp_run_schedule_async')) {
|
||||
hmbkp_run_schedule_async($schedule_id);
|
||||
} else if (function_exists('\HM\BackUpWordPress\run_schedule_async')) {
|
||||
HM\BackUpWordPress\Path::get_instance()->cleanup();
|
||||
// Fixes an issue on servers which only allow a single session per client
|
||||
session_write_close();
|
||||
$task = new \HM\Backdrop\Task( '\HM\BackUpWordPress\run_schedule_async', $schedule_id );
|
||||
$task->schedule();
|
||||
} else
|
||||
|
@ -453,101 +454,129 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
$schedule_id = $this->check_schedule();
|
||||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( urldecode( $schedule_id ) ) );
|
||||
|
||||
$new_version = true;
|
||||
if (method_exists($schedule, 'get_running_backup_filename' )) {
|
||||
$new_version = false;
|
||||
$user_excludes = array_diff( $schedule->get_excludes(), $schedule->backup->default_excludes() );
|
||||
$root_dir = $schedule->backup->get_root();
|
||||
$is_size_calculated = $schedule->is_site_size_being_calculated();
|
||||
} else {
|
||||
$excludes = $schedule->get_excludes();
|
||||
$user_excludes = $excludes->get_user_excludes();
|
||||
$root_dir = HM\BackUpWordPress\Path::get_root();
|
||||
$is_size_calculated = HM\BackUpWordPress\Site_Size::is_site_size_being_calculated();
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
?>
|
||||
<div class="hmbkp-exclude-settings">
|
||||
|
||||
<?php if ( $schedule->get_excludes() ) : ?>
|
||||
<?php //if ( $schedule->get_excludes() ) : ?>
|
||||
|
||||
<h3>
|
||||
<?php esc_html_e( 'Currently Excluded', 'backupwordpress' ); ?>
|
||||
</h3>
|
||||
<h3>
|
||||
<?php esc_html_e( 'Currently Excluded', 'backupwordpress' ); ?>
|
||||
</h3>
|
||||
|
||||
<p><?php esc_html_e( 'We automatically detect and ignore common <abbr title="Version Control Systems">VCS</abbr> folders and other backup plugin folders.', 'backupwordpress' ); ?></p>
|
||||
<p><?php esc_html_e( 'We automatically detect and ignore common <abbr title="Version Control Systems">VCS</abbr> folders and other backup plugin folders.', 'backupwordpress' ); ?></p>
|
||||
|
||||
<table class="widefat">
|
||||
<table class="widefat">
|
||||
|
||||
<tbody>
|
||||
<tbody>
|
||||
<?php foreach ( $user_excludes as $key => $exclude ) : ?>
|
||||
|
||||
<?php foreach ( array_diff( $schedule->get_excludes(), $schedule->backup->default_excludes() ) as $key => $exclude ) :
|
||||
<?php $exclude_path = new SplFileInfo( trailingslashit( $root_dir ) . ltrim( str_ireplace( $root_dir, '', $exclude ), '/' ) ); ?>
|
||||
|
||||
$exclude_path = new SplFileInfo( trailingslashit( $schedule->backup->get_root() ) . ltrim( str_ireplace( $schedule->backup->get_root(), '', $exclude ), '/' ) ); ?>
|
||||
<tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row">
|
||||
|
||||
<th scope="row">
|
||||
<?php if ( $exclude_path->isFile() ) { ?>
|
||||
|
||||
<?php if ( $exclude_path->isFile() ) { ?>
|
||||
<div class="dashicons dashicons-media-default"></div>
|
||||
|
||||
<div class="dashicons dashicons-media-default"></div>
|
||||
<?php } elseif ( $exclude_path->isDir() ) { ?>
|
||||
|
||||
<?php } elseif ( $exclude_path->isDir() ) { ?>
|
||||
<div class="dashicons dashicons-portfolio"></div>
|
||||
|
||||
<div class="dashicons dashicons-portfolio"></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php } ?>
|
||||
</th>
|
||||
|
||||
</th>
|
||||
<td>
|
||||
<code>
|
||||
<?php echo esc_html( str_ireplace( $root_dir, '', $exclude ) ); ?>
|
||||
</code>
|
||||
|
||||
<td>
|
||||
<code><?php echo esc_html( str_ireplace( $schedule->backup->get_root(), '', $exclude ) ); ?></code>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($new_version)
|
||||
$is_default_rule = ( in_array( $exclude, $excludes->get_default_excludes() ) ) || ( HM\BackUpWordPress\Path::get_path() === trailingslashit( HM\BackUpWordPress\Path::get_root() ) . untrailingslashit( $exclude ) );
|
||||
else
|
||||
$is_default_rule = ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) ) ;
|
||||
|
||||
<td>
|
||||
if ( $is_default_rule ) : ?>
|
||||
<?php esc_html_e( 'Default rule', 'backupwordpress' ); ?>
|
||||
|
||||
<?php if ( ( in_array( $exclude, $schedule->backup->default_excludes() ) ) || ( hmbkp_path() === untrailingslashit( $exclude ) ) ) : ?>
|
||||
<?php elseif ( defined( 'HMBKP_EXCLUDE' ) && false !== strpos( HMBKP_EXCLUDE, $exclude ) ) : ?>
|
||||
|
||||
<?php esc_html_e( 'Default rule', 'backupwordpress' ); ?>
|
||||
<?php esc_html_e( 'Defined in wp-config.php', 'backupwordpress' ); ?>
|
||||
|
||||
<?php elseif ( defined( 'HMBKP_EXCLUDE' ) && false !== strpos( HMBKP_EXCLUDE, $exclude ) ) : ?>
|
||||
<?php else : ?>
|
||||
|
||||
<?php esc_html_e( 'Defined in wp-config.php', 'backupwordpress' ); ?>
|
||||
<a href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_remove_exclude_rule('<?php esc_attr_e( $exclude ); ?>', this);"
|
||||
class="delete-action"><?php esc_html_e( 'Stop excluding', 'backupwordpress' ); ?></a>
|
||||
|
||||
<?php else : ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_remove_exclude_rule('<?php esc_attr_e( $exclude ); ?>', this);"
|
||||
class="delete-action"><?php esc_html_e( 'Stop excluding', 'backupwordpress' ); ?></a>
|
||||
</td>
|
||||
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
</tbody>
|
||||
<?php //endif; ?>
|
||||
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 id="directory-listing"><?php esc_html_e( 'Directory Listing', 'backupwordpress' ); ?></h3>
|
||||
<h3 id="directory-listing"><?php esc_html_e( 'Your Site', 'backupwordpress' ); ?></h3>
|
||||
|
||||
<p><?php esc_html_e( 'Here\'s a directory listing of all files on your site, you can browse through and exclude files or folders that you don\'t want included in your backup.', 'backupwordpress' ); ?></p>
|
||||
|
||||
<?php
|
||||
|
||||
// The directory to display
|
||||
$directory = $schedule->backup->get_root();
|
||||
// The directory to display
|
||||
$directory = $root_dir;
|
||||
|
||||
if ( isset( $browse_dir ) ) {
|
||||
|
||||
$untrusted_directory = urldecode( $browse_dir );
|
||||
|
||||
// Only allow real sub directories of the site root to be browsed
|
||||
if ( false !== strpos( $untrusted_directory, $schedule->backup->get_root() ) && is_dir( $untrusted_directory ) ) {
|
||||
if ( false !== strpos( $untrusted_directory, $root_dir ) && is_dir( $untrusted_directory ) ) {
|
||||
$directory = $untrusted_directory;
|
||||
}
|
||||
}
|
||||
|
||||
$exclude_string = $schedule->backup->exclude_string( 'regex' );
|
||||
|
||||
// Kick off a recursive filesize scan
|
||||
$files = $schedule->list_directory_by_total_filesize( $directory );
|
||||
if ($new_version) {
|
||||
|
||||
$site_size = new HM\BackUpWordPress\Site_Size;
|
||||
|
||||
$exclude_string = implode( '|', $excludes->get_excludes_for_regex() );
|
||||
|
||||
if (function_exists('HM\BackUpWordPress\list_directory_by_total_filesize'))
|
||||
$files = HM\BackUpWordPress\list_directory_by_total_filesize( $directory );
|
||||
|
||||
} else {
|
||||
$files = $schedule->list_directory_by_total_filesize( $directory );
|
||||
$exclude_string = $schedule->backup->exclude_string( 'regex' );
|
||||
}
|
||||
|
||||
if ( $files ) { ?>
|
||||
|
||||
|
@ -571,14 +600,14 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
<th scope="col">
|
||||
|
||||
<?php if ( $schedule->backup->get_root() !== $directory ) {
|
||||
<?php if ( $root_dir !== $directory ) {
|
||||
// echo esc_url( remove_query_arg( 'hmbkp_directory_browse' ) );
|
||||
?>
|
||||
<a href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_directory_browse('', this)"><?php echo esc_html( $schedule->backup->get_root() ); ?></a>
|
||||
onclick="event.preventDefault(); mainwp_backupwp_directory_browse('', this)"><?php echo esc_html( $root_dir ); ?></a>
|
||||
<code>/</code>
|
||||
|
||||
<?php $parents = array_filter( explode( '/', str_replace( trailingslashit( $schedule->backup->get_root() ), '', trailingslashit( dirname( $directory ) ) ) ) );
|
||||
<?php $parents = array_filter( explode( '/', str_replace( trailingslashit( $root_dir ), '', trailingslashit( dirname( $directory ) ) ) ) );
|
||||
|
||||
foreach ( $parents as $directory_basename ) { ?>
|
||||
|
||||
|
@ -592,7 +621,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
<?php } else { ?>
|
||||
|
||||
<?php echo esc_html( $schedule->backup->get_root() ); ?>
|
||||
<?php echo esc_html( $root_dir ); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
@ -600,16 +629,20 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
<td class="column-filesize">
|
||||
|
||||
<?php if ( $schedule->is_site_size_being_calculated() ) : ?>
|
||||
<?php if ( $is_size_calculated ) : ?>
|
||||
|
||||
<span class="spinner"></span>
|
||||
<span class="spinner "></span>
|
||||
|
||||
<?php
|
||||
else :
|
||||
|
||||
$root = new SplFileInfo( $schedule->backup->get_root() );
|
||||
$root = new SplFileInfo( $root_dir );
|
||||
|
||||
$size = $schedule->filesize( $root, true );
|
||||
if ($new_version) {
|
||||
$size = $site_size->filesize( $root );
|
||||
} else {
|
||||
$size = $schedule->filesize( $root, true );
|
||||
}
|
||||
|
||||
if ( false !== $size ) {
|
||||
|
||||
|
@ -625,7 +658,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
<?php echo esc_html( $size ); ?>
|
||||
|
||||
<a class="dashicons dashicons-update"
|
||||
href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( $schedule->backup->get_root() ) ), 'hmbkp-recalculate_directory_filesize' ) ); ?>"><span><?php esc_html_e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( $root_dir ) ), 'hmbkp-recalculate_directory_filesize' ) ); ?>"><span><?php esc_html_e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
|
||||
</code>
|
||||
|
||||
|
@ -635,15 +668,15 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
<?php endif; ?>
|
||||
|
||||
<td>
|
||||
<?php echo esc_html( substr( sprintf( '%o', fileperms( $schedule->backup->get_root() ) ), - 4 ) ); ?>
|
||||
<?php echo esc_html( substr( sprintf( '%o', fileperms( $root_dir ) ), - 4 ) ); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
||||
<?php
|
||||
if ( is_link( $schedule->backup->get_root() ) ) {
|
||||
if ( is_link( $root_dir ) ) {
|
||||
esc_html_e( 'Symlink', 'backupwordpress' );
|
||||
} elseif ( is_dir( $schedule->backup->get_root() ) ) {
|
||||
} elseif ( is_dir( $root_dir ) ) {
|
||||
esc_html_e( 'Folder', 'backupwordpress' );
|
||||
}
|
||||
?>
|
||||
|
@ -663,8 +696,14 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
$is_excluded = $is_unreadable = false;
|
||||
|
||||
// Check if the file is excluded
|
||||
if ( $exclude_string && preg_match( '(' . $exclude_string . ')', str_ireplace( trailingslashit( $schedule->backup->get_root() ), '', HM\BackUpWordPress\Backup::conform_dir( $file->getPathname() ) ) ) ) {
|
||||
$is_excluded = true;
|
||||
if ($new_version) {
|
||||
if ( $exclude_string && preg_match( '(' . $exclude_string . ')', str_ireplace( trailingslashit( $root_dir ), '', wp_normalize_path( $file->getPathname() ) ) ) ) {
|
||||
$is_excluded = true;
|
||||
}
|
||||
} else {
|
||||
if ( $exclude_string && preg_match( '(' . $exclude_string . ')', str_ireplace( trailingslashit( $root_dir ), '', HM\BackUpWordPress\Backup::conform_dir( $file->getPathname() ) ) ) ) {
|
||||
$is_excluded = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Skip unreadable files
|
||||
|
@ -693,38 +732,62 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
</td>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
if ($new_version) {
|
||||
if ( $is_unreadable ) { ?>
|
||||
|
||||
<?php if ( $is_unreadable ) { ?>
|
||||
<code class="strikethrough"
|
||||
title="<?php echo esc_attr( wp_normalize_path( $file->getRealPath() ) ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<code class="strikethrough"
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
<?php } elseif ( $file->isFile() ) { ?>
|
||||
|
||||
<?php } elseif ( $file->isFile() ) { ?>
|
||||
<code
|
||||
title="<?php echo esc_attr( wp_normalize_path( $file->getRealPath() ) ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<code
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
<?php } elseif ( $file->isDir() ) { ?>
|
||||
<code title="<?php echo esc_attr( $file->getRealPath() ); ?>"><a
|
||||
href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_directory_browse('<?php echo urlencode( wp_normalize_path( $file->getPathname()) ); ?>', this)"><?php echo esc_html( $file->getBasename() ); ?></a></code>
|
||||
|
||||
<?php } elseif ( $file->isDir() ) {
|
||||
//echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) );
|
||||
?>
|
||||
<code title="<?php echo esc_attr( $file->getRealPath() ); ?>"><a
|
||||
href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_directory_browse('<?php echo urlencode( $file->getPathname() ); ?>', this)"><?php echo esc_html( $file->getBasename() ); ?></a></code>
|
||||
|
||||
<?php } ?>
|
||||
<?php }
|
||||
} else {
|
||||
if ( $is_unreadable ) { ?>
|
||||
|
||||
<code class="strikethrough"
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<?php } elseif ( $file->isFile() ) { ?>
|
||||
|
||||
<code
|
||||
title="<?php echo esc_attr( $file->getRealPath() ); ?>"><?php echo esc_html( $file->getBasename() ); ?></code>
|
||||
|
||||
<?php } elseif ( $file->isDir() ) {
|
||||
//echo add_query_arg( 'hmbkp_directory_browse', urlencode( $file->getPathname() ) );
|
||||
?>
|
||||
<code title="<?php echo esc_attr( $file->getRealPath() ); ?>"><a
|
||||
href="#"
|
||||
onclick="event.preventDefault(); mainwp_backupwp_directory_browse('<?php echo urlencode( $file->getPathname() ); ?>', this)"><?php echo esc_html( $file->getBasename() ); ?></a></code>
|
||||
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="column-format column-filesize">
|
||||
|
||||
<?php if ( $file->isDir() && $schedule->is_site_size_being_calculated() ) : ?>
|
||||
<?php if ( $file->isDir() && $is_size_calculated ) : ?>
|
||||
|
||||
<span class="spinner"></span>
|
||||
|
||||
<?php
|
||||
else :
|
||||
|
||||
$size = $schedule->filesize( $file );
|
||||
if ($new_version) {
|
||||
$size = $site_size->filesize( $file );
|
||||
} else {
|
||||
$size = $schedule->filesize( $file );
|
||||
}
|
||||
|
||||
if ( false !== $size ) {
|
||||
|
||||
|
@ -742,7 +805,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
<a title="<?php esc_attr_e( 'Recalculate the size of this directory', 'backupwordpress' ); ?>"
|
||||
class="dashicons dashicons-update"
|
||||
href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( $file->getPathname() ) ), 'hmbkp-recalculate_directory_filesize' ) ); ?>"><span><?php esc_html_e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
href="<?php echo esc_attr( wp_nonce_url( add_query_arg( 'hmbkp_recalculate_directory_filesize', urlencode( wp_normalize_path( $file->getPathname() ) ) ), 'hmbkp-recalculate_directory_filesize' ) ); ?>"><span><?php esc_html_e( 'Refresh', 'backupwordpress' ); ?></span></a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
@ -768,7 +831,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
<?php if ( $file->isLink() ) : ?>
|
||||
|
||||
<span
|
||||
title="<?php echo esc_attr( $file->GetRealPath() ); ?>"><?php esc_html_e( 'Symlink', 'backupwordpress' ); ?></span>
|
||||
title="<?php echo esc_attr( wp_normalize_path( $file->GetRealPath() ) ); ?>"><?php esc_html_e( 'Symlink', 'backupwordpress' ); ?></span>
|
||||
|
||||
<?php elseif ( $file->isDir() ) :
|
||||
|
||||
|
@ -801,7 +864,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
// Excluded directories need to be trailingslashed
|
||||
if ( $file->isDir() ) {
|
||||
$exclude_path = trailingslashit( $file->getPathname() );
|
||||
$exclude_path = trailingslashit( wp_normalize_path( $file->getPathname() ) );
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -886,8 +949,12 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
$schedule = new HM\BackUpWordPress\Scheduled_Backup( sanitize_text_field( $schedule_id ) );
|
||||
|
||||
$excludes = $schedule->get_excludes();
|
||||
$exclude_rule_to_remove = stripslashes( sanitize_text_field( $_POST['remove_rule'] ) );
|
||||
|
||||
$schedule->set_excludes( array_diff( $excludes, (array) stripslashes( sanitize_text_field( $_POST['remove_rule'] ) ) ) );
|
||||
if (method_exists($excludes, 'get_user_excludes')) {
|
||||
$schedule->set_excludes( array_diff( $excludes->get_user_excludes(), (array) $exclude_rule_to_remove ) );
|
||||
} else
|
||||
$schedule->set_excludes( array_diff( $excludes, $exclude_rule_to_remove ) );
|
||||
|
||||
$schedule->save();
|
||||
|
||||
|
@ -905,6 +972,29 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
return $out;
|
||||
}
|
||||
|
||||
function remove_exclude_rule() {
|
||||
|
||||
check_admin_referer( 'hmbkp_remove_exclude_rule', 'hmbkp-remove_exclude_rule_nonce' );
|
||||
|
||||
if ( ! isset( $_GET['hmbkp_remove_exclude'] ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
$schedule = new Scheduled_Backup( sanitize_text_field( $_GET['hmbkp_schedule_id'] ) );
|
||||
|
||||
$excludes = $schedule->get_excludes();
|
||||
$exclude_rule_to_remove = stripslashes( sanitize_text_field( $_GET['hmbkp_remove_exclude'] ) );
|
||||
|
||||
$schedule->set_excludes( array_diff( $excludes->get_user_excludes(), (array) $exclude_rule_to_remove ) );
|
||||
|
||||
$schedule->save();
|
||||
|
||||
wp_safe_redirect( wp_get_referer(), '303' );
|
||||
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
function update_schedule() {
|
||||
$sch_id = isset( $_POST['schedule_id'] ) ? $_POST['schedule_id'] : 0;
|
||||
$sch_id = sanitize_text_field( urldecode( $sch_id ) );
|
||||
|
|
|
@ -178,6 +178,8 @@ class MainWP_Child_Back_WP_Up {
|
|||
}
|
||||
|
||||
public function init() {
|
||||
add_action('mainwp_child_site_stats', array($this, 'do_site_stats'));
|
||||
|
||||
if ( get_option( 'mainwp_backwpup_ext_enabled' ) !== 'Y' ) {
|
||||
return;
|
||||
}
|
||||
|
@ -188,6 +190,49 @@ class MainWP_Child_Back_WP_Up {
|
|||
}
|
||||
}
|
||||
|
||||
function do_site_stats() {
|
||||
if ( ! $this->is_backwpup_installed || !class_exists('BackWPup_Page_Logs')) {
|
||||
return;
|
||||
}
|
||||
update_user_option( get_current_user_id(), 'backwpuplogs_per_page', 99999999 );
|
||||
$output = new BackWPup_Page_Logs();
|
||||
$output->prepare_items();
|
||||
|
||||
if (is_array($output->items)) {
|
||||
$backup_types = array(
|
||||
'DBDUMP' => 'DB Check',
|
||||
'DBCHECK' => 'DB Check',
|
||||
'FILE' => 'File backup',
|
||||
'WPEXP' => 'XML export',
|
||||
'WPPLUGIN' => 'Plugins'
|
||||
);
|
||||
$last_logs_checking = get_option('mainwp_backwpup_lastcheck_logs', 0);
|
||||
$new_last_logs_checking = $last_logs_checking;
|
||||
foreach($output->items as $item) {
|
||||
if (!isset($item['logtime']))
|
||||
continue;
|
||||
$logtime_gmt = $item['logtime'] - ( get_option( 'gmt_offset' ) * 3600 );
|
||||
if ($logtime_gmt > $last_logs_checking) {
|
||||
$types = explode("+", (string)$item['type']);
|
||||
$type_temp = "";
|
||||
foreach($types as $type) {
|
||||
if (isset($backup_types[$type])) {
|
||||
$type_temp .= $backup_types[$type] . ", ";
|
||||
}
|
||||
}
|
||||
$type_temp = rtrim($type_temp, ", ");
|
||||
$message = "BackWPup backup" . ( !empty($type_temp) ? ": " . $type_temp : "" );
|
||||
do_action( 'mainwp_backwpup_backup', $message, $type_temp, $logtime_gmt);
|
||||
if ($logtime_gmt > $new_last_logs_checking)
|
||||
$new_last_logs_checking = $logtime_gmt;
|
||||
}
|
||||
}
|
||||
if ($new_last_logs_checking > $last_logs_checking) {
|
||||
update_option('mainwp_backwpup_lastcheck_logs', $new_last_logs_checking);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function all_plugins( $plugins ) {
|
||||
foreach ( $plugins as $key => $value ) {
|
||||
$plugin_slug = basename( $key, '.php' );
|
||||
|
@ -553,10 +598,10 @@ class MainWP_Child_Back_WP_Up {
|
|||
$temp_array['downloadurl'] = str_replace( array(
|
||||
'&',
|
||||
network_admin_url( 'admin.php' ) . '?page=backwpupbackups&action=',
|
||||
), array(
|
||||
), array(
|
||||
'&',
|
||||
admin_url( 'admin-ajax.php' ) . '?action=mainwp_backwpup_download_backup&type=',
|
||||
), $temp_array['downloadurl'] . '&_wpnonce=' . $this->create_nonce_without_session( 'mainwp_download_backup' ) );
|
||||
), $temp_array['downloadurl'] . '&_wpnonce=' . $this->create_nonce_without_session( 'mainwp_download_backup' ) );
|
||||
$temp_array['website_id'] = $website_id;
|
||||
|
||||
if ( ! isset( $without_dupes[ $temp_array['file'] ] ) ) {
|
||||
|
|
|
@ -587,18 +587,20 @@ class MainWP_Child_Branding {
|
|||
|
||||
public function send_support_mail() {
|
||||
$email = get_option( 'mainwp_branding_support_email' );
|
||||
$sub = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_subject'] ) ) );
|
||||
$subject = !empty( $sub ) ? $sub : "MainWP - Support Contact";
|
||||
$content = wp_kses_post( nl2br( stripslashes( $_POST['mainwp_branding_contact_message_content'] ) ) );
|
||||
if ( ! empty( $_POST['mainwp_branding_contact_message_content'] ) && ! empty( $email ) ) {
|
||||
global $current_user;
|
||||
$mail = '<p>Support Email from: <a href="' . site_url() . '">' . site_url() . '</a></p>';
|
||||
$mail .= '<p>Sent from WordPress page: ' . ( ! empty( $_POST['mainwp_branding_send_from_page'] ) ? '<a href="' . esc_url( $_POST['mainwp_branding_send_from_page'] ) . '">' . esc_url( $_POST['mainwp_branding_send_from_page'] ) . '</a></p>' : '' );
|
||||
$mail .= '<p>Client Email: ' . $current_user->user_email . ' </p>';
|
||||
$mail .= '<p>Support Text:</p>';
|
||||
$mail .= '<p>' . $content . '</p>';
|
||||
if ( wp_mail( $email, 'MainWP - Support Contact', $mail, array(
|
||||
'From: "' . $current_user->user_email . '" <' . $current_user->user_email . '>',
|
||||
'content-type: text/html',
|
||||
) ) ) {
|
||||
$headers .= "Content-Type: text/html;charset=utf-8\r\n";
|
||||
$headers .= "From: \"" . $current_user->user_email . "\" <" . $current_user->user_email . ">\r\n";
|
||||
$mail .= "<p>Support Email from: <a href='" . site_url() . "'>" . site_url() . "</a></p>\r\n\r\n";
|
||||
$mail .= "<p>Sent from WordPress page: " . ( ! empty( $_POST["mainwp_branding_send_from_page"] ) ? "<a href='" . esc_url( $_POST["mainwp_branding_send_from_page"] ) . "'>" . esc_url( $_POST["mainwp_branding_send_from_page"] ) . "</a></p>\r\n\r\n" : "" );
|
||||
$mail .= "<p>Client Email: " . $current_user->user_email . " </p>\r\n\r\n";
|
||||
$mail .= "<p>Support Text:</p>\r\n\r\n";
|
||||
$mail .= "<p>" . $content . "</p>\r\n\r\n";
|
||||
|
||||
if ( wp_mail( $email, $subject, $mail, $headers ) ) {
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -667,8 +669,10 @@ class MainWP_Child_Branding {
|
|||
|
||||
<div style="height: auto; margin-bottom: 10px; text-align: left">
|
||||
<p><?php echo wp_kses_post( $support_message ); ?></p>
|
||||
|
||||
<p><label for="mainwp_branding_contact_message_subject"><?php _e('Subject:', 'mainwp-child'); ?></label><br>
|
||||
<input type="text" name="mainwp_branding_contact_message_subject" style="width: 650px;"></p>
|
||||
<div style="max-width: 650px;">
|
||||
<label for="mainwp_branding_contact_message_content"><?php _e('Your Message:', 'mainwp-child'); ?></label><br>
|
||||
<?php
|
||||
remove_editor_styles(); // stop custom theme styling interfering with the editor
|
||||
wp_editor( '', 'mainwp_branding_contact_message_content', array(
|
||||
|
|
|
@ -40,7 +40,7 @@ class MainWP_Child_Plugins_Check {
|
|||
|
||||
add_action( $this->cron_name_watcher, array( $this, 'perform_watchdog' ) );
|
||||
|
||||
// add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
||||
//add_filter( 'plugin_row_meta', array( $this, 'change_plugin_row_meta' ), 10, 4 );
|
||||
|
||||
add_filter( 'plugins_api_args', array( $this, 'modify_plugin_api_search_query' ), 10, 2 );
|
||||
|
||||
|
@ -141,45 +141,46 @@ class MainWP_Child_Plugins_Check {
|
|||
|
||||
}
|
||||
|
||||
// for testing
|
||||
public function change_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) {
|
||||
// //Grab our previously stored array of known last modified dates
|
||||
// //Requires WP 2.8.0
|
||||
// $plugin_info = get_transient( $this->tran_name_plugin_timestamps );
|
||||
//
|
||||
// //Sanity check the response
|
||||
// if( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) )
|
||||
// {
|
||||
// return $plugin_meta;
|
||||
// }
|
||||
//
|
||||
// //See if this specific plugin is in the known list
|
||||
// if( array_key_exists( $plugin_file, $plugin_info ) )
|
||||
// {
|
||||
// //Get now
|
||||
// $now = new \DateTime();
|
||||
// $last_updated = $plugin_info[ $plugin_file ]['last_updated'];
|
||||
//
|
||||
// //Last updated is stored as timestamp, get a real date
|
||||
// $plugin_last_updated_date = new \DateTime( '@' . $last_updated );
|
||||
//
|
||||
// //Compute days between now and plugin last updated
|
||||
// $diff_in_days = $now->diff( $plugin_last_updated_date )->format( '%a' );
|
||||
//
|
||||
// //Customizable number of days for tolerance
|
||||
// $tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
//
|
||||
// //If we're outside the window for tolerance show a message
|
||||
// if( $diff_in_days > $tolerance_in_days )
|
||||
// {
|
||||
// $plugin_meta[] = sprintf( '<strong style="color: #f00;">This plugin has not been updated by the author in %1$d days!</strong>', $diff_in_days );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $plugin_meta[] = sprintf( '<span style="color: #090;">This plugin was last updated by the author in %1$d days ago.</span>', $diff_in_days );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $plugin_meta;
|
||||
//Grab our previously stored array of known last modified dates
|
||||
//Requires WP 2.8.0
|
||||
$plugin_info = get_transient( $this->tran_name_plugin_timestamps );
|
||||
|
||||
//Sanity check the response
|
||||
if( false === $plugin_info || ! is_array( $plugin_info ) && 0 === count( $plugin_info ) )
|
||||
{
|
||||
return $plugin_meta;
|
||||
}
|
||||
|
||||
//See if this specific plugin is in the known list
|
||||
if( array_key_exists( $plugin_file, $plugin_info ) )
|
||||
{
|
||||
//Get now
|
||||
$now = new \DateTime();
|
||||
$last_updated = $plugin_info[ $plugin_file ]['last_updated'];
|
||||
|
||||
//Last updated is stored as timestamp, get a real date
|
||||
$plugin_last_updated_date = new \DateTime( '@' . $last_updated );
|
||||
|
||||
//Compute days between now and plugin last updated
|
||||
$diff_in_days = $now->diff( $plugin_last_updated_date )->format( '%a' );
|
||||
|
||||
//Customizable number of days for tolerance
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
//If we're outside the window for tolerance show a message
|
||||
if( $diff_in_days > $tolerance_in_days )
|
||||
{
|
||||
$plugin_meta[] = sprintf( '<strong style="color: #f00;">This plugin has not been updated by the author in %1$d days!</strong>', $diff_in_days );
|
||||
}
|
||||
else
|
||||
{
|
||||
$plugin_meta[] = sprintf( '<span style="color: #090;">This plugin was last updated by the author in %1$d days ago.</span>', $diff_in_days );
|
||||
}
|
||||
}
|
||||
|
||||
return $plugin_meta;
|
||||
}
|
||||
|
||||
public function run_check() {
|
||||
|
@ -218,6 +219,7 @@ class MainWP_Child_Plugins_Check {
|
|||
$avoid_plugins = array( 'sitepress-multilingual-cms/sitepress.php' );
|
||||
//Grab a small number of plugins to scan
|
||||
$plugins_to_scan = array_splice( $all_plugins, 0, apply_filters( 'mainwp_child_plugin_health_check_max_plugins_to_batch', 10 ) );
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
//Loop through each known plugin
|
||||
foreach ( $plugins_to_scan as $slug => $v ) {
|
||||
|
@ -239,13 +241,14 @@ class MainWP_Child_Plugins_Check {
|
|||
|
||||
//Sanity check that deserialization worked and that our property exists
|
||||
if ( false !== $obj && is_object( $obj ) && property_exists( $obj, 'last_updated' ) ) {
|
||||
if ( version_compare( $v['Version'], $obj->version, '>' ) ) {
|
||||
continue;
|
||||
}
|
||||
$last_updated = strtotime( $obj->last_updated );
|
||||
$plugin_last_updated_date = new \DateTime( '@' . $last_updated );
|
||||
|
||||
$diff_in_days = $now->diff( $plugin_last_updated_date )->format( '%a' );
|
||||
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
if ( $diff_in_days < $tolerance_in_days ) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ if ( class_exists( 'MainWP_WP_Stream_Connector' ) ) {
|
|||
*/
|
||||
public static function get_action_labels() {
|
||||
return array(
|
||||
'mainwp_backup' => __( 'Backup', 'default' ),
|
||||
'mainwp_backup' => __( 'MainWP Backup', 'default' ),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<?php
|
||||
|
||||
class MainWP_Child_Server_Information {
|
||||
const WARNING = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
public static function init() {
|
||||
add_action( 'wp_ajax_mainwp-child_dismiss_warnings', array(
|
||||
'MainWP_Child_Server_Information',
|
||||
|
@ -162,17 +165,355 @@ class MainWP_Child_Server_Information {
|
|||
|
||||
public static function renderPage() {
|
||||
?>
|
||||
<script language="javascript">
|
||||
|
||||
/* FileSaver.js
|
||||
* A saveAs() FileSaver implementation.
|
||||
* 2013-01-23
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* License: X11/MIT
|
||||
* See LICENSE.md
|
||||
*/
|
||||
|
||||
/*global self */
|
||||
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,
|
||||
plusplus: true */
|
||||
|
||||
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
|
||||
|
||||
var childSaveAs = childSaveAs
|
||||
|| (navigator.msSaveBlob && navigator.msSaveBlob.bind(navigator))
|
||||
|| (function(view) {
|
||||
"use strict";
|
||||
var
|
||||
doc = view.document
|
||||
// only get URL when necessary in case BlobBuilder.js hasn't overridden it yet
|
||||
, get_URL = function() {
|
||||
return view.URL || view.webkitURL || view;
|
||||
}
|
||||
, URL = view.URL || view.webkitURL || view
|
||||
, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a")
|
||||
, can_use_save_link = "download" in save_link
|
||||
, click = function(node) {
|
||||
var event = doc.createEvent("MouseEvents");
|
||||
event.initMouseEvent(
|
||||
"click", true, false, view, 0, 0, 0, 0, 0
|
||||
, false, false, false, false, 0, null
|
||||
);
|
||||
return node.dispatchEvent(event); // false if event was cancelled
|
||||
}
|
||||
, webkit_req_fs = view.webkitRequestFileSystem
|
||||
, req_fs = view.requestFileSystem || webkit_req_fs || view.mozRequestFileSystem
|
||||
, throw_outside = function (ex) {
|
||||
(view.setImmediate || view.setTimeout)(function() {
|
||||
throw ex;
|
||||
}, 0);
|
||||
}
|
||||
, force_saveable_type = "application/octet-stream"
|
||||
, fs_min_size = 0
|
||||
, deletion_queue = []
|
||||
, process_deletion_queue = function() {
|
||||
var i = deletion_queue.length;
|
||||
while (i--) {
|
||||
var file = deletion_queue[i];
|
||||
if (typeof file === "string") { // file is an object URL
|
||||
URL.revokeObjectURL(file);
|
||||
} else { // file is a File
|
||||
file.remove();
|
||||
}
|
||||
}
|
||||
deletion_queue.length = 0; // clear queue
|
||||
}
|
||||
, dispatch = function(filesaver, event_types, event) {
|
||||
event_types = [].concat(event_types);
|
||||
var i = event_types.length;
|
||||
while (i--) {
|
||||
var listener = filesaver["on" + event_types[i]];
|
||||
if (typeof listener === "function") {
|
||||
try {
|
||||
listener.call(filesaver, event || filesaver);
|
||||
} catch (ex) {
|
||||
throw_outside(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
, FileSaver = function(blob, name) {
|
||||
// First try a.download, then web filesystem, then object URLs
|
||||
var
|
||||
filesaver = this
|
||||
, type = blob.type
|
||||
, blob_changed = false
|
||||
, object_url
|
||||
, target_view
|
||||
, get_object_url = function() {
|
||||
var object_url = get_URL().createObjectURL(blob);
|
||||
deletion_queue.push(object_url);
|
||||
return object_url;
|
||||
}
|
||||
, dispatch_all = function() {
|
||||
dispatch(filesaver, "writestart progress write writeend".split(" "));
|
||||
}
|
||||
// on any filesys errors revert to saving with object URLs
|
||||
, fs_error = function() {
|
||||
// don't create more object URLs than needed
|
||||
if (blob_changed || !object_url) {
|
||||
object_url = get_object_url(blob);
|
||||
}
|
||||
if (target_view) {
|
||||
target_view.location.href = object_url;
|
||||
}
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
}
|
||||
, abortable = function(func) {
|
||||
return function() {
|
||||
if (filesaver.readyState !== filesaver.DONE) {
|
||||
return func.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
, create_if_not_found = {create: true, exclusive: false}
|
||||
, slice
|
||||
;
|
||||
filesaver.readyState = filesaver.INIT;
|
||||
if (!name) {
|
||||
name = "download";
|
||||
}
|
||||
if (can_use_save_link) {
|
||||
object_url = get_object_url(blob);
|
||||
save_link.href = object_url;
|
||||
save_link.download = name;
|
||||
if (click(save_link)) {
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch_all();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Object and web filesystem URLs have a problem saving in Google Chrome when
|
||||
// viewed in a tab, so I force save with application/octet-stream
|
||||
// http://code.google.com/p/chromium/issues/detail?id=91158
|
||||
if (view.chrome && type && type !== force_saveable_type) {
|
||||
slice = blob.slice || blob.webkitSlice;
|
||||
blob = slice.call(blob, 0, blob.size, force_saveable_type);
|
||||
blob_changed = true;
|
||||
}
|
||||
// Since I can't be sure that the guessed media type will trigger a download
|
||||
// in WebKit, I append .download to the filename.
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=65440
|
||||
if (webkit_req_fs && name !== "download") {
|
||||
name += ".download";
|
||||
}
|
||||
if (type === force_saveable_type || webkit_req_fs) {
|
||||
target_view = view;
|
||||
} else {
|
||||
target_view = view.open();
|
||||
}
|
||||
if (!req_fs) {
|
||||
fs_error();
|
||||
return;
|
||||
}
|
||||
fs_min_size += blob.size;
|
||||
req_fs(view.TEMPORARY, fs_min_size, abortable(function(fs) {
|
||||
fs.root.getDirectory("saved", create_if_not_found, abortable(function(dir) {
|
||||
var save = function() {
|
||||
dir.getFile(name, create_if_not_found, abortable(function(file) {
|
||||
file.createWriter(abortable(function(writer) {
|
||||
writer.onwriteend = function(event) {
|
||||
target_view.location.href = file.toURL();
|
||||
deletion_queue.push(file);
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "writeend", event);
|
||||
};
|
||||
writer.onerror = function() {
|
||||
var error = writer.error;
|
||||
if (error.code !== error.ABORT_ERR) {
|
||||
fs_error();
|
||||
}
|
||||
};
|
||||
"writestart progress write abort".split(" ").forEach(function(event) {
|
||||
writer["on" + event] = filesaver["on" + event];
|
||||
});
|
||||
writer.write(blob);
|
||||
filesaver.abort = function() {
|
||||
writer.abort();
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
};
|
||||
filesaver.readyState = filesaver.WRITING;
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
};
|
||||
dir.getFile(name, {create: false}, abortable(function(file) {
|
||||
// delete file if it already exists
|
||||
file.remove();
|
||||
save();
|
||||
}), abortable(function(ex) {
|
||||
if (ex.code === ex.NOT_FOUND_ERR) {
|
||||
save();
|
||||
} else {
|
||||
fs_error();
|
||||
}
|
||||
}));
|
||||
}), fs_error);
|
||||
}), fs_error);
|
||||
}
|
||||
, FS_proto = FileSaver.prototype
|
||||
, childSaveAs = function(blob, name) {
|
||||
return new FileSaver(blob, name);
|
||||
}
|
||||
;
|
||||
FS_proto.abort = function() {
|
||||
var filesaver = this;
|
||||
filesaver.readyState = filesaver.DONE;
|
||||
dispatch(filesaver, "abort");
|
||||
};
|
||||
FS_proto.readyState = FS_proto.INIT = 0;
|
||||
FS_proto.WRITING = 1;
|
||||
FS_proto.DONE = 2;
|
||||
|
||||
FS_proto.error =
|
||||
FS_proto.onwritestart =
|
||||
FS_proto.onprogress =
|
||||
FS_proto.onwrite =
|
||||
FS_proto.onabort =
|
||||
FS_proto.onerror =
|
||||
FS_proto.onwriteend =
|
||||
null;
|
||||
|
||||
view.addEventListener("unload", process_deletion_queue, false);
|
||||
return childSaveAs;
|
||||
}(self));
|
||||
|
||||
|
||||
mwp_child_strCut = function(i,l,s,w) {
|
||||
var o = i.toString();
|
||||
if (!s) { s = '0'; }
|
||||
while (o.length < parseInt(l)) {
|
||||
// empty
|
||||
if(w == 'undefined'){
|
||||
o = s + o;
|
||||
}else{
|
||||
o = o + s;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
};
|
||||
jQuery('a.mwp-child-get-system-report-btn').live('click', function(){
|
||||
var report = "";
|
||||
jQuery('.mwp_server_info_box thead, .mwp_server_info_box tbody').each(function(){
|
||||
var td_len = [35, 55, 45, 12, 12];
|
||||
var th_count = 0;
|
||||
var i;
|
||||
if ( jQuery( this ).is('thead') ) {
|
||||
i = 0;
|
||||
report = report + "\n### ";
|
||||
th_count = jQuery( this ).find('th:not(".mwp-not-generate-row")').length;
|
||||
jQuery( this ).find('th:not(".mwp-not-generate-row")').each(function(){
|
||||
var len = td_len[i];
|
||||
if (i == 0 || i == th_count -1)
|
||||
len = len - 4;
|
||||
report = report + mwp_child_strCut(jQuery.trim( jQuery( this ).text()), len, ' ' );
|
||||
i++;
|
||||
});
|
||||
report = report + " ###\n\n";
|
||||
} else {
|
||||
jQuery('tr', jQuery( this )).each(function(){
|
||||
if (jQuery( this ).hasClass('mwp-not-generate-row'))
|
||||
return;
|
||||
i = 0;
|
||||
jQuery( this ).find('td:not(".mwp-not-generate-row")').each(function(){
|
||||
if (jQuery( this ).hasClass('mwp-hide-generate-row')) {
|
||||
report = report + mwp_child_strCut(' ', td_len[i], ' ' );
|
||||
i++;
|
||||
return;
|
||||
}
|
||||
report = report + mwp_child_strCut(jQuery.trim( jQuery( this ).text()), td_len[i], ' ' );
|
||||
i++;
|
||||
});
|
||||
report = report + "\n";
|
||||
});
|
||||
|
||||
}
|
||||
} );
|
||||
|
||||
try {
|
||||
jQuery("#mwp-server-information").slideDown();
|
||||
jQuery("#mwp-server-information textarea").val( report ).focus().select();
|
||||
jQuery(this).fadeOut();
|
||||
jQuery('.mwp_child_close_srv_info').show();
|
||||
return false;
|
||||
} catch(e){ }
|
||||
});
|
||||
|
||||
jQuery('a#mwp_child_close_srv_info').live('click', function(){
|
||||
jQuery('#mwp-server-information').hide();
|
||||
jQuery('.mwp_child_close_srv_info').hide();
|
||||
jQuery('a.mwp-child-get-system-report-btn').show();
|
||||
return false;
|
||||
});
|
||||
jQuery('#mwp_child_download_srv_info').live('click', function () {
|
||||
var server_info = jQuery('#mwp-server-information textarea').val();
|
||||
var blob = new Blob([server_info], {type: "text/plain;charset=utf-8"});
|
||||
childSaveAs(blob, "server_child_information.txt");
|
||||
});
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
#mwp-server-information {
|
||||
display: none;
|
||||
margin: 10px 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#mwp-server-information textarea {
|
||||
border-radius: 0;
|
||||
font-family: monospace;
|
||||
font-size: 12px;
|
||||
height: 300px;
|
||||
line-height: 20px;
|
||||
margin: 0;
|
||||
outline: 0 none;
|
||||
padding: 20px;
|
||||
resize: none;
|
||||
width: 100%;
|
||||
-moz-border-radius:0;
|
||||
-webkit-border-radius:0;
|
||||
}
|
||||
|
||||
.mwp_child_close_srv_info {
|
||||
display: none;
|
||||
float: right;
|
||||
margin: 5px 0 5px;
|
||||
}
|
||||
</style>
|
||||
<div class="wrap">
|
||||
<h2><?php esc_html_e( 'Plugin Conflicts' ); ?></h2>
|
||||
<br/><?php
|
||||
MainWP_Child_Server_Information::renderConflicts();
|
||||
?><h2><?php esc_html_e( 'Server Information' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::render();
|
||||
?><h2><?php esc_html_e( 'Cron Schedules' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::renderCron();
|
||||
?><h2><?php esc_html_e( 'Error Log' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::renderErrorLogPage();
|
||||
?>
|
||||
<br/>
|
||||
<div class="updated below-h2">
|
||||
<p><?php _e( 'Please include this information when requesting support:', 'mainwp' ); ?></p>
|
||||
<span class="mwp_child_close_srv_info"><a href="#" id="mwp_child_download_srv_info"><?php _e( 'Download', 'mainwp' ); ?></a> | <a href="#" id="mwp_child_close_srv_info"><i class="fa fa-eye-slash"></i> <?php _e( 'Hide', 'mainwp' ); ?>
|
||||
</a></span>
|
||||
|
||||
<p class="submit">
|
||||
<a class="button-primary mwp-child-get-system-report-btn" href="#"><?php _e( 'Get System Report', 'mainwp' ); ?></a>
|
||||
</p>
|
||||
|
||||
<div id="mwp-server-information"><textarea readonly="readonly" wrap="off"></textarea></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="mwp_server_info_box">
|
||||
<?php
|
||||
MainWP_Child_Server_Information::renderConflicts();
|
||||
?><h2><?php esc_html_e( 'Server Information' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::render();
|
||||
?><h2><?php esc_html_e( 'Cron Schedules' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::renderCron();
|
||||
?><h2><?php esc_html_e( 'Error Log' ); ?></h2><?php
|
||||
MainWP_Child_Server_Information::renderErrorLogPage();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
@ -339,7 +680,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
?>
|
||||
<br/>
|
||||
|
||||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -372,17 +713,43 @@ class MainWP_Child_Server_Information {
|
|||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'WORDPRESS', 'mainwp-child' ); ?></td>
|
||||
</tr><?php
|
||||
self::renderRow( 'WordPress Version', '>=', '3.4', 'getWordpressVersion' );
|
||||
self::renderRow( 'WordPress Memory Limit', '>=', '64M', 'getWordpressMemoryLimit' );
|
||||
self::renderRow( 'MultiSite Disabled', '=', true, 'checkIfMultisite' );
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
colspan="5"><?php esc_html_e( 'PHP SETTINGS', 'mainwp-child' ); ?></td>
|
||||
</tr><?php
|
||||
self::renderRow( 'PHP Version', '>=', '5.3', 'getPHPVersion' );
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getPHPSafeMode(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
self::renderRow( 'PHP Max Execution Time', '>=', '30', 'getMaxExecutionTime', 'seconds', '=', '0' );
|
||||
self::renderRowSec( 'PHP Max Input Time', '>=', '30', 'getMaxInputTime', 'seconds', '=', '0' );
|
||||
self::renderRow( 'PHP Memory Limit', '>=', '128M', 'getPHPMemoryLimit', '(256M+ best for big backups)', null, null, true );
|
||||
self::renderRow( 'PHP Upload Max Filesize', '>=', '2M', 'getUploadMaxFilesize', '(2MB+ best for upload of big plugins)', null, null, true );
|
||||
self::renderRow( 'PHP Post Max Size', '>=', '2M', 'getPostMaxSize', '(2MB+ best for upload of big plugins)', null, null, true );
|
||||
self::renderRow( 'PHP Memory Limit', '>=', '128M', 'getPHPMemoryLimit', '(256M+ best for big backups)', null, null, true );
|
||||
self::renderRow( 'SSL Extension Enabled', '=', true, 'getSSLSupport' );
|
||||
self::renderRowSec( 'SSL Warnings', '=', '', 'getSSLWarning', 'empty', '' );
|
||||
self::renderRowSec( 'cURL Extension Enabled', '=', true, 'getCurlSupport', '', '', null, '', null, self::ERROR );
|
||||
self::renderRowSec( 'cURL Timeout', '>=', '300', 'getCurlTimeout', 'seconds', '=', '0' );
|
||||
if ( function_exists( 'curl_version' ) ) {
|
||||
self::renderRowSec( 'cURL Version', '>=', '7.18.1', 'getCurlVersion', '', '', null );
|
||||
self::renderRowSec( 'cURL SSL Version', '>=', array(
|
||||
'version_number' => 0x009080cf,
|
||||
'version' => 'OpenSSL/0.9.8l',
|
||||
), 'getCurlSSLVersion', '', '', null, '', 'curlssl' );
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
colspan="5"><?php esc_html_e( 'MySQL SETTINGS', 'mainwp-child' ); ?></td>
|
||||
</tr><?php
|
||||
self::renderRow( 'MySQL Version', '>=', '5.0', 'getMySQLVersion' );
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'MISC', 'mainwp-child' ); ?></td>
|
||||
|
@ -395,20 +762,11 @@ class MainWP_Child_Server_Information {
|
|||
<td><?php echo esc_html( '= ' . __( 'direct', 'mainwp' ) ); ?></td>
|
||||
<td><?php echo esc_html( self::getFileSystemMethod() ); ?></td>
|
||||
<td><?php echo esc_html( self::getFileSystemMethodCheck() ); ?></td>
|
||||
</tr><?php
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
colspan="5"><?php esc_html_e( 'MySQL SETTINGS', 'mainwp-child' ); ?></td>
|
||||
</tr><?php
|
||||
self::renderRow( 'MySQL Version', '>=', '5.0', 'getMySQLVersion' );
|
||||
?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
colspan="5"><?php esc_html_e( 'BACKUP ARCHIVE INFORMATION', 'mainwp-child' ); ?></td>
|
||||
</tr><?php
|
||||
|
||||
self::renderRow( 'ZipArchive enabled in PHP', '=', true, 'getZipArchiveEnabled' );
|
||||
self::renderRow( 'Tar GZip supported', '=', true, 'getGZipEnabled' );
|
||||
self::renderRow( 'Tar BZip2 supported', '=', true, 'getBZipEnabled' );
|
||||
|
@ -430,7 +788,7 @@ class MainWP_Child_Server_Information {
|
|||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Sofware', 'mainwp' ); ?></td>
|
||||
<td><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerSoftware(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -458,6 +816,21 @@ class MainWP_Child_Server_Information {
|
|||
<td><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getHTTPHost(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getHTTPS(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php _e( 'Sever self connect', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::serverSelfConnect(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getUserAgent(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Admin', 'mainwp' ); ?></td>
|
||||
|
@ -478,16 +851,6 @@ class MainWP_Child_Server_Information {
|
|||
<td><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::memoryUsage(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getHTTPS(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getUserAgent(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Complete URL', 'mainwp' ); ?></td>
|
||||
|
@ -566,11 +929,6 @@ class MainWP_Child_Server_Information {
|
|||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp' ); ?></td>
|
||||
<td colspan="3"><?php self::getPHPSafeMode(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td>
|
||||
|
@ -621,6 +979,33 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
protected static function getCurlSupport() {
|
||||
return function_exists( 'curl_version' );
|
||||
}
|
||||
|
||||
protected static function getCurlTimeout() {
|
||||
return ini_get( 'default_socket_timeout' );
|
||||
}
|
||||
|
||||
protected static function getCurlVersion() {
|
||||
$curlversion = curl_version();
|
||||
|
||||
return $curlversion['version'];
|
||||
}
|
||||
|
||||
protected static function curlssl_compare( $value, $operator = null ) {
|
||||
if ( isset( $value['version_number'] ) && defined( 'OPENSSL_VERSION_NUMBER' ) ) {
|
||||
return version_compare( OPENSSL_VERSION_NUMBER, $value['version_number'], $operator );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static function getCurlSSLVersion() {
|
||||
$curlversion = curl_version();
|
||||
|
||||
return $curlversion['ssl_version'];
|
||||
}
|
||||
|
||||
public static function mainwpRequiredFunctions() {
|
||||
//error_reporting(E_ALL);
|
||||
|
@ -714,7 +1099,7 @@ class MainWP_Child_Server_Information {
|
|||
if ( MainWP_Child_Branding::is_branding() ) {
|
||||
$branding_title = MainWP_Child_Branding::get_branding();
|
||||
}
|
||||
$branding_title .= ' upload directory';
|
||||
$branding_title .= ' Upload Directory';
|
||||
|
||||
try {
|
||||
$dirs = MainWP_Helper::getMainWPDir( null, false );
|
||||
|
@ -761,7 +1146,7 @@ class MainWP_Child_Server_Information {
|
|||
|
||||
protected static function renderDirectoryRow( $pName, $pDirectory, $pCheck, $pResult, $pPassed ) {
|
||||
?>
|
||||
<tr>
|
||||
<tr class="mwp-not-generate-row">
|
||||
<td></td>
|
||||
<td><?php echo esc_html( stripslashes( $pName ) ); ?><br/><?php echo esc_html( ( MainWP_Child_Branding::is_branding() ) ? '' : $pDirectory ); ?>
|
||||
</td>
|
||||
|
@ -791,6 +1176,35 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
protected static function renderRowSec( $pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $toolTip = null, $whatType = null, $errorType = self::WARNING ) {
|
||||
$currentVersion = call_user_func( array( 'MainWP_Child_Server_Information', $pGetter ) );
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php echo $pConfig; ?></td>
|
||||
<td><?php echo $pCompare; ?><?php echo ( $pVersion === true ? 'true' : ( is_array( $pVersion ) && isset( $pVersion['version'] ) ? $pVersion['version'] : $pVersion ) ) . ' ' . $pExtraText; ?></td>
|
||||
<td><?php echo( $currentVersion === true ? 'true' : $currentVersion ); ?></td>
|
||||
<?php if ( $whatType == 'filesize' ) { ?>
|
||||
<td><?php echo( self::filesize_compare( $currentVersion, $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType ) ); ?></td>
|
||||
<?php } else if ( $whatType == 'curlssl' ) { ?>
|
||||
<td><?php echo( self::curlssl_compare( $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType ) ); ?></td>
|
||||
<?php } else if ($pGetter == 'getMaxInputTime' && $currentVersion == -1) { ?>
|
||||
<td><?php echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>'; ?></td>
|
||||
<?php } else { ?>
|
||||
<td><?php echo (version_compare($currentVersion, $pVersion, $pCompare) || (($pExtraCompare != null) && version_compare($currentVersion, $pExtraVersion, $pExtraCompare)) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType )); ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
private static function getWarningHTML($errorType = self::WARNING)
|
||||
{
|
||||
if (self::WARNING == $errorType) {
|
||||
return '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>';
|
||||
}
|
||||
return '<span class="mainwp-fail"><i class="fa fa-exclamation-circle"></i> Fail</span>';
|
||||
}
|
||||
|
||||
protected static function filesize_compare( $value1, $value2, $operator = null ) {
|
||||
if ( strpos( $value1, 'G' ) !== false ) {
|
||||
$value1 = preg_replace( '/[A-Za-z]/', '', $value1 );
|
||||
|
@ -833,10 +1247,32 @@ class MainWP_Child_Server_Information {
|
|||
return $wp_version;
|
||||
}
|
||||
|
||||
protected static function getWordpressMemoryLimit() {
|
||||
return WP_MEMORY_LIMIT;
|
||||
}
|
||||
|
||||
public static function checkIfMultisite() {
|
||||
$isMultisite = ! is_multisite() ? true : false;
|
||||
|
||||
return $isMultisite;
|
||||
}
|
||||
|
||||
protected static function getSSLSupport() {
|
||||
return extension_loaded( 'openssl' );
|
||||
}
|
||||
|
||||
protected static function getSSLWarning() {
|
||||
$conf = array( 'private_key_bits' => 384 );
|
||||
$str = '';
|
||||
if ( function_exists( 'openssl_pkey_new' ) ) {
|
||||
$res = @openssl_pkey_new( $conf );
|
||||
@openssl_pkey_export( $res, $privkey );
|
||||
|
||||
$str = openssl_error_string();
|
||||
}
|
||||
return ( stristr( $str, 'NCONF_get_string:no value' ) ? '' : $str );
|
||||
}
|
||||
|
||||
protected static function getPHPVersion() {
|
||||
return phpversion();
|
||||
}
|
||||
|
@ -860,6 +1296,10 @@ class MainWP_Child_Server_Information {
|
|||
return $wpdb->get_var( 'SHOW VARIABLES LIKE "version"', 1 );
|
||||
}
|
||||
|
||||
protected static function getMaxInputTime() {
|
||||
return ini_get( 'max_input_time' );
|
||||
}
|
||||
|
||||
protected static function getPHPMemoryLimit() {
|
||||
return ini_get( 'memory_limit' );
|
||||
}
|
||||
|
@ -1012,6 +1452,35 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function serverSelfConnect() {
|
||||
$url = site_url( 'wp-cron.php' );
|
||||
$query_args = array('mainwp_child_run' => 'test');
|
||||
$url = add_query_arg( $query_args, $url );
|
||||
$args = array( 'blocking' => TRUE,
|
||||
'sslverify' => apply_filters( 'https_local_ssl_verify', true ),
|
||||
'timeout' => 15
|
||||
);
|
||||
$response = wp_remote_post( $url, $args );
|
||||
$test_result = '';
|
||||
if ( is_wp_error( $response ) ) {
|
||||
$test_result .= sprintf( __( 'The HTTP response test get an error "%s"','mainwp' ), $response->get_error_message() );
|
||||
}
|
||||
$response_code = wp_remote_retrieve_response_code( $response );
|
||||
if ( $response_code < 200 && $response_code > 204 ) {
|
||||
$test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','mainwp' ), wp_remote_retrieve_response_code( $response ) );
|
||||
} else {
|
||||
$response_body = wp_remote_retrieve_body( $response );
|
||||
if ( FALSE === strstr( $response_body, 'MainWP Test' ) ) {
|
||||
$test_result .= sprintf( __( 'Not expected HTTP response body: %s','mainwp' ), esc_attr( strip_tags( $response_body ) ) );
|
||||
}
|
||||
}
|
||||
if ( empty( $test_result ) ) {
|
||||
_e( 'Response Test O.K.', 'mainwp' );
|
||||
} else
|
||||
echo $test_result;
|
||||
}
|
||||
|
||||
|
||||
protected static function getRemoteAddress() {
|
||||
echo esc_html( $_SERVER['REMOTE_ADDR'] );
|
||||
}
|
||||
|
|
|
@ -167,6 +167,7 @@ class MainWP_Child_Themes_Check {
|
|||
}
|
||||
|
||||
$themes_to_scan = array_splice( $all_themes, 0, apply_filters( 'mainwp_child_theme_health_check_max_themes_to_batch', 10 ) );
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
foreach ( $themes_to_scan as $slug => $v ) {
|
||||
|
||||
|
@ -188,7 +189,6 @@ class MainWP_Child_Themes_Check {
|
|||
|
||||
$diff_in_days = $now->diff( $theme_last_updated_date )->format( '%a' );
|
||||
|
||||
$tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
|
||||
|
||||
if ( $diff_in_days < $tolerance_in_days ) {
|
||||
continue;
|
||||
|
|
|
@ -585,8 +585,8 @@ class MainWP_Child_Wordfence {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $regenerateHtaccess ) {
|
||||
wfCache::addHtaccessCode( 'add' );
|
||||
if ( $regenerateHtaccess && ( wfConfig::get('cacheType') == 'falcon' ) ) {
|
||||
wfCache::addHtaccessCode('add');
|
||||
}
|
||||
|
||||
if ( '1' === $opts['autoUpdate'] ) {
|
||||
|
@ -807,15 +807,15 @@ class MainWP_Child_Wordfence {
|
|||
}
|
||||
if ( self::getLog()->isWhitelisted( $IP ) ) {
|
||||
return array(
|
||||
'err' => 1,
|
||||
'errorMsg' => 'The IP address ' . htmlentities( $IP ) . " is whitelisted and can't be blocked or it is in a range of internal IP addresses that Wordfence does not block. You can remove this IP from the whitelist on the Wordfence options page.",
|
||||
'err' => 1,
|
||||
'errorMsg' => 'The IP address ' . htmlentities( $IP ) . " is whitelisted and can't be blocked or it is in a range of internal IP addresses that Wordfence does not block. You can remove this IP from the whitelist on the Wordfence options page.",
|
||||
);
|
||||
}
|
||||
if ( wfConfig::get( 'neverBlockBG' ) !== 'treatAsOtherCrawlers' ) { //Either neverBlockVerified or neverBlockUA is selected which means the user doesn't want to block google
|
||||
if ( wfCrawl::verifyCrawlerPTR( '/googlebot\.com$/i', $IP ) ) {
|
||||
return array(
|
||||
'err' => 1,
|
||||
'errorMsg' => "The IP address you're trying to block belongs to Google. Your options are currently set to not block these crawlers. Change this in Wordfence options if you want to manually block Google.",
|
||||
'err' => 1,
|
||||
'errorMsg' => "The IP address you're trying to block belongs to Google. Your options are currently set to not block these crawlers. Change this in Wordfence options if you want to manually block Google.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
|
|||
}
|
||||
|
||||
class MainWP_Child {
|
||||
public static $version = '3.1';
|
||||
public static $version = '3.1.1';
|
||||
private $update_version = '1.3';
|
||||
|
||||
private $callableFunctions = array(
|
||||
|
@ -209,6 +209,14 @@ class MainWP_Child {
|
|||
}
|
||||
add_action( 'admin_notices', array( &$this, 'admin_notice' ) );
|
||||
add_filter( 'plugin_row_meta', array( &$this, 'plugin_row_meta' ), 10, 2 );
|
||||
|
||||
//WP-Cron
|
||||
if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
|
||||
if ( isset($_GET[ 'mainwp_child_run' ]) && ! empty( $_GET[ 'mainwp_child_run' ] ) ) {
|
||||
add_action( 'init', array( $this, 'cron_active' ), PHP_INT_MAX );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
@ -350,6 +358,24 @@ class MainWP_Child {
|
|||
MainWP_Helper::update_option( 'mainwp_child_update_version', $this->update_version, 'yes' );
|
||||
}
|
||||
|
||||
function cron_active() {
|
||||
if ( ! defined( 'DOING_CRON' ) || ! DOING_CRON ) {
|
||||
return;
|
||||
}
|
||||
if ( empty( $_GET[ 'mainwp_child_run' ] ) || 'test' !== $_GET[ 'mainwp_child_run' ] ) {
|
||||
return;
|
||||
}
|
||||
@session_write_close();
|
||||
@header( 'Content-Type: text/html; charset=' . get_bloginfo( 'charset' ), TRUE );
|
||||
@header( 'X-Robots-Tag: noindex, nofollow', TRUE );
|
||||
@header( 'X-MainWP-Child-Version: ' . MainWP_Child::$version, TRUE );
|
||||
nocache_headers();
|
||||
if ( $_GET[ 'mainwp_child_run' ] == 'test' ) {
|
||||
die( 'MainWP Test' );
|
||||
}
|
||||
die( '' );
|
||||
}
|
||||
|
||||
public function admin_notice() {
|
||||
//Admin Notice...
|
||||
if ( is_plugin_active( 'mainwp-child/mainwp-child.php' ) ) {
|
||||
|
@ -2871,6 +2897,8 @@ class MainWP_Child {
|
|||
$information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info();
|
||||
$information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info();
|
||||
|
||||
do_action('mainwp_child_site_stats');
|
||||
|
||||
if ( $exit ) {
|
||||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ class MainWP_Client_Report {
|
|||
|
||||
public static function init() {
|
||||
add_filter( 'wp_stream_connectors', array( 'MainWP_Client_Report', 'init_stream_connectors' ), 10, 1 );
|
||||
add_filter( 'mainwp_client_reports_connectors', array( 'MainWP_Client_Report', 'init_connectors' ), 10, 1 );
|
||||
add_filter( 'mainwp_client_reports_connectors', array( 'MainWP_Client_Report', 'init_report_connectors' ), 10, 1 );
|
||||
}
|
||||
|
||||
public static function init_stream_connectors( $classes ) {
|
||||
|
@ -41,10 +41,10 @@ class MainWP_Client_Report {
|
|||
return $classes;
|
||||
}
|
||||
|
||||
public static function init_connectors( $classes ) {
|
||||
public static function init_report_connectors( $classes ) {
|
||||
$connectors = array(
|
||||
'Backups',
|
||||
'Sucuri',
|
||||
'Sucuri'
|
||||
);
|
||||
|
||||
foreach ( $connectors as $connector ) {
|
||||
|
@ -366,7 +366,7 @@ class MainWP_Client_Report {
|
|||
continue;
|
||||
}
|
||||
} else if ( 'mainwp_backups' === $context ) {
|
||||
if ( $record->context !== 'mainwp_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' ) {
|
||||
if ( $record->context !== 'mainwp_backups' && $record->context !== 'backwpup_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' ) {
|
||||
continue;
|
||||
}
|
||||
} else if ( 'mainwp_sucuri' === $context ) {
|
||||
|
@ -485,7 +485,7 @@ class MainWP_Client_Report {
|
|||
$users_updated = true;
|
||||
}
|
||||
} else if ( 'mainwp_backups' === $context ) {
|
||||
if ( $record->context !== 'mainwp_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' ) {
|
||||
if ( $record->context !== 'mainwp_backups' && $record->context !== 'backwpup_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups' ) {
|
||||
continue;
|
||||
}
|
||||
} else if ( 'mainwp_sucuri' === $context ) {
|
||||
|
|
|
@ -162,8 +162,8 @@ class MainWP_Helper {
|
|||
|
||||
$response = wp_remote_get( $file_url, array(
|
||||
'timeout' => 10 * 60 * 60,
|
||||
'stream' => true,
|
||||
'filename' => $full_file_name,
|
||||
'stream' => true,
|
||||
'filename' => $full_file_name,
|
||||
) );
|
||||
|
||||
if ( is_wp_error( $response ) ) {
|
||||
|
@ -899,7 +899,7 @@ class MainWP_Helper {
|
|||
<div style="display: block; width: 95% ; margin-left: auto ; margin-right: auto ; padding: .5em 0 ;">
|
||||
<div style="float: left;"><a href="http://mainwp.com"><img src="http://mainwp.com/wp-content/uploads/2013/07/MainWP-Logo-1000-300x62.png" alt="MainWP" height="30"/></a></div>
|
||||
<div style="float: right; margin-top: .6em ;">
|
||||
<span style="display: inline-block; margin-right: .8em;"><a href="http://extensions.mainwp.com" style="font-family: Helvetica, Sans; color: #7fb100; text-transform: uppercase; font-size: 14px;">Extensions</a></span>
|
||||
<span style="display: inline-block; margin-right: .8em;"><a href="https://mainwp.com/mainwp-extensions/" style="font-family: Helvetica, Sans; color: #7fb100; text-transform: uppercase; font-size: 14px;">Extensions</a></span>
|
||||
<span style="display: inline-block; margin-right: .8em;"><a style="font-family: Helvetica, Sans; color: #7fb100; text-transform: uppercase; font-size: 14px;" href="http://mainwp.com/forum">Support</a></span>
|
||||
<span style="display: inline-block; margin-right: .8em;"><a style="font-family: Helvetica, Sans; color: #7fb100; text-transform: uppercase; font-size: 14px;" href="http://docs.mainwp.com">Documentation</a></span>
|
||||
<span style="display: inline-block; margin-right: .5em;" class="mainwp-memebers-area"><a href="http://mainwp.com/member/login/index" style="padding: .6em .5em ; border-radius: 50px ; -moz-border-radius: 50px ; -webkit-border-radius: 50px ; background: #1c1d1b; border: 1px Solid #000; color: #fff !important; font-size: .9em !important; font-weight: normal ; -webkit-box-shadow: 0px 0px 0px 5px rgba(0, 0, 0, .1); box-shadow: 0px 0px 0px 5px rgba(0, 0, 0, .1);">Members Area</a></span>
|
||||
|
|
|
@ -39,7 +39,7 @@ if ( class_exists( 'WP_Stream\Connector' ) ) {
|
|||
*/
|
||||
public function get_action_labels() {
|
||||
return array(
|
||||
'mainwp_backup' => __( 'Backup', 'default' ),
|
||||
'mainwp_backup' => __( 'MainWP Backup', 'default' ),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue