mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-06 09:20:28 +08:00
parent
9315fffdb4
commit
70ebd81a01
5 changed files with 78 additions and 77 deletions
|
@ -784,11 +784,11 @@ class MainWP_Child_Branding {
|
|||
if ( isset( $_POST['submit'] ) ) {
|
||||
if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], '_contactNonce' ) ) {
|
||||
return false;
|
||||
}
|
||||
$this->render_submit_message( $opts );
|
||||
}
|
||||
$this->render_submit_message( $opts );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$from_page = '';
|
||||
if ( isset( $_GET['from_page'] ) ) {
|
||||
$from_page = rawurldecode( $_GET['from_page'] );
|
||||
|
@ -846,11 +846,11 @@ class MainWP_Child_Branding {
|
|||
<input type="hidden" name="mainwp_branding_send_from_page" value="<?php echo esc_url( $from_page ); ?>"/>
|
||||
<input type="hidden" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( '_contactNonce' ) ); ?>"/>
|
||||
</form>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
private function render_submit_message( $opts ) {
|
||||
|
||||
|
||||
$from_page = $_POST['mainwp_branding_send_from_page'];
|
||||
$back_link = $opts['message_return_sender'];
|
||||
$back_link = ! empty( $back_link ) ? $back_link : 'Go Back';
|
||||
|
|
|
@ -270,27 +270,27 @@ class MainWP_Child_Callable {
|
|||
// to fix issue of meta_value short length.
|
||||
$performed_what[] = 'revisions'; // 'Posts revisions deleted'.
|
||||
} else {
|
||||
$results = MainWP_Helper::get_revisions( $max_revisions );
|
||||
$results = MainWP_Helper::get_revisions( $max_revisions );
|
||||
$this->maintenance_delete_revisions( $results, $max_revisions );
|
||||
$performed_what[] = 'revisions_max'; // 'Posts revisions deleted'.
|
||||
}
|
||||
}
|
||||
|
||||
$maint_sqls = array(
|
||||
'autodraft' => "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'",
|
||||
'trashpost' => "DELETE FROM $wpdb->posts WHERE post_status = 'trash'",
|
||||
'spam' => "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'",
|
||||
'pending' => "DELETE FROM $wpdb->comments WHERE comment_approved = '0'",
|
||||
'trashcomment' => "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'"
|
||||
'autodraft' => "DELETE FROM $wpdb->posts WHERE post_status = 'auto-draft'",
|
||||
'trashpost' => "DELETE FROM $wpdb->posts WHERE post_status = 'trash'",
|
||||
'spam' => "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'",
|
||||
'pending' => "DELETE FROM $wpdb->comments WHERE comment_approved = '0'",
|
||||
'trashcomment' => "DELETE FROM $wpdb->comments WHERE comment_approved = 'trash'",
|
||||
);
|
||||
|
||||
foreach( $maint_sqls as $act => $sql_clean ) {
|
||||
|
||||
foreach ( $maint_sqls as $act => $sql_clean ) {
|
||||
if ( in_array( $act, $maint_options ) ) {
|
||||
$wpdb->query( $sql_clean ); // phpcs:ignore -- safe sql.
|
||||
$performed_what[] = $act; // 'Auto draft posts deleted'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( in_array( 'tags', $maint_options ) ) {
|
||||
$post_tags = get_terms( 'post_tag', array( 'hide_empty' => false ) );
|
||||
if ( is_array( $post_tags ) ) {
|
||||
|
@ -357,7 +357,7 @@ class MainWP_Child_Callable {
|
|||
|
||||
return $count_deleted;
|
||||
}
|
||||
|
||||
|
||||
private function maintenance_optimize() {
|
||||
global $wpdb, $table_prefix;
|
||||
$sql = 'SHOW TABLE STATUS FROM `' . DB_NAME . '`';
|
||||
|
@ -550,9 +550,9 @@ class MainWP_Child_Callable {
|
|||
|
||||
$fileName = ( isset( $_POST['fileUID'] ) ? $_POST['fileUID'] : '' );
|
||||
if ( 'full' === $_POST['type'] ) {
|
||||
|
||||
|
||||
$res = $this->backup_full( $fileName );
|
||||
|
||||
|
||||
if ( ! $res ) {
|
||||
$information['full'] = false;
|
||||
} else {
|
||||
|
@ -586,7 +586,7 @@ class MainWP_Child_Callable {
|
|||
return $information;
|
||||
}
|
||||
|
||||
protected function backup_full( $fileName ) {
|
||||
protected function backup_full( $fileName ) {
|
||||
$excludes = ( isset( $_POST['exclude'] ) ? explode( ',', $_POST['exclude'] ) : array() );
|
||||
$excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/uploads/mainwp';
|
||||
$uploadDir = MainWP_Helper::get_mainwp_dir();
|
||||
|
@ -675,9 +675,9 @@ class MainWP_Child_Callable {
|
|||
$pid = $_POST['pid'];
|
||||
}
|
||||
$append = ( isset( $_POST['append'] ) && ( '1' == $_POST['append'] ) );
|
||||
return MainWP_Backup::get()->create_full_backup( $newExcludes, $fileName, true, true, $file_descriptors, $file, $excludezip, $excludenonwp, $loadFilesBeforeZip, $ext, $pid, $append );
|
||||
return MainWP_Backup::get()->create_full_backup( $newExcludes, $fileName, true, true, $file_descriptors, $file, $excludezip, $excludenonwp, $loadFilesBeforeZip, $ext, $pid, $append );
|
||||
}
|
||||
|
||||
|
||||
protected function backup_db( $fileName = '', $ext = 'zip' ) {
|
||||
$dirs = MainWP_Helper::get_mainwp_dir( 'backup' );
|
||||
$dir = $dirs[0];
|
||||
|
|
|
@ -147,7 +147,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
private static function render_page_js() {
|
||||
?>
|
||||
?>
|
||||
<script language="javascript">
|
||||
|
||||
/* FileSaver.js
|
||||
|
@ -427,10 +427,11 @@ class MainWP_Child_Server_Information {
|
|||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
public static function render_page() {
|
||||
self::render_page_js();
|
||||
?>
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
#mwp-server-information {
|
||||
display: none;
|
||||
|
@ -562,9 +563,9 @@ class MainWP_Child_Server_Information {
|
|||
<br/>
|
||||
<?php
|
||||
}
|
||||
|
||||
private function render_system_infor_rows( $branding_title ){
|
||||
?>
|
||||
|
||||
private function render_system_infor_rows( $branding_title ) {
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php echo esc_html( strtoupper( stripslashes( $branding_title ) ) ); ?></td>
|
||||
</tr>
|
||||
|
@ -601,7 +602,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
private function render_php_settings_rows() {
|
||||
?>
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
colspan="5"><?php esc_html_e( 'PHP SETTINGS', 'mainwp-child' ); ?></td>
|
||||
|
@ -640,9 +641,8 @@ class MainWP_Child_Server_Information {
|
|||
'curlssl'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function render_mysql_infor_rows() {
|
||||
?>
|
||||
<tr>
|
||||
|
@ -657,9 +657,9 @@ class MainWP_Child_Server_Information {
|
|||
<?php self::render_row( 'Tar BZip2 supported', '=', true, 'get_bzip_enabled' ); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
private function render_plugins_infor_rows( $isBranding ) {
|
||||
?>
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php _e( 'WordPress PLUGINS', 'mainwp-child' ); ?></td>
|
||||
</tr>
|
||||
|
@ -686,9 +686,9 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
private function render_php_infor_rows(){
|
||||
?>
|
||||
|
||||
private function render_php_infor_rows() {
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp-child' ); ?></td>
|
||||
</tr>
|
||||
|
@ -736,11 +736,11 @@ class MainWP_Child_Server_Information {
|
|||
<td><?php esc_html_e( 'MySQL Client Encoding', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php echo esc_html( defined( 'DB_CHARSET' ) ? DB_CHARSET : '' ); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
private function render_server_infor_rows(){
|
||||
?>
|
||||
|
||||
private function render_server_infor_rows() {
|
||||
?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp-child' ); ?></td>
|
||||
</tr>
|
||||
|
@ -861,7 +861,7 @@ class MainWP_Child_Server_Information {
|
|||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
protected static function get_curl_support() {
|
||||
return function_exists( 'curl_version' );
|
||||
}
|
||||
|
|
|
@ -145,28 +145,29 @@ class MainWP_Client_Report {
|
|||
public function get_connector_by_compatible_context( $context ) {
|
||||
|
||||
$connector = '';
|
||||
|
||||
|
||||
$mapping_connectors = array(
|
||||
'plugins' => 'installer',
|
||||
'themes' => 'installer',
|
||||
'WordPress' => 'installer',
|
||||
'profiles' => 'users',
|
||||
'comments' => 'comments',
|
||||
'settings' => 'settings',
|
||||
'post' => 'posts',
|
||||
'page' => 'posts',
|
||||
'widgets' => 'widgets',
|
||||
'menus' => 'menus',
|
||||
'backups' => 'mainwp_backups',
|
||||
'sucuri_scan' => 'mainwp_sucuri',
|
||||
'mainwp_maintenance' => 'mainwp_maintenance',
|
||||
'wordfence_scan' => 'mainwp_wordfence',
|
||||
'media' => 'media'
|
||||
'plugins' => 'installer',
|
||||
'themes' => 'installer',
|
||||
'WordPress' => 'installer',
|
||||
'profiles' => 'users',
|
||||
'comments' => 'comments',
|
||||
'settings' => 'settings',
|
||||
'post' => 'posts',
|
||||
'page' => 'posts',
|
||||
'widgets' => 'widgets',
|
||||
'menus' => 'menus',
|
||||
'backups' => 'mainwp_backups',
|
||||
'sucuri_scan' => 'mainwp_sucuri',
|
||||
'mainwp_maintenance' => 'mainwp_maintenance',
|
||||
'wordfence_scan' => 'mainwp_wordfence',
|
||||
'media' => 'media',
|
||||
);
|
||||
|
||||
if ( isset( $mapping_connectors[ $context ] ) )
|
||||
|
||||
if ( isset( $mapping_connectors[ $context ] ) ) {
|
||||
$connector = $mapping_connectors[ $context ];
|
||||
|
||||
}
|
||||
|
||||
return $connector;
|
||||
}
|
||||
|
||||
|
@ -198,7 +199,7 @@ class MainWP_Client_Report {
|
|||
}
|
||||
|
||||
public function get_stream() {
|
||||
|
||||
|
||||
$allowed_params = array(
|
||||
'connector',
|
||||
'context',
|
||||
|
@ -797,7 +798,7 @@ class MainWP_Client_Report {
|
|||
case 'status':
|
||||
case 'webtrust':
|
||||
if ( 'sucuri_scan' === $context ) {
|
||||
$tok_value = $this->get_sucuri_scan_token_value( $record, $data );
|
||||
$tok_value = $this->get_sucuri_scan_token_value( $record, $data );
|
||||
} else {
|
||||
$tok_value = $value;
|
||||
}
|
||||
|
@ -819,7 +820,7 @@ class MainWP_Client_Report {
|
|||
$meta_value = '';
|
||||
}
|
||||
}
|
||||
$tok_value = $meta_value;
|
||||
$tok_value = $meta_value;
|
||||
}
|
||||
break;
|
||||
case 'type':
|
||||
|
@ -876,7 +877,7 @@ class MainWP_Client_Report {
|
|||
}
|
||||
|
||||
private function get_sucuri_scan_token_value( $record, $data ) {
|
||||
$scan_data = $this->get_stream_meta_data( $record, 'scan_data' );
|
||||
$scan_data = $this->get_stream_meta_data( $record, 'scan_data' );
|
||||
if ( ! empty( $scan_data ) ) {
|
||||
$scan_data = maybe_unserialize( base64_decode( $scan_data ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for begin reasons.
|
||||
if ( is_array( $scan_data ) ) {
|
||||
|
@ -901,9 +902,9 @@ class MainWP_Client_Report {
|
|||
}
|
||||
return $tok_value;
|
||||
}
|
||||
|
||||
|
||||
private function get_mainwp_maintenance_token_value( $record, $data ) {
|
||||
|
||||
|
||||
$meta_value = $this->get_stream_meta_data( $record, $data );
|
||||
$meta_value = explode( ',', $meta_value );
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class MainWP_Clone {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function init_ajax() {
|
||||
$this->add_action( 'mainwp-child_clone_backupcreate', array( &$this, 'clone_backup_create' ) );
|
||||
$this->add_action( 'mainwp-child_clone_backupcreatepoll', array( &$this, 'clone_backup_create_poll' ) );
|
||||
|
@ -34,7 +34,7 @@ class MainWP_Clone {
|
|||
$this->add_action( 'mainwp-child_clone_backupdownloadpoll', array( &$this, 'clone_backup_download_poll' ) );
|
||||
$this->add_action( 'mainwp-child_clone_backupextract', array( &$this, 'clone_backup_extract' ) );
|
||||
}
|
||||
|
||||
|
||||
public function add_security_nonce( $action ) {
|
||||
if ( ! is_array( $this->security_nonces ) ) {
|
||||
$this->security_nonces = array();
|
||||
|
@ -181,16 +181,16 @@ class MainWP_Clone {
|
|||
self::render_java_script();
|
||||
}
|
||||
|
||||
private static function render_form( $sitesToClone, $uploadFile, $uploadSize, $error, $uploadError ){
|
||||
private static function render_form( $sitesToClone, $uploadFile, $uploadSize, $error, $uploadError ) {
|
||||
|
||||
if ( !empty( $uploadFile ) ) {
|
||||
if ( ! empty( $uploadFile ) ) {
|
||||
esc_html_e( 'Upload successful.', 'mainwp-child' );
|
||||
?>
|
||||
<a href="#" id="mainwp-child_uploadclonebutton" class="button-primary" file="<?php echo esc_attr( $uploadFile ); ?>"><?php esc_html_e( 'Clone/Restore website', 'mainwp-child' ); ?></a>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( $uploadError ) {
|
||||
?>
|
||||
<div class="mainwp-child_info-box-red"><?php echo esc_html( $uploadError ); ?></div>
|
||||
|
@ -233,7 +233,7 @@ class MainWP_Clone {
|
|||
</form>
|
||||
<br/>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="postbox">
|
||||
<h2 class="hndle"><strong><?php esc_html_e( 'Option 1:', 'mainwp-child' ); ?></strong> <?php esc_html_e( 'Restore/Clone from backup', 'mainwp-child' ); ?></h2>
|
||||
|
@ -253,7 +253,7 @@ class MainWP_Clone {
|
|||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
public static function render_normal_restore() {
|
||||
$uploadError = false;
|
||||
$uploadFile = false;
|
||||
|
@ -421,11 +421,11 @@ class MainWP_Clone {
|
|||
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>';
|
||||
}
|
||||
|
||||
self::render_clone_from_server_form( $current_dir, $url );
|
||||
self::render_clone_from_server_form( $current_dir, $url );
|
||||
}
|
||||
|
||||
private static function render_clone_from_server_form( $current_dir, $url ) {
|
||||
|
||||
|
||||
$dir_files = scandir( $current_dir );
|
||||
$directories = array();
|
||||
$files = array();
|
||||
|
@ -446,7 +446,7 @@ class MainWP_Clone {
|
|||
}
|
||||
|
||||
sort( $directories );
|
||||
sort( $files );
|
||||
sort( $files );
|
||||
$parent = dirname( $current_dir );
|
||||
?>
|
||||
<form method="post" action="">
|
||||
|
@ -505,7 +505,7 @@ class MainWP_Clone {
|
|||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
public static function render_java_script() {
|
||||
$uploadSizeInBytes = min( MainWP_Helper::return_bytes( ini_get( 'upload_max_filesize' ) ), MainWP_Helper::return_bytes( ini_get( 'post_max_size' ) ) );
|
||||
$uploadSize = MainWP_Helper::human_filesize( $uploadSizeInBytes );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue