sync with branch01 + refactoring

This commit is contained in:
ruben- 2017-01-14 13:16:52 +01:00
parent 37e134a03b
commit a3c6318cce
15 changed files with 363 additions and 249 deletions

View file

@ -26,9 +26,7 @@ class MainWP_Child_Back_Up_Buddy {
} }
add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) ); add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) );
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
if ( get_option( 'mainwp_backupbuddy_hide_plugin' ) === 'hide' ) { if ( get_option( 'mainwp_backupbuddy_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) ); add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -73,10 +71,10 @@ class MainWP_Child_Back_Up_Buddy {
function do_site_stats() { function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backupbuddy'); do_action( 'mainwp_child_reports_log', 'backupbuddy');
} }
function do_reports_backups($ext = '') { function do_reports_log($ext = '') {
if ($ext !== 'backupbuddy') if ($ext !== 'backupbuddy')
return; return;

View file

@ -19,15 +19,10 @@ class MainWP_Child_Back_Up_Wordpress {
} }
public function init() { public function init() {
if ( get_option( 'mainwp_backupwordpress_ext_enabled' ) !== 'Y' ) { if ( get_option( 'mainwp_backupwordpress_ext_enabled' ) !== 'Y' ) return;
return; if (!$this->is_plugin_installed) return;
}
if (!$this->is_plugin_installed)
return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
if ( get_option( 'mainwp_backupwordpress_hide_plugin' ) === 'hide' ) { if ( get_option( 'mainwp_backupwordpress_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) ); add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -151,12 +146,12 @@ class MainWP_Child_Back_Up_Wordpress {
} }
function do_site_stats() { function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backupwordpress'); do_action( 'mainwp_child_reports_log', 'backupwordpress');
} }
function do_reports_backups($ext = '') { public function do_reports_log($ext = '') {
if ($ext !== 'backupwordpress') if ( $ext !== 'backupwordpress' ) return;
return;
// Refresh the schedules from the database to make sure we have the latest changes // Refresh the schedules from the database to make sure we have the latest changes
HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules(); HM\BackUpWordPress\Schedules::get_instance()->refresh_schedules();
$schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules(); $schedules = HM\BackUpWordPress\Schedules::get_instance()->get_schedules();
@ -167,12 +162,13 @@ class MainWP_Child_Back_Up_Wordpress {
$destination = "N/A"; $destination = "N/A";
if ( file_exists( $file ) ) { if ( file_exists( $file ) ) {
$date = @filemtime( $file ); $date = @filemtime( $file );
if (!empty($date)) if ( !empty( $date ) ) {
do_action( "backupwordpress_backup", $destination, $message, 'finished', $backup_type, $date ); do_action( "backupwordpress_backup", $destination, $message, 'finished', $backup_type, $date );
} }
} }
} }
} }
}
function set_showhide() { function set_showhide() {
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : ''; $hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';

View file

@ -188,7 +188,6 @@ class MainWP_Child_Back_WP_Up {
return; return;
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
add_action( 'mainwp_extensions_reports_backups', array( $this, 'do_reports_backups' ) );
if ( get_option( 'mainwp_backwpup_hide_plugin' ) === 'hide' ) { if ( get_option( 'mainwp_backwpup_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) ); add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
@ -197,12 +196,11 @@ class MainWP_Child_Back_WP_Up {
} }
function do_site_stats() { function do_site_stats() {
do_action( 'mainwp_client_reports_backups', 'backwpup'); do_action( 'mainwp_child_reports_log', 'backwpup');
} }
function do_reports_backups($ext = '') { public function do_reports_log($ext = '') {
if ($ext !== 'backwpup') if ( $ext !== 'backwpup' ) return;
return;
$destinations = BackWPup::get_registered_destinations(); $destinations = BackWPup::get_registered_destinations();
$jobdests = $this->get_destinations_list(); $jobdests = $this->get_destinations_list();
@ -228,7 +226,6 @@ class MainWP_Child_Back_WP_Up {
} }
} }
} }
} }
function get_destinations_list() { function get_destinations_list() {

View file

@ -3,6 +3,7 @@
class MainWP_Child_Links_Checker { class MainWP_Child_Links_Checker {
public static $instance = null; public static $instance = null;
public $is_plugin_installed = false;
static function Instance() { static function Instance() {
if ( null === MainWP_Child_Links_Checker::$instance ) { if ( null === MainWP_Child_Links_Checker::$instance ) {
@ -12,6 +13,13 @@ class MainWP_Child_Links_Checker {
return MainWP_Child_Links_Checker::$instance; return MainWP_Child_Links_Checker::$instance;
} }
public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'broken-link-checker/broken-link-checker.php' ) ) {
$this->is_plugin_installed = true;
}
}
public function action() { public function action() {
$information = array(); $information = array();
if ( ! defined( 'BLC_ACTIVE' ) || ! function_exists( 'blc_init' ) ) { if ( ! defined( 'BLC_ACTIVE' ) || ! function_exists( 'blc_init' ) ) {
@ -177,19 +185,16 @@ class MainWP_Child_Links_Checker {
function sync_data( $strategy = '' ) { function sync_data( $strategy = '' ) {
$information = array(); $information = array();
$data = $this->get_count_links(); $data = $this->get_count_links();
if (is_array($data))
// $max_results = isset($_POST['max_results']) ? intval($_POST['max_results']) : 50;
// $params = array( array( 'load_instances' => true ),
// 'max_results' => $max_results
// );
//$data['link_data'] = $this->do_sync_links_data($params);
$information['data'] = $data; $information['data'] = $data;
return $information; return $information;
} }
function sync_links_data() { function sync_links_data() {
if (!defined('BLC_DIRECTORY')) return;
require_once BLC_DIRECTORY . '/includes/link-query.php';
require_once BLC_DIRECTORY . '/includes/modules.php';
$blc_link_query = blcLinkQuery::getInstance(); $blc_link_query = blcLinkQuery::getInstance();
$total = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) ); $total = $blc_link_query->get_filter_links( 'all', array( 'count_only' => true ) );
@ -227,6 +232,11 @@ class MainWP_Child_Links_Checker {
} }
function get_count_links() { function get_count_links() {
if (!defined('BLC_DIRECTORY')) return;
require_once BLC_DIRECTORY . '/includes/link-query.php';
require_once BLC_DIRECTORY . '/includes/modules.php';
$data = array(); $data = array();
$blc_link_query = blcLinkQuery::getInstance(); $blc_link_query = blcLinkQuery::getInstance();
$data['broken'] = $blc_link_query->get_filter_links( 'broken', array( 'count_only' => true ) ); $data['broken'] = $blc_link_query->get_filter_links( 'broken', array( 'count_only' => true ) );

View file

@ -3,6 +3,7 @@
class MainWP_Child_Pagespeed { class MainWP_Child_Pagespeed {
public static $instance = null; public static $instance = null;
public $is_plugin_installed = false;
static function Instance() { static function Instance() {
if ( null === MainWP_Child_Pagespeed::$instance ) { if ( null === MainWP_Child_Pagespeed::$instance ) {
@ -13,6 +14,11 @@ class MainWP_Child_Pagespeed {
} }
public function __construct() { public function __construct() {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'google-pagespeed-insights/google-pagespeed-insights.php' ) ) {
$this->is_plugin_installed = true;
}
add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) ); add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) );
} }
@ -243,7 +249,7 @@ class MainWP_Child_Pagespeed {
return false; return false;
} }
function sync_data( $strategy = '' ) { public function sync_data( $strategy = '' ) {
if ( empty( $strategy ) ) { if ( empty( $strategy ) ) {
$strategy = 'both'; $strategy = 'both';
} }

View file

@ -461,12 +461,12 @@ class MainWP_Child_Server_Information {
</style> </style>
<div class="wrap"> <div class="wrap">
<div class="updated below-h2"> <div class="updated below-h2">
<p><?php _e( 'Please include this information when requesting support:', 'mainwp' ); ?></p> <p><?php _e( 'Please include this information when requesting support:', 'mainwp-child' ); ?></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' ); ?> <span class="mwp_child_close_srv_info"><a href="#" id="mwp_child_download_srv_info"><?php _e( 'Download', 'mainwp-child' ); ?></a> | <a href="#" id="mwp_child_close_srv_info"><i class="fa fa-eye-slash"></i> <?php _e( 'Hide', 'mainwp-child' ); ?>
</a></span> </a></span>
<p class="submit"> <p class="submit">
<a class="button-primary mwp-child-get-system-report-btn" href="#"><?php _e( 'Get system report', 'mainwp' ); ?></a> <a class="button-primary mwp-child-get-system-report-btn" href="#"><?php _e( 'Get system report', 'mainwp-child' ); ?></a>
</p> </p>
<div id="mwp-server-information"><textarea readonly="readonly" wrap="off"></textarea></div> <div id="mwp-server-information"><textarea readonly="readonly" wrap="off"></textarea></div>
@ -552,9 +552,9 @@ class MainWP_Child_Server_Information {
<th scope="col" class="manage-column column-posts" style=""> <th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Server configuration', 'mainwp-child' ); ?></span></th> <span><?php esc_html_e( 'Server configuration', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" <th scope="col" class="manage-column column-posts"
style=""><?php esc_html_e( 'Required value', 'mainwp' ); ?></th> style=""><?php esc_html_e( 'Required value', 'mainwp-child' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Value', 'mainwp' ); ?></th> <th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Value', 'mainwp-child' ); ?></th>
<th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Status', 'mainwp' ); ?></th> <th scope="col" class="manage-column column-posts" style=""><?php esc_html_e( 'Status', 'mainwp-child' ); ?></th>
</tr> </tr>
</thead> </thead>
@ -589,8 +589,8 @@ class MainWP_Child_Server_Information {
?> ?>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'FileSystem Method', 'mainwp' ); ?></td> <td><?php esc_html_e( 'FileSystem Method', 'mainwp-child' ); ?></td>
<td><?php echo esc_html( '= ' . __( 'direct', 'mainwp' ) ); ?></td> <td><?php echo esc_html( '= direct' ); ?></td>
<td><?php echo esc_html( self::getFileSystemMethod() ); ?></td> <td><?php echo esc_html( self::getFileSystemMethod() ); ?></td>
<td><?php echo esc_html( self::getFileSystemMethodCheck() ); ?></td> <td><?php echo esc_html( self::getFileSystemMethodCheck() ); ?></td>
</tr> </tr>
@ -602,7 +602,7 @@ class MainWP_Child_Server_Information {
?> ?>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP Safe Mode Disabled', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPSafeMode(); ?></td> <td colspan="3"><?php self::getPHPSafeMode(); ?></td>
</tr> </tr>
<?php <?php
@ -641,172 +641,172 @@ class MainWP_Child_Server_Information {
<tr> <tr>
<td style="background: #333; color: #fff;" <td style="background: #333; color: #fff;"
colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp' ); ?></td> colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp-child' ); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'WordPress Root Directory', 'mainwp' ); ?></td> <td><?php esc_html_e( 'WordPress Root Directory', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getWPRoot(); ?></td> <td colspan="3"><?php self::getWPRoot(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Server Name', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server Name', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerName(); ?></td> <td colspan="3"><?php self::getServerName(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Server Software', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server Software', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerSoftware(); ?></td> <td colspan="3"><?php self::getServerSoftware(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Operating System', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Operating System', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getOS(); ?></td> <td colspan="3"><?php self::getOS(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Architecture', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Architecture', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getArchitecture(); ?></td> <td colspan="3"><?php self::getArchitecture(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Server IP', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server IP', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerIP(); ?></td> <td colspan="3"><?php self::getServerIP(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Server Protocol', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server Protocol', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerProtocol(); ?></td> <td colspan="3"><?php self::getServerProtocol(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'HTTP Host', 'mainwp' ); ?></td> <td><?php esc_html_e( 'HTTP Host', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getHTTPHost(); ?></td> <td colspan="3"><?php self::getHTTPHost(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'HTTPS', 'mainwp' ); ?></td> <td><?php esc_html_e( 'HTTPS', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getHTTPS(); ?></td> <td colspan="3"><?php self::getHTTPS(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php _e( 'Server self connect', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server self connect', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::serverSelfConnect(); ?></td> <td colspan="3"><?php self::serverSelfConnect(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'User Agent', 'mainwp' ); ?></td> <td><?php esc_html_e( 'User Agent', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getUserAgent(); ?></td> <td colspan="3"><?php self::getUserAgent(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Server Port', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Server Port', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerPort(); ?></td> <td colspan="3"><?php self::getServerPort(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Gateway Interface', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Gateway Interface', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerGetawayInterface(); ?></td> <td colspan="3"><?php self::getServerGetawayInterface(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Memory Usage', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Memory Usage', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::memoryUsage(); ?></td> <td colspan="3"><?php self::memoryUsage(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Complete URL', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Complete URL', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getCompleteURL(); ?></td> <td colspan="3"><?php self::getCompleteURL(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Request Time', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Request Time', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerRequestTime(); ?></td> <td colspan="3"><?php self::getServerRequestTime(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Accept Content', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Accept Content', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerHTTPAccept(); ?></td> <td colspan="3"><?php self::getServerHTTPAccept(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Accept-Charset Content', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Accept-Charset Content', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getServerAcceptCharset(); ?></td> <td colspan="3"><?php self::getServerAcceptCharset(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Currently Executing Script Pathname', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getScriptFileName(); ?></td> <td colspan="3"><?php self::getScriptFileName(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Current Page URI', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Current Page URI', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getCurrentPageURI(); ?></td> <td colspan="3"><?php self::getCurrentPageURI(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Remote Address', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Remote Address', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemoteAddress(); ?></td> <td colspan="3"><?php self::getRemoteAddress(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Remote Host', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Remote Host', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemoteHost(); ?></td> <td colspan="3"><?php self::getRemoteHost(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'Remote Port', 'mainwp' ); ?></td> <td><?php esc_html_e( 'Remote Port', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getRemotePort(); ?></td> <td colspan="3"><?php self::getRemotePort(); ?></td>
</tr> </tr>
<tr> <tr>
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp' ); ?></td> <td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp-child' ); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP Allow URL fopen', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPAllowUrlFopen(); ?></td> <td colspan="3"><?php self::getPHPAllowUrlFopen(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP Exif Support', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP Exif Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPExif(); ?></td> <td colspan="3"><?php self::getPHPExif(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP IPTC Support', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP IPTC Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPIPTC(); ?></td> <td colspan="3"><?php self::getPHPIPTC(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP XML Support', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP XML Support', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getPHPXML(); ?></td> <td colspan="3"><?php self::getPHPXML(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP Disabled Functions', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::mainwpRequiredFunctions(); ?></td> <td colspan="3"><?php self::mainwpRequiredFunctions(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp' ); ?></td> <td><?php esc_html_e( 'PHP Loaded Extensions', 'mainwp-child' ); ?></td>
<td colspan="3" style="width: 73% !important;"><?php self::getLoadedPHPExtensions(); ?></td> <td colspan="3" style="width: 73% !important;"><?php self::getLoadedPHPExtensions(); ?></td>
</tr> </tr>
<tr> <tr>
<td style="background: #333; color: #fff;" <td style="background: #333; color: #fff;"
colspan="5"><?php esc_html_e( 'MySQL INFORMATION', 'mainwp' ); ?></td> colspan="5"><?php esc_html_e( 'MySQL INFORMATION', 'mainwp-child' ); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'MySQL Mode', 'mainwp' ); ?></td> <td><?php esc_html_e( 'MySQL Mode', 'mainwp-child' ); ?></td>
<td colspan="3"><?php self::getSQLMode(); ?></td> <td colspan="3"><?php self::getSQLMode(); ?></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp' ); ?></td> <td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp-child' ); ?></td>
<td colspan="3"><?php echo esc_html( defined( 'DB_CHARSET' ) ? DB_CHARSET : '' ); ?></td> <td colspan="3"><?php echo esc_html( defined( 'DB_CHARSET' ) ? DB_CHARSET : '' ); ?></td>
</tr> </tr>
<tr> <tr>
<td style="background: #333; color: #fff;" colspan="5"><?php _e( 'WORDPRESS PLUGINS', 'mainwp' ); ?></td> <td style="background: #333; color: #fff;" colspan="5"><?php _e( 'WORDPRESS PLUGINS', 'mainwp-child' ); ?></td>
</tr> </tr>
<?php <?php
$all_plugins = get_plugins(); $all_plugins = get_plugins();
@ -867,7 +867,7 @@ class MainWP_Child_Server_Information {
echo esc_html( $arr[ $i ] . ', ' ); echo esc_html( $arr[ $i ] . ', ' );
} }
} else { } else {
echo esc_html__( 'No functions disabled', 'mainwp' ); echo esc_html__( 'No functions disabled', 'mainwp-child' );
} }
} }
@ -915,11 +915,11 @@ class MainWP_Child_Server_Information {
<thead> <thead>
<tr> <tr>
<th scope="col" class="manage-column column-posts" style=""> <th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Next due', 'mainwp' ); ?></span></th> <span><?php esc_html_e( 'Next due', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style=""> <th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Schedule', 'mainwp' ); ?></span></th> <span><?php esc_html_e( 'Schedule', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style=""> <th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Hook', 'mainwp' ); ?></span></th> <span><?php esc_html_e( 'Hook', 'mainwp-child' ); ?></span></th>
</tr> </tr>
</thead> </thead>
<tbody id="the-sites-list" class="list:sites"> <tbody id="the-sites-list" class="list:sites">
@ -1122,7 +1122,7 @@ class MainWP_Child_Server_Information {
return ( stristr( $str, 'NCONF_get_string:no value' ) ? '' : $str ); return ( stristr( $str, 'NCONF_get_string:no value' ) ? '' : $str );
} }
protected static function getPHPVersion() { public static function getPHPVersion() {
return phpversion(); return phpversion();
} }
@ -1138,7 +1138,7 @@ class MainWP_Child_Server_Information {
return ini_get( 'post_max_size' ); return ini_get( 'post_max_size' );
} }
protected static function getMySQLVersion() { public static function getMySQLVersion() {
/** @var $wpdb wpdb */ /** @var $wpdb wpdb */
global $wpdb; global $wpdb;
@ -1149,7 +1149,7 @@ class MainWP_Child_Server_Information {
return ini_get( 'max_input_time' ); return ini_get( 'max_input_time' );
} }
protected static function getPHPMemoryLimit() { public static function getPHPMemoryLimit() {
return ini_get( 'memory_limit' ); return ini_get( 'memory_limit' );
} }
@ -1241,7 +1241,7 @@ class MainWP_Child_Server_Information {
echo esc_html( $_SERVER['GATEWAY_INTERFACE'] ); echo esc_html( $_SERVER['GATEWAY_INTERFACE'] );
} }
protected static function getServerIP() { public static function getServerIP() {
echo esc_html( $_SERVER['SERVER_ADDR'] ); echo esc_html( $_SERVER['SERVER_ADDR'] );
} }
@ -1275,7 +1275,7 @@ class MainWP_Child_Server_Information {
protected static function getServerAcceptCharset() { protected static function getServerAcceptCharset() {
if ( ! isset( $_SERVER['HTTP_ACCEPT_CHARSET'] ) || ( '' === $_SERVER['HTTP_ACCEPT_CHARSET'] ) ) { if ( ! isset( $_SERVER['HTTP_ACCEPT_CHARSET'] ) || ( '' === $_SERVER['HTTP_ACCEPT_CHARSET'] ) ) {
esc_html_e( 'N/A', 'mainwp' ); esc_html_e( 'N/A', 'mainwp-child' );
} else { } else {
echo esc_html( $_SERVER['HTTP_ACCEPT_CHARSET'] ); echo esc_html( $_SERVER['HTTP_ACCEPT_CHARSET'] );
} }
@ -1295,9 +1295,9 @@ class MainWP_Child_Server_Information {
protected static function getHTTPS() { protected static function getHTTPS() {
if ( isset( $_SERVER['HTTPS'] ) && '' !== $_SERVER['HTTPS'] ) { if ( isset( $_SERVER['HTTPS'] ) && '' !== $_SERVER['HTTPS'] ) {
echo esc_html( __( 'ON', 'mainwp' ) . ' - ' . $_SERVER['HTTPS'] ); echo esc_html( __( 'ON', 'mainwp-child' ) . ' - ' . $_SERVER['HTTPS'] );
} else { } else {
esc_html_e( 'OFF', 'mainwp' ); esc_html_e( 'OFF', 'mainwp-child' );
} }
} }
@ -1312,19 +1312,19 @@ class MainWP_Child_Server_Information {
$response = wp_remote_post( $url, $args ); $response = wp_remote_post( $url, $args );
$test_result = ''; $test_result = '';
if ( is_wp_error( $response ) ) { if ( is_wp_error( $response ) ) {
$test_result .= sprintf( __( 'The HTTP response test get an error "%s"','mainwp' ), $response->get_error_message() ); $test_result .= sprintf( __( 'The HTTP response test get an error "%s"','mainwp-child' ), $response->get_error_message() );
} }
$response_code = wp_remote_retrieve_response_code( $response ); $response_code = wp_remote_retrieve_response_code( $response );
if ( $response_code < 200 && $response_code > 204 ) { 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 ) ); $test_result .= sprintf( __( 'The HTTP response test get a false http status (%s)','mainwp-child' ), wp_remote_retrieve_response_code( $response ) );
} else { } else {
$response_body = wp_remote_retrieve_body( $response ); $response_body = wp_remote_retrieve_body( $response );
if ( FALSE === strstr( $response_body, 'MainWP Test' ) ) { if ( FALSE === strstr( $response_body, 'MainWP Test' ) ) {
$test_result .= sprintf( __( 'Not expected HTTP response body: %s','mainwp' ), esc_attr( strip_tags( $response_body ) ) ); $test_result .= sprintf( __( 'Not expected HTTP response body: %s','mainwp-child' ), esc_attr( strip_tags( $response_body ) ) );
} }
} }
if ( empty( $test_result ) ) { if ( empty( $test_result ) ) {
_e( 'Response Test O.K.', 'mainwp' ); _e( 'Response Test O.K.', 'mainwp-child' );
} else } else
echo $test_result; echo $test_result;
} }
@ -1336,7 +1336,7 @@ class MainWP_Child_Server_Information {
protected static function getRemoteHost() { protected static function getRemoteHost() {
if ( ! isset( $_SERVER['REMOTE_HOST'] ) || ( '' === $_SERVER['REMOTE_HOST'] ) ) { if ( ! isset( $_SERVER['REMOTE_HOST'] ) || ( '' === $_SERVER['REMOTE_HOST'] ) ) {
esc_html_e( 'N/A', 'mainwp' ); esc_html_e( 'N/A', 'mainwp-child' );
} else { } else {
echo esc_html( $_SERVER['REMOTE_HOST'] ); echo esc_html( $_SERVER['REMOTE_HOST'] );
} }
@ -1364,7 +1364,7 @@ class MainWP_Child_Server_Information {
protected static function getServerPathTranslated() { protected static function getServerPathTranslated() {
if ( ! isset( $_SERVER['PATH_TRANSLATED'] ) || ( '' === $_SERVER['PATH_TRANSLATED'] ) ) { if ( ! isset( $_SERVER['PATH_TRANSLATED'] ) || ( '' === $_SERVER['PATH_TRANSLATED'] ) ) {
esc_html_e( 'N/A', 'mainwp' ); esc_html_e( 'N/A', 'mainwp-child' );
} else { } else {
echo esc_html( $_SERVER['PATH_TRANSLATED'] ); echo esc_html( $_SERVER['PATH_TRANSLATED'] );
} }
@ -1420,9 +1420,9 @@ class MainWP_Child_Server_Information {
<thead title="Click to Toggle" style="cursor: pointer;"> <thead title="Click to Toggle" style="cursor: pointer;">
<tr> <tr>
<th scope="col" class="manage-column column-posts" style="width: 10%"> <th scope="col" class="manage-column column-posts" style="width: 10%">
<span><?php esc_html_e( 'Time', 'mainwp' ); ?></span></th> <span><?php esc_html_e( 'Time', 'mainwp-child' ); ?></span></th>
<th scope="col" class="manage-column column-posts" style=""> <th scope="col" class="manage-column column-posts" style="">
<span><?php esc_html_e( 'Error', 'mainwp' ); ?></span></th> <span><?php esc_html_e( 'Error', 'mainwp-child' ); ?></span></th>
</tr> </tr>
</thead> </thead>
<tbody class="list:sites" id="mainwp-error-log-table"> <tbody class="list:sites" id="mainwp-error-log-table">
@ -1435,7 +1435,7 @@ class MainWP_Child_Server_Information {
public static function renderErrorLog() { public static function renderErrorLog() {
$log_errors = ini_get( 'log_errors' ); $log_errors = ini_get( 'log_errors' );
if ( ! $log_errors ) { if ( ! $log_errors ) {
echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp' ) . '</td></tr>'; echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp-child' ) . '</td></tr>';
} }
$error_log = ini_get( 'error_log' ); $error_log = ini_get( 'error_log' );
@ -1455,7 +1455,7 @@ class MainWP_Child_Server_Information {
if ( empty( $lines ) ) { if ( empty( $lines ) ) {
echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp' ) . '</td></tr>'; echo '<tr><td colspan="2">' . esc_html__( 'MainWP is unable to find your error logs, please contact your host for server error logs.', 'mainwp-child' ) . '</td></tr>';
return; return;
} }
@ -1607,32 +1607,32 @@ class MainWP_Child_Server_Information {
$uniqueId = get_option('mainwp_child_uniqueId'); $uniqueId = get_option('mainwp_child_uniqueId');
$details = array( $details = array(
'siteurl' => array( 'siteurl' => array(
'title' => __('Site URL', 'mainwp'), 'title' => __('Site URL', 'mainwp-child'),
'value' => get_bloginfo( 'url' ), 'value' => get_bloginfo( 'url' ),
'desc' => get_bloginfo( 'url' ) 'desc' => get_bloginfo( 'url' )
), ),
'adminuser' => array( 'adminuser' => array(
'title' => __('Administrator name', 'mainwp'), 'title' => __('Administrator name', 'mainwp-child'),
'value' => $current_user->user_login, 'value' => $current_user->user_login,
'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp') 'desc' => __('This is your Administrator username, however, you can use any existing Administrator username.', 'mainwp-child')
), ),
'friendly_name' => array( 'friendly_name' => array(
'title' => __('Friendly site name', 'mainwp'), 'title' => __('Friendly site name', 'mainwp-child'),
'value' => get_bloginfo( 'name' ), 'value' => get_bloginfo( 'name' ),
'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp') 'desc' => __('For the friendly site name, you can use any name, this is just a suggestion.', 'mainwp-child')
), ),
'uniqueid' => array( 'uniqueid' => array(
'title' => __('Child unique security id', 'mainwp'), 'title' => __('Child unique security id', 'mainwp-child'),
'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'), 'value' => !empty($uniqueId) ? $uniqueId : __('Leave the field blank', 'mainwp-child'),
'desc' => __('Child unique security id is not required, however, since you have enabled it, you need to add it to your MainWP dashboad.', 'mainwp') 'desc' => __('Child unique security id is not required, however, since you have enabled it, you need to add it to your MainWP dashboad.', 'mainwp-child')
), ),
'verify_ssl' => array( 'verify_ssl' => array(
'title' => __('Verify certificate', 'mainwp'), 'title' => __('Verify certificate', 'mainwp-child'),
'value' => __('Yes', 'mainwp-child'), 'value' => __('Yes', 'mainwp-child'),
'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp') 'desc' => __('If there is an issue with SSL certificate on this site, try to set this option to No.', 'mainwp-child')
), ),
'ssl_version' => array( 'ssl_version' => array(
'title' => __('SSL version', 'mainwp'), 'title' => __('SSL version', 'mainwp-child'),
'value' => __('Auto Detect', 'mainwp-child'), 'value' => __('Auto Detect', 'mainwp-child'),
'desc' => __('Auto Detect', 'mainwp-child'), 'desc' => __('Auto Detect', 'mainwp-child'),
), ),
@ -1644,7 +1644,7 @@ class MainWP_Child_Server_Information {
<div class="inside"> <div class="inside">
<div class="mainwp-postbox-actions-top mainwp-padding-5"> <div class="mainwp-postbox-actions-top mainwp-padding-5">
<?php <?php
_e('If you are trying to connect this child site to your Mainwp Dashboard, you can use following details to do that. Please note that these are only suggested values.', 'mainwp'); _e('If you are trying to connect this child site to your Mainwp Dashboard, you can use following details to do that. Please note that these are only suggested values.', 'mainwp-child');
?> ?>
</div> </div>
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0" style="border: 0"> <table id="mainwp-table" class="wp-list-table widefat" cellspacing="0" style="border: 0">

View file

@ -166,10 +166,12 @@ class MainWP_Child_Themes_Check {
$responses = array(); $responses = array();
} }
$avoid_themes = array( 'superstore' );
$themes_to_scan = array_splice( $all_themes, 0, apply_filters( 'mainwp_child_theme_health_check_max_themes_to_batch', 10 ) ); $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 ); $tolerance_in_days = get_option( 'mainwp_child_plugintheme_days_outdate', 365 );
foreach ( $themes_to_scan as $slug => $v ) { foreach ( $themes_to_scan as $slug => $v ) {
if ( in_array( $slug, $avoid_themes ) ) continue;
$body = $this->try_get_response_body( $slug, false ); $body = $this->try_get_response_body( $slug, false );

View file

@ -365,12 +365,12 @@ class MainWP_Child_Updraft_Plus_Backups {
function save_settings() { function save_settings() {
$settings = maybe_unserialize( base64_decode( $_POST['settings'] ) ); $settings = maybe_unserialize( base64_decode( $_POST['settings'] ) );
$keys = $this->get_settings_keys(); $keys_filter = $this->get_settings_keys();
$updated = false; $updated = false;
if ( is_array( $settings ) ) { if ( is_array( $settings ) ) {
if ( class_exists( 'UpdraftPlus_Options' ) ) { if ( class_exists( 'UpdraftPlus_Options' ) ) {
foreach ( $keys as $key ) { foreach ( $keys_filter as $key ) {
if ( isset( $settings[ $key ] ) ) { if ( isset( $settings[ $key ] ) ) {
if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) { if ( 'updraft_dropbox' === $key && is_array($settings[ $key ])) {
$opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' ); $opts = UpdraftPlus_Options::get_updraft_option( 'updraft_dropbox' );
@ -427,6 +427,18 @@ class MainWP_Child_Updraft_Plus_Backups {
$opts['secretkey'] = $settings[ $key ]['secretkey']; $opts['secretkey'] = $settings[ $key ]['secretkey'];
$opts['path'] = $this->replace_tokens($settings[ $key ]['path']); $opts['path'] = $this->replace_tokens($settings[ $key ]['path']);
UpdraftPlus_Options::update_updraft_option( $key, $opts ); UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_ftp' === $key ) {
$opts = $settings[ $key ];
if ( isset( $opts['path'] ) ) {
$opts['path'] = $this->replace_tokens( $opts['path'] );
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else if ( 'updraft_sftp_settings' === $key ) {
$opts = $settings[ $key ];
if ( isset( $opts['path'] ) ) {
$opts['path'] = $this->replace_tokens( $opts['path'] );
}
UpdraftPlus_Options::update_updraft_option( $key, $opts );
} else { } else {
UpdraftPlus_Options::update_updraft_option( $key, $settings[ $key ] ); UpdraftPlus_Options::update_updraft_option( $key, $settings[ $key ] );
} }

View file

@ -353,17 +353,63 @@ class MainWP_Child_Wordfence {
} }
public function wordfence_init() { public function wordfence_init() {
if ( get_option( 'mainwp_wordfence_ext_enabled' ) !== 'Y' ) { if ( get_option( 'mainwp_wordfence_ext_enabled' ) !== 'Y' ) return;
return; if ( ! $this->is_wordfence_installed ) return;
}
add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) );
if ( get_option( 'mainwp_wordfence_hide_plugin' ) === 'hide' ) { if ( get_option( 'mainwp_wordfence_hide_plugin' ) === 'hide' ) {
add_filter( 'all_plugins', array( $this, 'all_plugins' ) ); add_filter( 'all_plugins', array( $this, 'all_plugins' ) );
add_action( 'admin_menu', array( $this, 'remove_menu' ) ); add_action( 'admin_menu', array( $this, 'remove_menu' ) );
add_action( 'admin_init', array( $this, 'admin_init' ) ); add_action( 'admin_init', array( $this, 'admin_init' ) );
} }
$this->init_cron(); $this->init_cron();
}
function do_site_stats() {
do_action( 'mainwp_child_reports_log', 'wordfence' );
}
public function do_reports_log($ext = '') {
if ( $ext !== 'wordfence' ) return;
global $wpdb;
$lastcheck = get_option('mainwp_wordfence_lastcheck_scan');
if ($lastcheck == false) {
$lastcheck = time() - 3600 * 24 * 10; // check 10 days ago
}
$status_table = $wpdb->base_prefix . 'wfStatus';
// to fix prepare sql empty
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime >= %d AND level = 1 AND type = 'info' AND msg LIKE ", $lastcheck );
$sql .= " 'Scan Complete. %';";
$rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
if ( $rows ) {
while ( $row = MainWP_Child_DB::fetch_array( $rows ) ) {
$message = "Wordfence scan completed";
$scan_time = $row['ctime'];
$sql = sprintf( "SELECT * FROM {$status_table} WHERE ctime > %d AND ctime < %d AND level = 10 AND type = 'info' AND msg LIKE ", $scan_time, $scan_time + 100 ); // to get nearest SUM_FINAL msg
$sql .= " 'SUM_FINAL:Scan complete.%';";
$sum_rows = MainWP_Child_DB::_query( $sql, $wpdb->dbh );
$result = '';
if ($sum_rows) {
$sum_row = MainWP_Child_DB::fetch_array( $sum_rows );
if (is_array($sum_row) && isset($sum_row['msg'])) {
if ( false !== strpos( $sum_row['msg'], 'Congratulations, no problems found' ) ) {
$result = 'No issues detected';
} else {
$result = 'Issues Detected';
}
}
}
$details = $row['msg'];
do_action( 'mainwp_reports_wordfence_scan', $message, $scan_time, $details, $result );
}
}
update_option( 'mainwp_wordfence_lastcheck_scan', time() );
} }
public function admin_init() { public function admin_init() {

View file

@ -84,7 +84,7 @@ if ( isset( $_GET['skeleton_keyuse_nonce_key'] ) && isset( $_GET['skeleton_keyus
} }
class MainWP_Child { class MainWP_Child {
public static $version = '3.2.5'; public static $version = '3.2.6';
private $update_version = '1.3'; private $update_version = '1.3';
private $callableFunctions = array( private $callableFunctions = array(
@ -387,7 +387,7 @@ class MainWP_Child {
public function admin_notice() { public function admin_notice() {
//Admin Notice... //Admin Notice...
if ( is_plugin_active( 'mainwp-child/mainwp-child.php' ) ) { if ( is_plugin_active( 'mainwp-child/mainwp-child.php' ) ) {
if ( ! get_option( 'mainwp_child_pubkey' ) ) { if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::isAdmin() && is_admin() ) {
$child_name = ( $this->branding_robust === 'MainWP' ) ? 'MainWP Child' : $this->branding_robust; $child_name = ( $this->branding_robust === 'MainWP' ) ? 'MainWP Child' : $this->branding_robust;
$msg = '<div class="wrap"><div class="postbox" style="margin-top: 4em;"><p style="background: #a00; color: #fff; font-size: 22px; font-weight: bold; margin: 0; padding: .3em;">'; $msg = '<div class="wrap"><div class="postbox" style="margin-top: 4em;"><p style="background: #a00; color: #fff; font-size: 22px; font-weight: bold; margin: 0; padding: .3em;">';
$msg .= __( 'Attention!', 'mainwp-child' ); $msg .= __( 'Attention!', 'mainwp-child' );
@ -1299,6 +1299,7 @@ class MainWP_Child {
MainWP_Child_Back_WP_Up::Instance()->init(); MainWP_Child_Back_WP_Up::Instance()->init();
new MainWP_Child_Back_Up_Buddy(); new MainWP_Child_Back_Up_Buddy();
MainWP_Child_Wordfence::Instance()->wordfence_init();
global $_wp_submenu_nopriv; global $_wp_submenu_nopriv;
if ($_wp_submenu_nopriv === null) if ($_wp_submenu_nopriv === null)
@ -3217,6 +3218,15 @@ class MainWP_Child {
$information['wpversion'] = $wp_version; $information['wpversion'] = $wp_version;
$information['siteurl'] = get_option( 'siteurl' ); $information['siteurl'] = get_option( 'siteurl' );
$information['site_info'] = array(
'wpversion' => $wp_version,
'phpversion' => phpversion(),
'child_version' => self::$version,
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
'mysql_version' => MainWP_Child_Server_Information::getMySQLVersion(),
'ip' => $_SERVER['SERVER_ADDR']
);
//Try to switch to SSL if SSL is enabled in between! //Try to switch to SSL if SSL is enabled in between!
$pubkey = get_option( 'mainwp_child_pubkey' ); $pubkey = get_option( 'mainwp_child_pubkey' );
$nossl = get_option( 'mainwp_child_nossl' ); $nossl = get_option( 'mainwp_child_nossl' );
@ -3495,6 +3505,29 @@ class MainWP_Child {
} }
$information['syncWPRocketData'] = $data; $information['syncWPRocketData'] = $data;
} }
if ( isset( $othersData['syncPageSpeedData'] ) && !empty( $othersData['syncPageSpeedData'] ) ) {
if ( MainWP_Child_Pagespeed::Instance()->is_plugin_installed ) {
$information['syncPageSpeedData'] = MainWP_Child_Pagespeed::Instance()->sync_data();
}
}
if ( isset( $othersData['syncBrokenLinksCheckerData'] ) && !empty( $othersData['syncBrokenLinksCheckerData'] ) ) {
if ( MainWP_Child_Links_Checker::Instance()->is_plugin_installed ) {
$information['syncBrokenLinksCheckerData'] = MainWP_Child_Links_Checker::Instance()->sync_data();
}
}
if ( isset( $othersData['syncClientReportData'] ) && !empty( $othersData['syncClientReportData'] ) ) {
$creport_sync_data = array();
if ( ( $firsttime = get_option( 'mainwp_creport_first_time_activated' ) ) !== false ) {
$creport_sync_data['firsttime_activated'] = $firsttime;
}
if ( !empty( $creport_sync_data ) ) {
$information['syncClientReportData'] = $creport_sync_data;
}
}
} }
$information['faviIcon'] = $this->get_favicon(); $information['faviIcon'] = $this->get_favicon();
@ -4683,37 +4716,45 @@ class MainWP_Child {
$maint_options = array(); $maint_options = array();
} }
$performed_what = array();
if ( empty( $max_revisions ) ) { if ( empty( $max_revisions ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'"; $sql_clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Posts revisions deleted';
} else { } else {
$results = MainWP_Helper::getRevisions( $max_revisions ); $results = MainWP_Helper::getRevisions( $max_revisions );
$count_deleted = MainWP_Helper::deleteRevisions( $results, $max_revisions ); $count_deleted = MainWP_Helper::deleteRevisions( $results, $max_revisions );
$performed_what[] = 'Posts revisions deleted';
} }
if ( in_array( 'autodraft', $maint_options ) ) { if ( in_array( 'autodraft', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'"; $sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Auto draft posts deleted';
} }
if ( in_array( 'trashpost', $maint_options ) ) { if ( in_array( 'trashpost', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'trash'"; $sql_clean = "DELETE FROM $wpdb->posts WHERE post_status = 'trash'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Trash posts deleted';
} }
if ( in_array( 'spam', $maint_options ) ) { if ( in_array( 'spam', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'"; $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Spam comments deleted';
} }
if ( in_array( 'pending', $maint_options ) ) { if ( in_array( 'pending', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = '0'"; $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = '0'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Pending comments deleted';
} }
if ( in_array( 'trashcomment', $maint_options ) ) { if ( in_array( 'trashcomment', $maint_options ) ) {
$sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'"; $sql_clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'";
$wpdb->query( $sql_clean ); $wpdb->query( $sql_clean );
$performed_what[] = 'Trash comments deleted';
} }
if ( in_array( 'tags', $maint_options ) ) { if ( in_array( 'tags', $maint_options ) ) {
@ -4725,6 +4766,7 @@ class MainWP_Child {
} }
} }
} }
$performed_what[] = 'Tags with 0 posts associated deleted';
} }
if ( in_array( 'categories', $maint_options ) ) { if ( in_array( 'categories', $maint_options ) ) {
@ -4736,14 +4778,24 @@ class MainWP_Child {
} }
} }
} }
$performed_what[] = 'Categories with 0 posts associated deleted';
} }
if ( in_array( 'optimize', $maint_options ) ) { if ( in_array( 'optimize', $maint_options ) ) {
$this->maintenance_optimize(); $this->maintenance_optimize();
$performed_what[] = 'Database optimized';
} }
if ( ! isset( $information['status'] ) ) { if ( ! isset( $information['status'] ) ) {
$information['status'] = 'SUCCESS'; $information['status'] = 'SUCCESS';
} }
if ( !empty( $performed_what ) && has_action( 'mainwp_reports_maintenance' ) ) {
$details = implode( ', ', $performed_what );
$log_time = time();
$message = $result = "Maintenance Performed";
do_action( 'mainwp_reports_maintenance', $message, $log_time, $details, $result);
}
MainWP_Helper::write( $information ); MainWP_Helper::write( $information );
} }

View file

@ -2,8 +2,6 @@
class MainWP_Client_Report { class MainWP_Client_Report {
public static $instance = null; public static $instance = null;
public static $mainwpChildReports = false;
public static $streamVersionNumber = null;
static function Instance() { static function Instance() {
if ( null === MainWP_Client_Report::$instance ) { if ( null === MainWP_Client_Report::$instance ) {
@ -16,6 +14,7 @@ class MainWP_Client_Report {
public static function init() { public static function init() {
add_filter( 'wp_stream_connectors', array( 'MainWP_Client_Report', 'init_stream_connectors' ), 10, 1 ); 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_report_connectors' ), 10, 1 ); add_filter( 'mainwp_client_reports_connectors', array( 'MainWP_Client_Report', 'init_report_connectors' ), 10, 1 );
add_action( 'mainwp_child_log', array( 'MainWP_Client_Report', 'do_reports_log' ) );
} }
public static function init_stream_connectors( $classes ) { public static function init_stream_connectors( $classes ) {
@ -58,18 +57,29 @@ class MainWP_Client_Report {
return $classes; return $classes;
} }
public static function do_reports_log( $ext = '' ) {
switch( $ext ) {
case 'backupbuddy':
MainWP_Child_Back_Up_Buddy::Instance()->do_reports_log( $ext );
break;
case 'backupwordpress':
MainWP_Child_Back_Up_Wordpress::Instance()->do_reports_log( $ext );
break;
case 'backwpup':
MainWP_Child_Back_WP_Up::Instance()->do_reports_log( $ext );
break;
case 'wordfence':
MainWP_Child_Wordfence::Instance()->do_reports_log( $ext );
break;
}
}
public function action() { public function action() {
$information = array(); $information = array();
self::$mainwpChildReports = false;
if ( function_exists( 'mainwp_wp_stream_query' ) && class_exists( 'MainWP_WP_Stream' ) ) { if ( !function_exists( 'mainwp_wp_stream_query' ) || !class_exists( 'MainWP_WP_Stream' ) ) {
self::$mainwpChildReports = true; $information['error'] = 'NO_CREPORT';
} else if ( function_exists( 'wp_stream_query' ) && class_exists( 'WP_Stream' ) ) {
self::$streamVersionNumber = 149;
} else if ( function_exists( 'wp_stream_get_instance' ) && class_exists( 'WP_Stream\Plugin' ) ) {
self::$streamVersionNumber = 3;
} else {
$information['error'] = 'NO_STREAM';
MainWP_Helper::write( $information ); MainWP_Helper::write( $information );
} }
@ -87,9 +97,6 @@ class MainWP_Client_Report {
case 'set_showhide': case 'set_showhide':
$information = $this->set_showhide(); $information = $this->set_showhide();
break; break;
case 'save_settings':
$information = $this->save_settings();
break;
} }
} }
MainWP_Helper::write( $information ); MainWP_Helper::write( $information );
@ -142,11 +149,7 @@ class MainWP_Client_Report {
$args = array(); $args = array();
foreach ( $allowed_params as $param ) { foreach ( $allowed_params as $param ) {
if ( self::$mainwpChildReports ) {
$paramval = mainwp_wp_stream_filter_input( INPUT_POST, $param ); $paramval = mainwp_wp_stream_filter_input( INPUT_POST, $param );
} else {
$paramval = wp_stream_filter_input( INPUT_POST, $param );
}
if ( $paramval || '0' === $paramval ) { if ( $paramval || '0' === $paramval ) {
$args[ $param ] = $paramval; $args[ $param ] = $paramval;
} }
@ -224,8 +227,6 @@ class MainWP_Client_Report {
$args['action__not_in'] = array( 'login' ); $args['action__not_in'] = array( 'login' );
// fix for Stream 3
if ( 3 !== self::$streamVersionNumber ) {
$args['fields'] = 'with-meta'; $args['fields'] = 'with-meta';
if ( isset( $args['date_from'] ) ) { if ( isset( $args['date_from'] ) ) {
$args['date_from'] = date( 'Y-m-d H:i:s', $args['date_from'] ); $args['date_from'] = date( 'Y-m-d H:i:s', $args['date_from'] );
@ -234,15 +235,6 @@ class MainWP_Client_Report {
if ( isset( $args['date_to'] ) ) { if ( isset( $args['date_to'] ) ) {
$args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] ); $args['date_to'] = date( 'Y-m-d H:i:s', $args['date_to'] );
} }
} else {
if ( isset( $args['date_from'] ) ) {
$args['date_from'] = date( 'Y-m-d', $args['date_from'] );
}
if ( isset( $args['date_to'] ) ) {
$args['date_to'] = date( 'Y-m-d', $args['date_to'] );
}
}
if ( MainWP_Child_Branding::is_branding() ) { if ( MainWP_Child_Branding::is_branding() ) {
$args['hide_child_reports'] = 1; $args['hide_child_reports'] = 1;
@ -250,14 +242,7 @@ class MainWP_Client_Report {
$args['records_per_page'] = 9999; $args['records_per_page'] = 9999;
if ( self::$mainwpChildReports ) {
$records = mainwp_wp_stream_query( $args ); $records = mainwp_wp_stream_query( $args );
} else if ( 149 === self::$streamVersionNumber ) {
$records = wp_stream_query( $args );
} else if ( 3 === self::$streamVersionNumber ) {
$records = wp_stream_get_instance()->db->query->query( $args );
}
if ( ! is_array( $records ) ) { if ( ! is_array( $records ) ) {
$records = array(); $records = array();
@ -380,6 +365,14 @@ class MainWP_Client_Report {
if ( $record->context !== 'mainwp_sucuri' ) { if ( $record->context !== 'mainwp_sucuri' ) {
continue; continue;
} }
} else if ( 'wordfence' === $context ) {
if ( $record->context !== 'wordfence_scans' ) {
continue;
}
} else if ( 'maintenance' === $context ) {
if ( $record->context !== 'mainwp_maintenances' ) {
continue;
}
} else { } else {
if ( $action !== $record->action ) { if ( $action !== $record->action ) {
continue; continue;
@ -451,6 +444,7 @@ class MainWP_Client_Report {
'oldversion', 'oldversion',
'currentversion', 'currentversion',
'date', 'date',
'time',
'count', 'count',
'author', 'author',
'old.version', 'old.version',
@ -499,6 +493,14 @@ class MainWP_Client_Report {
if ( $record->context !== 'mainwp_sucuri' ) { if ( $record->context !== 'mainwp_sucuri' ) {
continue; continue;
} }
} else if ( 'wordfence' === $context ) {
if ( $record->context !== 'wordfence_scans' ) {
continue;
}
} else if ( 'maintenance' === $context ) {
if ( $record->context !== 'mainwp_maintenances' ) {
continue;
}
} else { } else {
if ( $action !== $record->action ) { if ( $action !== $record->action ) {
continue; continue;
@ -564,7 +566,10 @@ class MainWP_Client_Report {
switch ( $data ) { switch ( $data ) {
case 'date': case 'date':
$token_values[ $token ] = MainWP_Helper::formatTimestamp( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) ); $token_values[ $token ] = MainWP_Helper::formatDate( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
break;
case 'time':
$token_values[ $token ] = MainWP_Helper::formatTime( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) );
break; break;
case 'area': case 'area':
$data = 'sidebar_name'; $data = 'sidebar_name';
@ -623,7 +628,13 @@ class MainWP_Client_Report {
if ( 'mainwp_sucuri' === $context ) { if ( 'mainwp_sucuri' === $context ) {
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data ); $token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
} else { } else {
$token_values[ $token ] = $token; $token_values[ $token ] = $value;
}
break;
case 'details':
case 'result':
if ( 'wordfence' === $context || 'maintenance' === $context ) {
$token_values[ $token ] = $this->get_stream_meta_data( $record, $data );
} }
break; break;
case 'destination': // backup cases case 'destination': // backup cases
@ -654,23 +665,15 @@ class MainWP_Client_Report {
return ''; return '';
} }
$record_id = $record->ID;
$meta_key = $data; $meta_key = $data;
if ( 3 === self::$streamVersionNumber && 'author_meta' === $meta_key ) {
$meta_key = 'user_meta';
}
$value = ''; $value = '';
if ( isset( $record->meta ) ) { if ( isset( $record->meta ) ) {
$meta = $record->meta; $meta = $record->meta;
if ( isset( $meta[ $meta_key ] ) ) { if ( isset( $meta[ $meta_key ] ) ) {
$value = $meta[ $meta_key ]; $value = $meta[ $meta_key ];
// fix for Stream 3
if ( 3 !== self::$streamVersionNumber ) {
$value = current( $value ); $value = current( $value );
}
if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) { if ( 'author_meta' === $meta_key || 'user_meta' === $meta_key ) {
$value = maybe_unserialize( $value ); $value = maybe_unserialize( $value );
$value = $value['display_name']; $value = $value['display_name'];
@ -690,16 +693,6 @@ class MainWP_Client_Report {
return $information; return $information;
} }
function save_settings() {
$settings = isset( $_POST['settings'] ) ? $_POST['settings'] : array();
$report_settings = get_option( 'mainwp_wp_stream', array() );
$report_settings['general_records_ttl'] = $settings['records_ttl'];
$report_settings['general_period_of_time'] = $settings['period_of_time'];
update_option('mainwp_wp_stream', $report_settings);
$information['result'] = 'success';
return $information;
}
public function creport_init() { public function creport_init() {
if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) { if ( get_option( 'mainwp_creport_ext_branding_enabled' ) !== 'Y' ) {
return; return;
@ -716,11 +709,6 @@ class MainWP_Client_Report {
if ( isset( $_POST['mainwpsignature'] ) ) { if ( isset( $_POST['mainwpsignature'] ) ) {
return $value; return $value;
} }
if ( isset( $value->response['stream/stream.php'] ) ) {
unset( $value->response['stream/stream.php'] );
}
if ( isset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ) ) { if ( isset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ) ) {
unset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] ); unset( $value->response['mainwp-child-reports/mainwp-child-reports.php'] );
} }
@ -732,7 +720,7 @@ class MainWP_Client_Report {
public function creport_branding_plugin( $plugins ) { public function creport_branding_plugin( $plugins ) {
foreach ( $plugins as $key => $value ) { foreach ( $plugins as $key => $value ) {
$plugin_slug = basename( $key, '.php' ); $plugin_slug = basename( $key, '.php' );
if ( 'stream' === $plugin_slug || 'mainwp-child-reports' === $plugin_slug ) { if ( 'mainwp-child-reports' === $plugin_slug ) {
unset( $plugins[ $key ] ); unset( $plugins[ $key ] );
} }
} }
@ -741,7 +729,6 @@ class MainWP_Client_Report {
} }
public function creport_remove_menu() { public function creport_remove_menu() {
remove_menu_page( 'wp_stream' );
remove_menu_page( 'mainwp_wp_stream' ); remove_menu_page( 'mainwp_wp_stream' );
} }
} }

View file

@ -378,14 +378,14 @@ class MainWP_Clone {
$dirparts = '<a href="' . $durl . '">' . $part . DIRECTORY_SEPARATOR . '</a>' . $dirparts; $dirparts = '<a href="' . $durl . '">' . $part . DIRECTORY_SEPARATOR . '</a>' . $dirparts;
} }
echo '<div style="padding: 8px 12px; background-color: #e5e5e5; margin-top: 1em;">' . __( '<strong>Current Directory:</strong> <span>' . $dirparts . '</span>', 'mainwp' ) . '</div>'; echo '<div style="padding: 8px 12px; background-color: #e5e5e5; margin-top: 1em;">' . __( '<strong>Current Directory:</strong> <span>' . $dirparts . '</span>', 'mainwp-child' ) . '</div>';
$quick_dirs = array(); $quick_dirs = array();
$quick_dirs[] = array( __( 'Site Root', 'mainwp' ), ABSPATH ); $quick_dirs[] = array( __( 'Site Root', 'mainwp-child' ), ABSPATH );
$quick_dirs[] = array( __( 'Backup', 'mainwp' ), $backup_dir ); $quick_dirs[] = array( __( 'Backup', 'mainwp-child' ), $backup_dir );
if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) { if ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) {
$quick_dirs[] = array( __( 'Uploads Folder', 'mainwp' ), $uploads['path'] ); $quick_dirs[] = array( __( 'Uploads Folder', 'mainwp-child' ), $uploads['path'] );
} }
$quick_dirs[] = array( __( 'Content Folder', 'mainwp' ), WP_CONTENT_DIR ); $quick_dirs[] = array( __( 'Content Folder', 'mainwp-child' ), WP_CONTENT_DIR );
$quick_links = array(); $quick_links = array();
foreach ( $quick_dirs as $dir ) { foreach ( $quick_dirs as $dir ) {
@ -399,7 +399,7 @@ class MainWP_Clone {
} }
if ( ! empty( $quick_links ) ) { if ( ! empty( $quick_links ) ) {
echo '<div style="padding: 8px 12px; border-bottom: 1px solid #e5e5e5; margin-bottom: 1em;"><strong>' . esc_html__( 'Quick Jump:', 'mainwp' ) . '</strong> ' . __( implode( ' | ', $quick_links ) ) . '</div>'; echo '<div style="padding: 8px 12px; border-bottom: 1px solid #e5e5e5; margin-bottom: 1em;"><strong>' . esc_html__( 'Quick Jump:', 'mainwp-child' ) . '</strong> ' . __( implode( ' | ', $quick_links ) ) . '</div>';
} }
$dir_files = scandir( $current_dir ); $dir_files = scandir( $current_dir );
@ -436,7 +436,7 @@ class MainWP_Clone {
<div class="clonesite_select_site_item"> <div class="clonesite_select_site_item">
<div class="mainwp-child_name_label"> <div class="mainwp-child_name_label">
<a href="<?php echo esc_url( add_query_arg( array( 'dir' => rawurlencode( $parent ) ), $url ) ); ?>" <a href="<?php echo esc_url( add_query_arg( array( 'dir' => rawurlencode( $parent ) ), $url ) ); ?>"
title="<?php echo esc_attr( dirname( $current_dir ) ) ?>"><?php esc_html_e( 'Parent Folder', 'mainwp' ) ?></a> title="<?php echo esc_attr( dirname( $current_dir ) ) ?>"><?php esc_html_e( 'Parent Folder', 'mainwp-child' ) ?></a>
</div> </div>
</div> </div>

View file

@ -980,6 +980,14 @@ class MainWP_Helper {
return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp ); return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp );
} }
public static function formatDate( $timestamp ) {
return date_i18n( get_option( 'date_format' ), $timestamp );
}
public static function formatTime( $timestamp ) {
return date_i18n( get_option( 'time_format' ), $timestamp );
}
public static function formatTimestamp( $timestamp ) { public static function formatTimestamp( $timestamp ) {
return date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp ); return date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp );
} }

View file

@ -304,7 +304,7 @@ class MainWP_Security {
} }
public static function remove_theme_versions( $src ) { public static function remove_theme_versions( $src ) {
if ( 'T' === self::get_security_option( 'styles_version' ) ) { if ( self::get_security_option( 'styles_version' ) ) {
if ( strpos( $src, '?ver=' ) ) { if ( strpos( $src, '?ver=' ) ) {
$src = remove_query_arg( 'ver', $src ); $src = remove_query_arg( 'ver', $src );
} }

View file

@ -6,7 +6,7 @@
Author: MainWP Author: MainWP
Author URI: https://mainwp.com Author URI: https://mainwp.com
Text Domain: mainwp-child Text Domain: mainwp-child
Version: 3.2.6-beta Version: 3.2.6
*/ */
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) { if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
header( 'X-Frame-Options: ALLOWALL' ); header( 'X-Frame-Options: ALLOWALL' );