mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-08-31 03:53:15 +08:00
Refactoring
This commit is contained in:
parent
caac8ef5ae
commit
aa89db5f6c
30 changed files with 506 additions and 1073 deletions
|
@ -31,7 +31,7 @@ class MainWP_Backup {
|
|||
/**
|
||||
* Create full backup
|
||||
*/
|
||||
public function createFullBackup( $excludes, $filePrefix = '', $addConfig = false, $includeCoreFiles = false, $file_descriptors = 0, $fileSuffix = false, $excludezip = false, $excludenonwp = false, $loadFilesBeforeZip = true, $ext = 'zip', $pid = false, $append = false ) {
|
||||
public function create_full_backup( $excludes, $filePrefix = '', $addConfig = false, $includeCoreFiles = false, $file_descriptors = 0, $fileSuffix = false, $excludezip = false, $excludenonwp = false, $loadFilesBeforeZip = true, $ext = 'zip', $pid = false, $append = false ) {
|
||||
$this->file_descriptors = $file_descriptors;
|
||||
$this->loadFilesBeforeZip = $loadFilesBeforeZip;
|
||||
|
||||
|
@ -67,7 +67,7 @@ class MainWP_Backup {
|
|||
$ext = '.zip';
|
||||
} else {
|
||||
$this->archiver = new Tar_Archiver( $this, $ext, $pid );
|
||||
$ext = $this->archiver->getExtension();
|
||||
$ext = $this->archiver->get_extension();
|
||||
}
|
||||
|
||||
if ( ( false !== $fileSuffix ) && ! empty( $fileSuffix ) ) {
|
||||
|
@ -95,13 +95,13 @@ class MainWP_Backup {
|
|||
// phpcs:enable
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
$success = $this->archiver->createFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp, $append );
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
$success = $this->createZipFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
$success = $this->createZipConsoleFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
$success = $this->archiver->create_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp, $append );
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
$success = $this->create_zip_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
} elseif ( $this->check_zip_console() ) {
|
||||
$success = $this->create_zip_console_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
} else {
|
||||
$success = $this->createZipPclFullBackup2( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
$success = $this->create_zip_pcl_full_backup2( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp );
|
||||
}
|
||||
|
||||
return ( $success ) ? array(
|
||||
|
@ -111,7 +111,7 @@ class MainWP_Backup {
|
|||
) : false;
|
||||
}
|
||||
|
||||
public function zipFile( $files, $archive ) {
|
||||
public function zip_file( $files, $archive ) {
|
||||
$this->timeout = 20 * 60 * 60;
|
||||
$mem = '512M';
|
||||
// phpcs:disable
|
||||
|
@ -125,19 +125,19 @@ class MainWP_Backup {
|
|||
}
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
$success = $this->archiver->zipFile( $files, $archive );
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
$success = $this->_zipFile( $files, $archive );
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
$success = $this->_zipFileConsole( $files, $archive );
|
||||
$success = $this->archiver->zip_file( $files, $archive );
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
$success = $this->m_zip_file( $files, $archive );
|
||||
} elseif ( $this->check_zip_console() ) {
|
||||
$success = $this->m_zip_file_console( $files, $archive );
|
||||
} else {
|
||||
$success = $this->_zipFilePcl( $files, $archive );
|
||||
$success = $this->m_zip_file_pcl( $files, $archive );
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
||||
public function _zipFile( $files, $archive ) {
|
||||
public function m_zip_file( $files, $archive ) {
|
||||
$this->zip = new ZipArchive();
|
||||
$this->zipArchiveFileCount = 0;
|
||||
$this->zipArchiveSizeCount = 0;
|
||||
|
@ -145,7 +145,7 @@ class MainWP_Backup {
|
|||
$zipRes = $this->zip->open( $archive, ZipArchive::CREATE );
|
||||
if ( $zipRes ) {
|
||||
foreach ( $files as $file ) {
|
||||
$this->addFileToZip( $file, basename( $file ) );
|
||||
$this->add_fileToZip( $file, basename( $file ) );
|
||||
}
|
||||
|
||||
return $this->zip->close();
|
||||
|
@ -154,11 +154,11 @@ class MainWP_Backup {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function _zipFileConsole( $files, $archive ) {
|
||||
public function m_zip_file_console( $files, $archive ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function _zipFilePcl( $files, $archive ) {
|
||||
public function m_zip_file_pcl( $files, $archive ) {
|
||||
// Zip this backup folder.
|
||||
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
|
||||
$this->zip = new PclZip( $archive );
|
||||
|
@ -179,7 +179,7 @@ class MainWP_Backup {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkZipSupport() {
|
||||
public function check_zip_support() {
|
||||
return class_exists( 'ZipArchive' );
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ class MainWP_Backup {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkZipConsole() {
|
||||
public function check_zip_console() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ class MainWP_Backup {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function createZipFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
public function create_zip_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
$this->excludeZip = $excludezip;
|
||||
$this->zip = new ZipArchive();
|
||||
$this->zipArchiveFileCount = 0;
|
||||
|
@ -248,13 +248,13 @@ class MainWP_Backup {
|
|||
unset( $coreFiles );
|
||||
}
|
||||
|
||||
$db_files = $this->createBackupDB( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup' );
|
||||
$db_files = $this->create_backup_db( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup' );
|
||||
foreach ( $db_files as $db_file ) {
|
||||
$this->addFileToZip( $db_file, basename( WP_CONTENT_DIR ) . '/' . basename( $db_file ) );
|
||||
$this->add_file_to_zipp( $db_file, basename( WP_CONTENT_DIR ) . '/' . basename( $db_file ) );
|
||||
}
|
||||
|
||||
if ( file_exists( ABSPATH . '.htaccess' ) ) {
|
||||
$this->addFileToZip( ABSPATH . '.htaccess', 'mainwp-htaccess' );
|
||||
$this->add_file_to_zipp( ABSPATH . '.htaccess', 'mainwp-htaccess' );
|
||||
}
|
||||
|
||||
foreach ( $nodes as $node ) {
|
||||
|
@ -266,9 +266,9 @@ class MainWP_Backup {
|
|||
|
||||
if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) {
|
||||
if ( is_dir( $node ) ) {
|
||||
$this->zipAddDir( $node, $excludes );
|
||||
$this->zip_add_dir( $node, $excludes );
|
||||
} elseif ( is_file( $node ) ) {
|
||||
$this->addFileToZip( $node, str_replace( ABSPATH, '', $node ) );
|
||||
$this->add_file_to_zipp( $node, str_replace( ABSPATH, '', $node ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ class MainWP_Backup {
|
|||
)
|
||||
);
|
||||
|
||||
$this->addFileFromStringToZip( 'clone/config.txt', $string );
|
||||
$this->add_file_from_string_to_zip( 'clone/config.txt', $string );
|
||||
}
|
||||
|
||||
$return = $this->zip->close();
|
||||
|
@ -335,114 +335,6 @@ class MainWP_Backup {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create full backup using pclZip library
|
||||
*
|
||||
* @param string $filepath File path to create
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function createZipPclFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
|
||||
$this->zip = new PclZip( $filepath );
|
||||
$nodes = glob( ABSPATH . '*' );
|
||||
if ( ! $includeCoreFiles ) {
|
||||
$coreFiles = array(
|
||||
'favicon.ico',
|
||||
'index.php',
|
||||
'license.txt',
|
||||
'readme.html',
|
||||
'wp-activate.php',
|
||||
'wp-app.php',
|
||||
'wp-blog-header.php',
|
||||
'wp-comments-post.php',
|
||||
'wp-config.php',
|
||||
'wp-config-sample.php',
|
||||
'wp-cron.php',
|
||||
'wp-links-opml.php',
|
||||
'wp-load.php',
|
||||
'wp-login.php',
|
||||
'wp-mail.php',
|
||||
'wp-pass.php',
|
||||
'wp-register.php',
|
||||
'wp-settings.php',
|
||||
'wp-signup.php',
|
||||
'wp-trackback.php',
|
||||
'xmlrpc.php',
|
||||
);
|
||||
foreach ( $nodes as $key => $node ) {
|
||||
if ( MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) {
|
||||
unset( $nodes[ $key ] );
|
||||
} elseif ( MainWP_Helper::starts_with( $node, ABSPATH . basename( admin_url( '' ) ) ) ) {
|
||||
unset( $nodes[ $key ] );
|
||||
} else {
|
||||
foreach ( $coreFiles as $coreFile ) {
|
||||
if ( ABSPATH . $coreFile === $node ) {
|
||||
unset( $nodes[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
unset( $coreFiles );
|
||||
}
|
||||
|
||||
$db_files = $this->createBackupDB( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup' );
|
||||
$error = false;
|
||||
foreach ( $db_files as $db_file ) {
|
||||
$rslt = $this->zip->add( $db_file, PCLZIP_OPT_REMOVE_PATH, dirname( $db_file ), PCLZIP_OPT_ADD_PATH, basename( WP_CONTENT_DIR ) );
|
||||
if ( 0 === $rslt ) {
|
||||
$error = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $db_files as $db_file ) {
|
||||
unlink( $db_file );
|
||||
}
|
||||
if ( ! $error ) {
|
||||
foreach ( $nodes as $node ) {
|
||||
if ( null === $excludes || ! in_array( str_replace( ABSPATH, '', $node ), $excludes, true ) ) {
|
||||
if ( is_dir( $node ) ) {
|
||||
if ( ! $this->pclZipAddDir( $node, $excludes ) ) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
} elseif ( is_file( $node ) ) {
|
||||
$rslt = $this->zip->add( $node, PCLZIP_OPT_REMOVE_PATH, ABSPATH );
|
||||
if ( 0 === $rslt ) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $addConfig ) {
|
||||
global $wpdb;
|
||||
$string = base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons.
|
||||
serialize(
|
||||
array(
|
||||
'siteurl' => get_option( 'siteurl' ),
|
||||
'home' => get_option( 'home' ),
|
||||
'abspath' => ABSPATH,
|
||||
'prefix' => $wpdb->prefix,
|
||||
'lang' => WPLANG,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->addFileFromStringToPCLZip( 'clone/config.txt', $string, $filepath );
|
||||
}
|
||||
|
||||
if ( $error ) {
|
||||
unlink( $filepath ); // phpcs:ignore
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function copy_dir( $nodes, $excludes, $backupfolder, $excludenonwp, $root ) {
|
||||
if ( ! is_array( $nodes ) ) {
|
||||
return;
|
||||
|
@ -475,14 +367,14 @@ class MainWP_Backup {
|
|||
}
|
||||
}
|
||||
|
||||
public function createZipPclFullBackup2( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
public function create_zip_pcl_full_backup2( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
// Create backup folder.
|
||||
$backupFolder = dirname( $filepath ) . DIRECTORY_SEPARATOR . 'backup' . DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir( $backupFolder ); // phpcs:ignore
|
||||
|
||||
// Create DB backup.
|
||||
$db_files = $this->createBackupDB( $backupFolder . 'dbBackup' );
|
||||
$db_files = $this->create_backup_db( $backupFolder . 'dbBackup' );
|
||||
|
||||
// Copy installation to backup folder.
|
||||
$nodes = glob( ABSPATH . '*' );
|
||||
|
@ -552,7 +444,7 @@ class MainWP_Backup {
|
|||
)
|
||||
);
|
||||
|
||||
$this->addFileFromStringToPCLZip( 'clone/config.txt', $string, $filepath );
|
||||
$this->add_file_from_string_to_pcl_zip( 'clone/config.txt', $string, $filepath );
|
||||
}
|
||||
// Remove backup folder.
|
||||
MainWP_Helper::delete_dir( $backupFolder );
|
||||
|
@ -563,11 +455,11 @@ class MainWP_Backup {
|
|||
/**
|
||||
* Recursive add directory for default PHP zip library
|
||||
*/
|
||||
public function zipAddDir( $path, $excludes ) {
|
||||
$this->zip->addEmptyDir( str_replace( ABSPATH, '', $path ) );
|
||||
public function zip_add_dir( $path, $excludes ) {
|
||||
$this->zip->add_empty_dir( str_replace( ABSPATH, '', $path ) );
|
||||
|
||||
if ( file_exists( rtrim( $path, '/' ) . '/.htaccess' ) ) {
|
||||
$this->addFileToZip( rtrim( $path, '/' ) . '/.htaccess', rtrim( str_replace( ABSPATH, '', $path ), '/' ) . '/mainwp-htaccess' );
|
||||
$this->add_file_to_zipp( rtrim( $path, '/' ) . '/.htaccess', rtrim( str_replace( ABSPATH, '', $path ), '/' ) . '/mainwp-htaccess' );
|
||||
}
|
||||
|
||||
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST );
|
||||
|
@ -580,9 +472,9 @@ class MainWP_Backup {
|
|||
|
||||
if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) {
|
||||
if ( $path->isDir() ) {
|
||||
$this->zipAddDir( $name, $excludes );
|
||||
$this->zip_add_dir( $name, $excludes );
|
||||
} else {
|
||||
$this->addFileToZip( $name, str_replace( ABSPATH, '', $name ) );
|
||||
$this->add_file_to_zipp( $name, str_replace( ABSPATH, '', $name ) );
|
||||
}
|
||||
}
|
||||
$name = null;
|
||||
|
@ -593,7 +485,7 @@ class MainWP_Backup {
|
|||
unset( $iterator );
|
||||
}
|
||||
|
||||
public function pclZipAddDir( $path, $excludes ) {
|
||||
public function pcl_zip_add_dir( $path, $excludes ) {
|
||||
$error = false;
|
||||
$nodes = glob( rtrim( $path, '/' ) . '/*' );
|
||||
if ( empty( $nodes ) ) {
|
||||
|
@ -603,7 +495,7 @@ class MainWP_Backup {
|
|||
foreach ( $nodes as $node ) {
|
||||
if ( null === $excludes || ! in_array( str_replace( ABSPATH, '', $node ), $excludes, true ) ) {
|
||||
if ( is_dir( $node ) ) {
|
||||
if ( ! $this->pclZipAddDir( $node, $excludes ) ) {
|
||||
if ( ! $this->pcl_zip_add_dir( $node, $excludes ) ) {
|
||||
$error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -620,11 +512,11 @@ class MainWP_Backup {
|
|||
return ! $error;
|
||||
}
|
||||
|
||||
public function addFileFromStringToZip( $file, $string ) {
|
||||
public function add_file_from_string_to_zip( $file, $string ) {
|
||||
return $this->zip->addFromString( $file, $string );
|
||||
}
|
||||
|
||||
public function addFileFromStringToPCLZip( $file, $string, $filepath ) {
|
||||
public function add_file_from_string_to_pcl_zip( $file, $string, $filepath ) {
|
||||
$file = preg_replace( '/(?:\.|\/)*(.*)/', '$1', $file );
|
||||
$localpath = dirname( $file );
|
||||
$tmpfilename = dirname( $filepath ) . '/' . basename( $file );
|
||||
|
@ -649,7 +541,7 @@ class MainWP_Backup {
|
|||
protected $gcCnt = 0;
|
||||
protected $testContent;
|
||||
|
||||
public function addFileToZip( $path, $zipEntryName ) {
|
||||
public function add_file_to_zipp( $path, $zipEntryName ) {
|
||||
if ( time() - $this->lastRun > 20 ) {
|
||||
set_time_limit( $this->timeout ); // phpcs:ignore
|
||||
$this->lastRun = time();
|
||||
|
@ -664,7 +556,7 @@ class MainWP_Backup {
|
|||
|
||||
if ( ! $this->loadFilesBeforeZip || ( filesize( $path ) > 5 * 1024 * 1024 ) ) {
|
||||
$this->zipArchiveFileCount ++;
|
||||
$added = $this->zip->addFile( $path, $zipEntryName );
|
||||
$added = $this->zip->add_file( $path, $zipEntryName );
|
||||
} else {
|
||||
$this->zipArchiveFileCount ++;
|
||||
|
||||
|
@ -704,11 +596,11 @@ class MainWP_Backup {
|
|||
return $added;
|
||||
}
|
||||
|
||||
public function createZipConsoleFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
public function create_zip_console_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function createBackupDB( $filepath_prefix, $archiveExt = false, &$archiver = null ) {
|
||||
public function create_backup_db( $filepath_prefix, $archiveExt = false, &$archiver = null ) {
|
||||
$timeout = 20 * 60 * 60;
|
||||
set_time_limit( $timeout );
|
||||
ini_set( 'max_execution_time', $timeout );
|
||||
|
@ -722,7 +614,7 @@ class MainWP_Backup {
|
|||
$tables_db = $wpdb->get_results( 'SHOW TABLES FROM `' . DB_NAME . '`', ARRAY_N );
|
||||
foreach ( $tables_db as $curr_table ) {
|
||||
if ( null !== $archiver ) {
|
||||
$archiver->updatePidFile();
|
||||
$archiver->update_pid_file();
|
||||
}
|
||||
|
||||
$table = $curr_table[0];
|
||||
|
@ -788,7 +680,7 @@ class MainWP_Backup {
|
|||
$this->archiver = new Tar_Archiver( $this, $archiveExt );
|
||||
}
|
||||
|
||||
if ( $this->zipFile( $db_files, $archivefilePath ) && file_exists( $archivefilePath ) ) {
|
||||
if ( $this->zip_file( $db_files, $archivefilePath ) && file_exists( $archivefilePath ) ) {
|
||||
foreach ( $db_files as $db_file ) {
|
||||
unlink( $db_file );
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainWP_Child_Back_Up_Buddy {
|
|||
public $plugin_translate = 'mainwp-child';
|
||||
public $is_backupbuddy_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Back_Up_Buddy();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Back_Up_Wordpress();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
|
||||
public function action() {
|
||||
$information = array();
|
||||
if ( ! self::isActivated() ) {
|
||||
if ( ! self::is_activated() ) {
|
||||
$information['error'] = 'NO_BACKUPWORDPRESS';
|
||||
MainWP_Helper::write( $information );
|
||||
}
|
||||
|
@ -1043,7 +1043,7 @@ class MainWP_Child_Back_Up_Wordpress {
|
|||
return $out;
|
||||
}
|
||||
|
||||
public static function isActivated() {
|
||||
public static function is_activated() {
|
||||
if ( ! defined( 'HMBKP_PLUGIN_PATH' ) || ! class_exists( 'HM\BackUpWordPress\Plugin' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class MainWP_Child_Back_WP_Up {
|
|||
'dest-GLACIER' => array( 'glaciersecretkey' ),
|
||||
);
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null == self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Back_WP_Up();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class MainWP_Child_Branding {
|
|||
public $child_plugin_dir;
|
||||
public $child_branding_options = null;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Branding();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainWP_Child_IThemes_Security {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class MainWP_Child_Links_Checker {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Links_Checker();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainWP_Child_Pagespeed {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Pagespeed();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class MainWP_Child_Plugins_Check {
|
|||
private $tran_name_plugins_to_batch = 'mainwp_child_tran_name_plugins_to_batch';
|
||||
private $option_name_last_daily_run = 'mainwp_child_plugin_last_daily_run';
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Plugins_Check();
|
||||
}
|
||||
|
|
|
@ -5,11 +5,22 @@ class MainWP_Child_Server_Information {
|
|||
const WARNING = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
/**
|
||||
* Method get_class_name()
|
||||
*
|
||||
* Get Class Name.
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public static function get_class_name() {
|
||||
return __CLASS__;
|
||||
}
|
||||
|
||||
public static function init() {
|
||||
add_action(
|
||||
'wp_ajax_mainwp-child_dismiss_warnings',
|
||||
array(
|
||||
'MainWP_Child_Server_Information',
|
||||
MainWP_Child_Server_Information::get_class_name(),
|
||||
'dismiss_warnings',
|
||||
)
|
||||
);
|
||||
|
@ -25,7 +36,7 @@ class MainWP_Child_Server_Information {
|
|||
if ( isset( $_POST['warnings'] ) ) {
|
||||
$warnings = intval( $_POST['warnings'] );
|
||||
} else {
|
||||
$warnings = self::getWarnings();
|
||||
$warnings = self::get_warnings();
|
||||
}
|
||||
$dismissWarnings['warnings'] = $warnings;
|
||||
}
|
||||
|
@ -33,12 +44,12 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
public static function showWarnings() {
|
||||
public static function show_warnings() {
|
||||
if ( stristr( $_SERVER['REQUEST_URI'], 'mainwp_child_tab' ) || stristr( $_SERVER['REQUEST_URI'], 'mainwp-reports-page' ) || stristr( $_SERVER['REQUEST_URI'], 'mainwp-reports-settings' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$warnings = self::getWarnings();
|
||||
$warnings = self::get_warnings();
|
||||
|
||||
$dismissWarnings = get_option( 'mainwp_child_dismiss_warnings' );
|
||||
if ( ! is_array( $dismissWarnings ) ) {
|
||||
|
@ -135,7 +146,7 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function renderPage() {
|
||||
public static function render_page() {
|
||||
?>
|
||||
<script language="javascript">
|
||||
|
||||
|
@ -459,45 +470,45 @@ class MainWP_Child_Server_Information {
|
|||
<h2><?php esc_html_e( 'Server Information', 'mainwp-child' ); ?></h2>
|
||||
<?php self::render(); ?>
|
||||
<h2><?php esc_html_e( 'Cron Schedules', 'mainwp-child' ); ?></h2>
|
||||
<?php self::renderCron(); ?>
|
||||
<?php self::render_cron(); ?>
|
||||
<h2><?php esc_html_e( 'Error Log', 'mainwp-child' ); ?></h2>
|
||||
<?php self::renderErrorLogPage(); ?>
|
||||
<?php self::render_error_log_page(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function getWarnings() {
|
||||
public static function get_warnings() {
|
||||
$i = 0;
|
||||
if ( ! self::check( '>=', '3.4', 'getWordpressVersion' ) ) {
|
||||
if ( ! self::check( '>=', '3.4', 'get_wordpress_version' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '5.2.4', 'getPHPVersion' ) ) {
|
||||
if ( ! self::check( '>=', '5.2.4', 'get_php_version' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '5.0', 'getMySQLVersion' ) ) {
|
||||
if ( ! self::check( '>=', '5.0', 'get_my_sql_version' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '30', 'getMaxExecutionTime', '=', '0' ) ) {
|
||||
if ( ! self::check( '>=', '30', 'get_max_execution_time', '=', '0' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '2M', 'getUploadMaxFilesize', null, null, true ) ) {
|
||||
if ( ! self::check( '>=', '2M', 'get_upload_max_filesize', null, null, true ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '2M', 'getPostMaxSize', null, null, true ) ) {
|
||||
if ( ! self::check( '>=', '2M', 'get_post_max_size', null, null, true ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::check( '>=', '10000', 'getOutputBufferSize' ) ) {
|
||||
if ( ! self::check( '>=', '10000', 'get_output_buffer_size' ) ) {
|
||||
$i ++;
|
||||
}
|
||||
if ( ! self::checkDirectoryMainWPDirectory( false ) ) {
|
||||
if ( ! self::check_directory_mainwp_directory( false ) ) {
|
||||
$i ++;
|
||||
}
|
||||
|
||||
return $i;
|
||||
}
|
||||
|
||||
protected static function getFileSystemMethod() {
|
||||
protected static function get_file_system_method() {
|
||||
if ( defined( 'MAINWP_SAVE_FS_METHOD' ) ) {
|
||||
return MAINWP_SAVE_FS_METHOD;
|
||||
}
|
||||
|
@ -506,8 +517,8 @@ class MainWP_Child_Server_Information {
|
|||
return $fs;
|
||||
}
|
||||
|
||||
protected static function getFileSystemMethodCheck() {
|
||||
$fsmethod = self::getFileSystemMethod();
|
||||
protected static function get_file_system_method_check() {
|
||||
$fsmethod = self::get_file_system_method();
|
||||
if ( 'direct' === $fsmethod ) {
|
||||
echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>';
|
||||
} else {
|
||||
|
@ -516,7 +527,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
public static function render() {
|
||||
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||
$branding_title = MainWP_Child_Branding::instance()->get_branding_title();
|
||||
$isBranding = true;
|
||||
if ( '' == $branding_title ) {
|
||||
$branding_title = 'MainWP Child';
|
||||
|
@ -542,10 +553,10 @@ class MainWP_Child_Server_Information {
|
|||
<td></td>
|
||||
<td><?php echo esc_html( stripslashes( $branding_title ) ) . ' ' . __( 'Version', 'mainwp-chil' ); ?></td>
|
||||
<td><?php echo esc_html( self::getMainWPVersion() ); ?></td>
|
||||
<td><?php echo esc_html( self::getCurrentVersion() ); ?></td>
|
||||
<td><?php echo esc_html( self::getMainWPVersionCheck() ); ?></td>
|
||||
<td><?php echo esc_html( self::get_current_version() ); ?></td>
|
||||
<td><?php echo esc_html( self::get_mainwp_version_check() ); ?></td>
|
||||
</tr>
|
||||
<?php self::checkDirectoryMainWPDirectory(); ?>
|
||||
<?php self::check_directory_mainwp_directory(); ?>
|
||||
<?php $server = get_option( 'mainwp_child_server' ); ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -557,40 +568,40 @@ class MainWP_Child_Server_Information {
|
|||
<tr>
|
||||
<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' ); ?>
|
||||
<?php self::renderRow( 'WordPress Memory Limit', '>=', '64M', 'getWordpressMemoryLimit' ); ?>
|
||||
<?php self::renderRow( 'MultiSite Disabled', '=', true, 'checkIfMultisite' ); ?>
|
||||
<?php self::render_row( 'WordPress Version', '>=', '3.4', 'get_wordpress_version' ); ?>
|
||||
<?php self::render_row( 'WordPress Memory Limit', '>=', '64M', 'get_wordpress_memory_limit' ); ?>
|
||||
<?php self::render_row( 'MultiSite Disabled', '=', true, 'check_if_multisite' ); ?>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'FileSystem Method', 'mainwp-child' ); ?></td>
|
||||
<td><?php echo esc_html( '= direct' ); ?></td>
|
||||
<td><?php echo esc_html( self::getFileSystemMethod() ); ?></td>
|
||||
<td><?php echo esc_html( self::getFileSystemMethodCheck() ); ?></td>
|
||||
<td><?php echo esc_html( self::get_file_system_method() ); ?></td>
|
||||
<td><?php echo esc_html( self::get_file_system_method_check() ); ?></td>
|
||||
</tr>
|
||||
<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.6', 'getPHPVersion' ); ?>
|
||||
<?php self::render_row( 'PHP Version', '>=', '5.6', 'get_php_version' ); ?>
|
||||
<tr>
|
||||
<td></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::get_php_safe_mode(); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
self::renderRowSec( '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( 'PCRE Backtracking Limit', '>=', '10000', 'getOutputBufferSize' );
|
||||
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( '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' );
|
||||
self::render_row_sec( 'PHP Max Execution Time', '>=', '30', 'get_max_execution_time', 'seconds', '=', '0' );
|
||||
self::render_row_sec( 'PHP Max Input Time', '>=', '30', 'get_max_input_time', 'seconds', '=', '0' );
|
||||
self::render_row( 'PHP Memory Limit', '>=', '128M', 'get_php_memory_limit', '(256M+ best for big backups)', null, null, true );
|
||||
self::render_row( 'PCRE Backtracking Limit', '>=', '10000', 'get_output_buffer_size' );
|
||||
self::render_row( 'PHP Upload Max Filesize', '>=', '2M', 'get_upload_max_filesize', '(2MB+ best for upload of big plugins)', null, null, true );
|
||||
self::render_row( 'PHP Post Max Size', '>=', '2M', 'get_post_max_size', '(2MB+ best for upload of big plugins)', null, null, true );
|
||||
self::render_row( 'SSL Extension Enabled', '=', true, 'get_ssl_support' );
|
||||
self::render_row_sec( 'SSL Warnings', '=', '', 'get_ssl_warning', 'empty', '' );
|
||||
self::render_row_sec( 'cURL Extension Enabled', '=', true, 'get_curl_support', '', '', null, '', null, self::ERROR );
|
||||
self::render_row_sec( 'cURL Timeout', '>=', '300', 'get_curl_timeout', 'seconds', '=', '0' );
|
||||
if ( function_exists( 'curl_version' ) ) {
|
||||
self::renderRowSec( 'cURL Version', '>=', '7.18.1', 'get_curl_version', '', '', null );
|
||||
self::renderRowSec(
|
||||
self::render_row_sec( 'cURL Version', '>=', '7.18.1', 'get_curl_version', '', '', null );
|
||||
self::render_row_sec(
|
||||
'cURL SSL Version',
|
||||
'>=',
|
||||
array(
|
||||
|
@ -609,130 +620,130 @@ class MainWP_Child_Server_Information {
|
|||
<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' ); ?>
|
||||
<?php self::render_row( 'MySQL Version', '>=', '5.0', 'get_my_sql_version' ); ?>
|
||||
<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' ); ?>
|
||||
<?php self::renderRow( 'Tar GZip supported', '=', true, 'getGZipEnabled' ); ?>
|
||||
<?php self::renderRow( 'Tar BZip2 supported', '=', true, 'getBZipEnabled' ); ?>
|
||||
<?php self::render_row( 'ZipArchive enabled in PHP', '=', true, 'get_zip_archive_enabled' ); ?>
|
||||
<?php self::render_row( 'Tar GZip supported', '=', true, 'get_gzip_enabled' ); ?>
|
||||
<?php self::render_row( 'Tar BZip2 supported', '=', true, 'get_bzip_enabled' ); ?>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'SERVER INFORMATION', 'mainwp-child' ); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'WordPress Root Directory', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getWPRoot(); ?></td>
|
||||
<td colspan="3"><?php self::get_wp_root(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Name', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerName(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_name(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Software', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerSoftware(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_software(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Operating System', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getOS(); ?></td>
|
||||
<td colspan="3"><?php self::get_os(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Architecture', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getArchitecture(); ?></td>
|
||||
<td colspan="3"><?php self::get_architecture(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server IP', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerIP(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_ip(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Protocol', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerProtocol(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_protocol(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'HTTP Host', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getHTTPHost(); ?></td>
|
||||
<td colspan="3"><?php self::get_http_host(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'HTTPS', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getHTTPS(); ?></td>
|
||||
<td colspan="3"><?php self::get_https(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server self connect', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::serverSelfConnect(); ?></td>
|
||||
<td colspan="3"><?php self::server_self_connect(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'User Agent', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getUserAgent(); ?></td>
|
||||
<td colspan="3"><?php self::get_user_agent(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Server Port', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerPort(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_port(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Gateway Interface', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerGetawayInterface(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_getaway_interface(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Memory Usage', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::memoryUsage(); ?></td>
|
||||
<td colspan="3"><?php self::memory_usage(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Complete URL', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getCompleteURL(); ?></td>
|
||||
<td colspan="3"><?php self::get_complete_url(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Request Time', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerRequestTime(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_request_time(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Accept Content', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerHTTPAccept(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_http_accept(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Accept-Charset Content', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getServerAcceptCharset(); ?></td>
|
||||
<td colspan="3"><?php self::get_server_accept_charset(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></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::get_script_file_name(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Current Page URI', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getCurrentPageURI(); ?></td>
|
||||
<td colspan="3"><?php self::get_current_page_uri(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Remote Address', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getRemoteAddress(); ?></td>
|
||||
<td colspan="3"><?php self::get_remote_address(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Remote Host', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getRemoteHost(); ?></td>
|
||||
<td colspan="3"><?php self::get_remote_host(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'Remote Port', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getRemotePort(); ?></td>
|
||||
<td colspan="3"><?php self::get_remote_port(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;" colspan="5"><?php esc_html_e( 'PHP INFORMATION', 'mainwp-child' ); ?></td>
|
||||
|
@ -740,22 +751,22 @@ class MainWP_Child_Server_Information {
|
|||
<tr>
|
||||
<td></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::get_php_allow_url_fopen(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP Exif Support', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getPHPExif(); ?></td>
|
||||
<td colspan="3"><?php self::get_php_exif(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP IPTC Support', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getPHPIPTC(); ?></td>
|
||||
<td colspan="3"><?php self::get_php_ip_tc(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'PHP XML Support', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getPHPXML(); ?></td>
|
||||
<td colspan="3"><?php self::get_php_xml(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -765,7 +776,7 @@ class MainWP_Child_Server_Information {
|
|||
<tr>
|
||||
<td></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::get_loaded_php_extensions(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="background: #333; color: #fff;"
|
||||
|
@ -774,7 +785,7 @@ class MainWP_Child_Server_Information {
|
|||
<tr>
|
||||
<td></td>
|
||||
<td><?php esc_html_e( 'MySQL Mode', 'mainwp-child' ); ?></td>
|
||||
<td colspan="3"><?php self::getSQLMode(); ?></td>
|
||||
<td colspan="3"><?php self::get_sql_mode(); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -813,11 +824,11 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
protected static function getCurlSupport() {
|
||||
protected static function get_curl_support() {
|
||||
return function_exists( 'curl_version' );
|
||||
}
|
||||
|
||||
protected static function getCurlTimeout() {
|
||||
protected static function get_curl_timeout() {
|
||||
return ini_get( 'default_socket_timeout' );
|
||||
}
|
||||
|
||||
|
@ -855,19 +866,19 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function getLoadedPHPExtensions() {
|
||||
protected static function get_loaded_php_extensions() {
|
||||
$extensions = get_loaded_extensions();
|
||||
sort( $extensions );
|
||||
echo esc_html( implode( ', ', $extensions ) );
|
||||
}
|
||||
|
||||
protected static function getCurrentVersion() {
|
||||
protected static function get_current_version() {
|
||||
$currentVersion = get_option( 'mainwp_child_plugin_version' );
|
||||
|
||||
return $currentVersion;
|
||||
}
|
||||
|
||||
protected static function getMainwpVersion() {
|
||||
protected static function get_mainwp_version() {
|
||||
include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
|
||||
$api = plugins_api(
|
||||
'plugin_information',
|
||||
|
@ -884,9 +895,9 @@ class MainWP_Child_Server_Information {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected static function getMainWPVersionCheck() {
|
||||
protected static function get_mainwp_version_check() {
|
||||
$current = get_option( 'mainwp_child_plugin_version' );
|
||||
$latest = self::getMainwpVersion();
|
||||
$latest = self::get_mainwp_version();
|
||||
if ( $current === $latest ) {
|
||||
echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>';
|
||||
} else {
|
||||
|
@ -894,7 +905,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
public static function renderCron() {
|
||||
public static function render_cron() {
|
||||
$cron_array = _get_cron_array();
|
||||
$schedules = wp_get_schedules();
|
||||
?>
|
||||
|
@ -927,8 +938,8 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
protected static function checkDirectoryMainWPDirectory( $write = true ) {
|
||||
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||
protected static function check_directory_mainwp_directory( $write = true ) {
|
||||
$branding_title = MainWP_Child_Branding::instance()->get_branding_title();
|
||||
if ( '' == $branding_title ) {
|
||||
$branding_title = 'MainWP';
|
||||
}
|
||||
|
@ -939,12 +950,12 @@ class MainWP_Child_Server_Information {
|
|||
$dirs = MainWP_Helper::get_mainwp_dir( null, false );
|
||||
$path = $dirs[0];
|
||||
} catch ( Exception $e ) {
|
||||
return self::renderDirectoryRow( $branding_title, '', 'Writable', $e->getMessage(), false );
|
||||
return self::render_directory_row( $branding_title, '', 'Writable', $e->getMessage(), false );
|
||||
}
|
||||
|
||||
if ( ! is_dir( dirname( $path ) ) ) {
|
||||
if ( $write ) {
|
||||
return self::renderDirectoryRow( $branding_title, $path, 'Writable', 'Directory not found', false );
|
||||
return self::render_directory_row( $branding_title, $path, 'Writable', 'Directory not found', false );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -957,7 +968,7 @@ class MainWP_Child_Server_Information {
|
|||
if ( $hasWPFileSystem && ! empty( $wp_filesystem ) ) {
|
||||
if ( ! $wp_filesystem->is_writable( $path ) ) {
|
||||
if ( $write ) {
|
||||
return self::renderDirectoryRow( $branding_title, $path, 'Writable', 'Directory not writable', false );
|
||||
return self::render_directory_row( $branding_title, $path, 'Writable', 'Directory not writable', false );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -965,7 +976,7 @@ class MainWP_Child_Server_Information {
|
|||
} else {
|
||||
if ( ! is_writable( $path ) ) {
|
||||
if ( $write ) {
|
||||
return self::renderDirectoryRow( $branding_title, $path, 'Writable', 'Directory not writable', false );
|
||||
return self::render_directory_row( $branding_title, $path, 'Writable', 'Directory not writable', false );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -973,17 +984,17 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
if ( $write ) {
|
||||
return self::renderDirectoryRow( $branding_title, $path, 'Writable', 'Writable', true );
|
||||
return self::render_directory_row( $branding_title, $path, 'Writable', 'Writable', true );
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected static function renderDirectoryRow( $pName, $pDirectory, $pCheck, $pResult, $pPassed ) {
|
||||
protected static function render_directory_row( $pName, $pDirectory, $pCheck, $pResult, $pPassed ) {
|
||||
?>
|
||||
<tr class="mwp-not-generate-row">
|
||||
<td></td>
|
||||
<td><?php echo esc_html( stripslashes( $pName ) ); ?><br/><?php echo esc_html( ( MainWP_Child_Branding::Instance()->is_branding() ) ? '' : $pDirectory ); ?></td>
|
||||
<td><?php echo esc_html( stripslashes( $pName ) ); ?><br/><?php echo esc_html( ( MainWP_Child_Branding::instance()->is_branding() ) ? '' : $pDirectory ); ?></td>
|
||||
<td><?php echo esc_html( $pCheck ); ?></td>
|
||||
<td><?php echo esc_html( $pResult ); ?></td>
|
||||
<td><?php echo ( $pPassed ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>' ); ?></td>
|
||||
|
@ -992,8 +1003,8 @@ class MainWP_Child_Server_Information {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected static function renderRow( $pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) {
|
||||
$currentVersion = call_user_func( array( 'MainWP_Child_Server_Information', $pGetter ) );
|
||||
protected static function render_row( $pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) {
|
||||
$currentVersion = call_user_func( array( MainWP_Child_Server_Information::get_class_name(), $pGetter ) );
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
@ -1006,8 +1017,8 @@ 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 ) );
|
||||
protected static function render_row_sec( $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::get_class_name(), $pGetter ) );
|
||||
?>
|
||||
<tr>
|
||||
<td></td>
|
||||
|
@ -1015,19 +1026,19 @@ class MainWP_Child_Server_Information {
|
|||
<td><?php echo $pCompare; ?><?php echo ( true === $pVersion ? 'true' : ( is_array( $pVersion ) && isset( $pVersion['version'] ) ? $pVersion['version'] : $pVersion ) ) . ' ' . $pExtraText; ?></td>
|
||||
<td><?php echo( true === $currentVersion ? 'true' : $currentVersion ); ?></td>
|
||||
<?php if ( 'filesize' === $whatType ) { ?>
|
||||
<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>
|
||||
<td><?php echo( self::filesize_compare( $currentVersion, $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::get_warning_html( $errorType ) ); ?></td>
|
||||
<?php } elseif ( 'curlssl' === $whatType ) { ?>
|
||||
<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 } elseif ( ( 'getMaxInputTime' === $pGetter || 'getMaxExecutionTime' === $pGetter ) && -1 == $currentVersion ) { ?>
|
||||
<td><?php echo( self::curlssl_compare( $pVersion, $pCompare ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::get_warning_html( $errorType ) ); ?></td>
|
||||
<?php } elseif ( ( 'get_max_input_time' === $pGetter || 'get_max_execution_time' === $pGetter ) && -1 == $currentVersion ) { ?>
|
||||
<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 ) || ( ( null != $pExtraCompare ) && version_compare( $currentVersion, $pExtraVersion, $pExtraCompare ) ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML( $errorType ) ); ?></td>
|
||||
<td><?php echo ( version_compare( $currentVersion, $pVersion, $pCompare ) || ( ( null != $pExtraCompare ) && version_compare( $currentVersion, $pExtraVersion, $pExtraCompare ) ) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::get_warning_html( $errorType ) ); ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
private static function getWarningHTML( $errorType = self::WARNING ) {
|
||||
private static function get_warning_html( $errorType = self::WARNING ) {
|
||||
if ( self::WARNING == $errorType ) {
|
||||
return '<span class="mainwp-warning"><i class="fa fa-exclamation-circle"></i> Warning</span>';
|
||||
}
|
||||
|
@ -1053,7 +1064,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
protected static function check( $pCompare, $pVersion, $pGetter, $pExtraCompare = null, $pExtraVersion = null, $sizeCompare = false ) {
|
||||
$currentVersion = call_user_func( array( 'MainWP_Child_Server_Information', $pGetter ) );
|
||||
$currentVersion = call_user_func( array( MainWP_Child_Server_Information::get_class_name(), $pGetter ) );
|
||||
|
||||
if ( $sizeCompare ) {
|
||||
return self::filesize_compare( $currentVersion, $pVersion, $pCompare );
|
||||
|
@ -1062,39 +1073,39 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function getZipArchiveEnabled() {
|
||||
protected static function get_zip_archive_enabled() {
|
||||
return class_exists( 'ZipArchive' );
|
||||
}
|
||||
|
||||
protected static function getGZipEnabled() {
|
||||
protected static function get_gzip_enabled() {
|
||||
return function_exists( 'gzopen' );
|
||||
}
|
||||
|
||||
protected static function getBZipEnabled() {
|
||||
protected static function get_bzip_enabled() {
|
||||
return function_exists( 'bzopen' );
|
||||
}
|
||||
|
||||
protected static function getWordpressVersion() {
|
||||
protected static function get_wordpress_version() {
|
||||
global $wp_version;
|
||||
|
||||
return $wp_version;
|
||||
}
|
||||
|
||||
protected static function getWordpressMemoryLimit() {
|
||||
protected static function get_wordpress_memory_limit() {
|
||||
return WP_MEMORY_LIMIT;
|
||||
}
|
||||
|
||||
public static function checkIfMultisite() {
|
||||
public static function check_if_multisite() {
|
||||
$isMultisite = ! is_multisite() ? true : false;
|
||||
|
||||
return $isMultisite;
|
||||
}
|
||||
|
||||
protected static function getSSLSupport() {
|
||||
protected static function get_ssl_support() {
|
||||
return extension_loaded( 'openssl' );
|
||||
}
|
||||
|
||||
protected static function getSSLWarning() {
|
||||
protected static function get_ssl_warning() {
|
||||
$conf = array( 'private_key_bits' => 2048 );
|
||||
$str = '';
|
||||
if ( function_exists( 'openssl_pkey_new' ) ) {
|
||||
|
@ -1106,46 +1117,46 @@ class MainWP_Child_Server_Information {
|
|||
return ( stristr( $str, 'NCONF_get_string:no value' ) ? '' : $str );
|
||||
}
|
||||
|
||||
public static function getPHPVersion() {
|
||||
public static function get_php_version() {
|
||||
return phpversion();
|
||||
}
|
||||
|
||||
protected static function getMaxExecutionTime() {
|
||||
protected static function get_max_execution_time() {
|
||||
return ini_get( 'max_execution_time' );
|
||||
}
|
||||
|
||||
protected static function getUploadMaxFilesize() {
|
||||
protected static function get_upload_max_filesize() {
|
||||
return ini_get( 'upload_max_filesize' );
|
||||
}
|
||||
|
||||
protected static function getPostMaxSize() {
|
||||
protected static function get_post_max_size() {
|
||||
return ini_get( 'post_max_size' );
|
||||
}
|
||||
|
||||
public static function getMySQLVersion() {
|
||||
public static function get_my_sql_version() {
|
||||
/** @var $wpdb wpdb */
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_var( "SHOW VARIABLES LIKE 'version'", 1 );
|
||||
}
|
||||
|
||||
protected static function getMaxInputTime() {
|
||||
protected static function get_max_input_time() {
|
||||
return ini_get( 'max_input_time' );
|
||||
}
|
||||
|
||||
public static function getPHPMemoryLimit() {
|
||||
public static function get_php_memory_limit() {
|
||||
return ini_get( 'memory_limit' );
|
||||
}
|
||||
|
||||
protected static function getOS() {
|
||||
protected static function get_os() {
|
||||
echo esc_html( PHP_OS );
|
||||
}
|
||||
|
||||
protected static function getArchitecture() {
|
||||
protected static function get_architecture() {
|
||||
echo esc_html( PHP_INT_SIZE * 8 ) . ' bit';
|
||||
}
|
||||
|
||||
protected static function memoryUsage() {
|
||||
protected static function memory_usage() {
|
||||
if ( function_exists( 'memory_get_usage' ) ) {
|
||||
$memory_usage = round( memory_get_usage() / 1024 / 1024, 2 ) . ' MB';
|
||||
} else {
|
||||
|
@ -1154,11 +1165,11 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $memory_usage );
|
||||
}
|
||||
|
||||
protected static function getOutputBufferSize() {
|
||||
protected static function get_output_buffer_size() {
|
||||
return ini_get( 'pcre.backtrack_limit' );
|
||||
}
|
||||
|
||||
protected static function getPHPSafeMode() {
|
||||
protected static function get_php_safe_mode() {
|
||||
if ( version_compare( phpversion(), '5.3.0' ) < 0 && ini_get( 'safe_mode' ) ) {
|
||||
$safe_mode = __( 'ON', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1167,7 +1178,7 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $safe_mode );
|
||||
}
|
||||
|
||||
protected static function getSQLMode() {
|
||||
protected static function get_sql_mode() {
|
||||
global $wpdb;
|
||||
$mysqlinfo = $wpdb->get_results( "SHOW VARIABLES LIKE 'sql_mode'" );
|
||||
if ( is_array( $mysqlinfo ) ) {
|
||||
|
@ -1179,7 +1190,7 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $sql_mode );
|
||||
}
|
||||
|
||||
protected static function getPHPAllowUrlFopen() {
|
||||
protected static function get_php_allow_url_fopen() {
|
||||
if ( ini_get( 'allow_url_fopen' ) ) {
|
||||
$allow_url_fopen = __( 'ON', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1188,7 +1199,7 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $allow_url_fopen );
|
||||
}
|
||||
|
||||
protected static function getPHPExif() {
|
||||
protected static function get_php_exif() {
|
||||
if ( is_callable( 'exif_read_data' ) ) {
|
||||
$exif = __( 'YES', 'mainwp-child' ) . ' ( V' . substr( phpversion( 'exif' ), 0, 4 ) . ')';
|
||||
} else {
|
||||
|
@ -1197,7 +1208,7 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $exif );
|
||||
}
|
||||
|
||||
protected static function getPHPIPTC() {
|
||||
protected static function get_php_ip_tc() {
|
||||
if ( is_callable( 'iptcparse' ) ) {
|
||||
$iptc = __( 'YES', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1206,7 +1217,7 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $iptc );
|
||||
}
|
||||
|
||||
protected static function getPHPXML() {
|
||||
protected static function get_php_xml() {
|
||||
if ( is_callable( 'xml_parser_create' ) ) {
|
||||
$xml = __( 'YES', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1215,48 +1226,36 @@ class MainWP_Child_Server_Information {
|
|||
echo esc_html( $xml );
|
||||
}
|
||||
|
||||
protected static function getCurrentlyExecutingScript() {
|
||||
echo esc_html( $_SERVER['PHP_SELF'] );
|
||||
}
|
||||
|
||||
protected static function getServerGetawayInterface() {
|
||||
protected static function get_server_getaway_interface() {
|
||||
$gate = isset( $_SERVER['GATEWAY_INTERFACE'] ) ? $_SERVER['GATEWAY_INTERFACE'] : '';
|
||||
echo esc_html( $gate );
|
||||
}
|
||||
|
||||
public static function getServerIP() {
|
||||
public static function get_server_ip() {
|
||||
echo esc_html( $_SERVER['SERVER_ADDR'] );
|
||||
}
|
||||
|
||||
protected static function getServerName() {
|
||||
protected static function get_server_name() {
|
||||
echo esc_html( $_SERVER['SERVER_NAME'] );
|
||||
}
|
||||
|
||||
protected static function getServerSoftware() {
|
||||
protected static function get_server_software() {
|
||||
echo esc_html( $_SERVER['SERVER_SOFTWARE'] );
|
||||
}
|
||||
|
||||
protected static function getServerProtocol() {
|
||||
protected static function get_server_protocol() {
|
||||
echo esc_html( $_SERVER['SERVER_PROTOCOL'] );
|
||||
}
|
||||
|
||||
protected static function getServerRequestMethod() {
|
||||
echo esc_html( $_SERVER['REQUEST_METHOD'] );
|
||||
}
|
||||
|
||||
protected static function getServerRequestTime() {
|
||||
protected static function get_server_request_time() {
|
||||
echo esc_html( $_SERVER['REQUEST_TIME'] );
|
||||
}
|
||||
|
||||
protected static function getServerQueryString() {
|
||||
echo esc_html( $_SERVER['QUERY_STRING'] );
|
||||
}
|
||||
|
||||
protected static function getServerHTTPAccept() {
|
||||
protected static function get_server_http_accept() {
|
||||
echo esc_html( $_SERVER['HTTP_ACCEPT'] );
|
||||
}
|
||||
|
||||
protected static function getServerAcceptCharset() {
|
||||
protected static function get_server_accept_charset() {
|
||||
if ( ! isset( $_SERVER['HTTP_ACCEPT_CHARSET'] ) || ( '' === $_SERVER['HTTP_ACCEPT_CHARSET'] ) ) {
|
||||
esc_html_e( 'N/A', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1264,19 +1263,19 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function getHTTPHost() {
|
||||
protected static function get_http_host() {
|
||||
echo esc_html( $_SERVER['HTTP_HOST'] );
|
||||
}
|
||||
|
||||
protected static function getCompleteURL() {
|
||||
protected static function get_complete_url() {
|
||||
echo isset( $_SERVER['HTTP_REFERER'] ) ? esc_html( $_SERVER['HTTP_REFERER'] ) : '';
|
||||
}
|
||||
|
||||
protected static function getUserAgent() {
|
||||
protected static function get_user_agent() {
|
||||
echo esc_html( $_SERVER['HTTP_USER_AGENT'] );
|
||||
}
|
||||
|
||||
protected static function getHTTPS() {
|
||||
protected static function get_https() {
|
||||
if ( isset( $_SERVER['HTTPS'] ) && '' !== $_SERVER['HTTPS'] ) {
|
||||
echo esc_html( __( 'ON', 'mainwp-child' ) . ' - ' . $_SERVER['HTTPS'] );
|
||||
} else {
|
||||
|
@ -1284,7 +1283,7 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function serverSelfConnect() {
|
||||
protected static function server_self_connect() {
|
||||
$url = site_url( 'wp-cron.php' );
|
||||
$query_args = array( 'mainwp_child_run' => 'test' );
|
||||
$url = add_query_arg( $query_args, $url );
|
||||
|
@ -1315,11 +1314,11 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
|
||||
|
||||
protected static function getRemoteAddress() {
|
||||
protected static function get_remote_address() {
|
||||
echo esc_html( $_SERVER['REMOTE_ADDR'] );
|
||||
}
|
||||
|
||||
protected static function getRemoteHost() {
|
||||
protected static function get_remote_host() {
|
||||
if ( ! isset( $_SERVER['REMOTE_HOST'] ) || ( '' === $_SERVER['REMOTE_HOST'] ) ) {
|
||||
esc_html_e( 'N/A', 'mainwp-child' );
|
||||
} else {
|
||||
|
@ -1327,65 +1326,26 @@ class MainWP_Child_Server_Information {
|
|||
}
|
||||
}
|
||||
|
||||
protected static function getRemotePort() {
|
||||
protected static function get_remote_port() {
|
||||
echo esc_html( $_SERVER['REMOTE_PORT'] );
|
||||
}
|
||||
|
||||
protected static function getScriptFileName() {
|
||||
protected static function get_script_file_name() {
|
||||
echo esc_html( $_SERVER['SCRIPT_FILENAME'] );
|
||||
}
|
||||
|
||||
protected static function getServerAdmin() {
|
||||
echo esc_html( $_SERVER['SERVER_ADMIN'] );
|
||||
}
|
||||
|
||||
protected static function getServerPort() {
|
||||
protected static function get_server_port() {
|
||||
echo esc_html( $_SERVER['SERVER_PORT'] );
|
||||
}
|
||||
|
||||
protected static function getServerSignature() {
|
||||
echo esc_html( $_SERVER['SERVER_SIGNATURE'] );
|
||||
}
|
||||
|
||||
protected static function getServerPathTranslated() {
|
||||
if ( ! isset( $_SERVER['PATH_TRANSLATED'] ) || ( '' === $_SERVER['PATH_TRANSLATED'] ) ) {
|
||||
esc_html_e( 'N/A', 'mainwp-child' );
|
||||
} else {
|
||||
echo esc_html( $_SERVER['PATH_TRANSLATED'] );
|
||||
}
|
||||
}
|
||||
|
||||
protected static function getScriptName() {
|
||||
echo esc_html( $_SERVER['SCRIPT_NAME'] );
|
||||
}
|
||||
|
||||
protected static function getCurrentPageURI() {
|
||||
protected static function get_current_page_uri() {
|
||||
echo esc_html( $_SERVER['REQUEST_URI'] );
|
||||
}
|
||||
|
||||
protected static function getWPRoot() {
|
||||
protected static function get_wp_root() {
|
||||
echo esc_html( ABSPATH );
|
||||
}
|
||||
|
||||
public function formatSizeUnits( $bytes ) {
|
||||
if ( $bytes >= 1073741824 ) {
|
||||
$bytes = number_format( $bytes / 1073741824, 2 ) . ' GB';
|
||||
} elseif ( $bytes >= 1048576 ) {
|
||||
$bytes = number_format( $bytes / 1048576, 2 ) . ' MB';
|
||||
} elseif ( $bytes >= 1024 ) {
|
||||
$bytes = number_format( $bytes / 1024, 2 ) . ' KB';
|
||||
} elseif ( $bytes > 1 ) {
|
||||
$bytes = $bytes . ' bytes';
|
||||
} elseif ( 1 === $bytes ) {
|
||||
$bytes = $bytes . ' byte';
|
||||
} else {
|
||||
$bytes = '0 bytes';
|
||||
}
|
||||
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*Plugin-Name: Error Log Dashboard Widget
|
||||
*Plugin URI: http://wordpress.org/extend/plugins/error-log-dashboard-widget/
|
||||
|
@ -1398,7 +1358,7 @@ class MainWP_Child_Server_Information {
|
|||
*Includes last_lines() function by phant0m, licensed under cc-wiki and GPLv2+
|
||||
*/
|
||||
|
||||
public static function renderErrorLogPage() {
|
||||
public static function render_error_log_page() {
|
||||
?>
|
||||
<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
|
||||
<thead title="Click to Toggle" style="cursor: pointer;">
|
||||
|
@ -1408,13 +1368,13 @@ class MainWP_Child_Server_Information {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody class="list:sites" id="mainwp-error-log-table">
|
||||
<?php self::renderErrorLog(); ?>
|
||||
<?php self::render_error_log(); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
public static function renderErrorLog() {
|
||||
public static function render_error_log() {
|
||||
$log_errors = ini_get( 'log_errors' );
|
||||
if ( ! $log_errors ) {
|
||||
echo '<tr><td colspan="2">' . esc_html__( 'Error logging disabled.', 'mainwp-child' ) . '</td></tr>';
|
||||
|
@ -1435,7 +1395,7 @@ class MainWP_Child_Server_Information {
|
|||
$lines = array_filter( $lines );
|
||||
|
||||
if ( empty( $lines ) ) {
|
||||
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||
$branding_title = MainWP_Child_Branding::instance()->get_branding_title();
|
||||
if ( '' == $branding_title ) {
|
||||
$branding_title = 'MainWP';
|
||||
}
|
||||
|
@ -1531,7 +1491,7 @@ class MainWP_Child_Server_Information {
|
|||
return array_slice( $lines, 0, $line_count );
|
||||
}
|
||||
|
||||
public static function renderWPConfig() {
|
||||
public static function render_wp_config() {
|
||||
?>
|
||||
<div class="postbox" id="mainwp-code-display">
|
||||
<h3 class="hndle" style="padding: 8px 12px; font-size: 14px;"><span>WP-Config.php</span></h3>
|
||||
|
@ -1571,8 +1531,8 @@ class MainWP_Child_Server_Information {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function renderConnectionDetails() {
|
||||
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||
public static function render_connection_details() {
|
||||
$branding_title = MainWP_Child_Branding::instance()->get_branding_title();
|
||||
if ( '' == $branding_title ) {
|
||||
$branding_title = 'MainWP';
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ class MainWP_Child_Skeleton_Key {
|
|||
public static $information = array();
|
||||
public $plugin_translate = 'mainwp-child';
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Skeleton_Key();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class MainWP_Child_Staging {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Staging();
|
||||
}
|
||||
|
@ -105,43 +105,43 @@ class MainWP_Child_Staging {
|
|||
$information = $this->get_scan();
|
||||
break;
|
||||
case 'check_disk_space':
|
||||
$information = $this->ajaxCheckFreeSpace();
|
||||
$information = $this->ajax_check_free_space();
|
||||
break;
|
||||
case 'check_clone':
|
||||
$information = $this->ajaxCheckCloneName();
|
||||
$information = $this->ajax_check_clone_name();
|
||||
break;
|
||||
case 'start_clone':
|
||||
$information = $this->ajaxStartClone();
|
||||
$information = $this->ajax_start_clone();
|
||||
break;
|
||||
case 'clone_database':
|
||||
$information = $this->ajaxCloneDatabase();
|
||||
$information = $this->ajax_clone_database();
|
||||
break;
|
||||
case 'prepare_directories':
|
||||
$information = $this->ajaxPrepareDirectories();
|
||||
$information = $this->ajax_prepare_directories();
|
||||
break;
|
||||
case 'copy_files':
|
||||
$information = $this->ajaxCopyFiles();
|
||||
$information = $this->ajax_copy_files();
|
||||
break;
|
||||
case 'replace_data':
|
||||
$information = $this->ajaxReplaceData();
|
||||
$information = $this->ajax_replace_data();
|
||||
break;
|
||||
case 'clone_finish':
|
||||
$information = $this->ajaxFinish();
|
||||
$information = $this->ajax_finish();
|
||||
break;
|
||||
case 'delete_confirmation':
|
||||
$information = $this->ajaxDeleteConfirmation();
|
||||
$information = $this->ajax_delete_confirmation();
|
||||
break;
|
||||
case 'delete_clone':
|
||||
$information = $this->ajaxDeleteClone();
|
||||
$information = $this->ajax_delete_clone();
|
||||
break;
|
||||
case 'cancel_clone':
|
||||
$information = $this->ajaxCancelClone();
|
||||
$information = $this->ajax_cancel_clone();
|
||||
break;
|
||||
case 'staging_update':
|
||||
$information = $this->ajaxUpdateProcess();
|
||||
$information = $this->ajax_update_process();
|
||||
break;
|
||||
case 'cancel_update':
|
||||
$information = $this->ajaxCancelUpdate();
|
||||
$information = $this->ajax_cancel_update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class MainWP_Child_Staging {
|
|||
}
|
||||
|
||||
|
||||
public function ajaxCheckCloneName() {
|
||||
public function ajax_check_clone_name() {
|
||||
$cloneName = sanitize_key( $_POST['cloneID'] );
|
||||
$cloneNameLength = strlen( $cloneName );
|
||||
$clones = get_option( 'wpstg_existing_clones_beta', array() );
|
||||
|
@ -224,7 +224,7 @@ class MainWP_Child_Staging {
|
|||
return array( 'status' => 'success' );
|
||||
}
|
||||
|
||||
public function ajaxStartClone() {
|
||||
public function ajax_start_clone() {
|
||||
|
||||
$this->url = '';
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
|
@ -239,7 +239,7 @@ class MainWP_Child_Staging {
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function ajaxCloneDatabase() {
|
||||
public function ajax_clone_database() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
|
||||
return $cloning->start();
|
||||
|
@ -248,7 +248,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Ajax Prepare Directories (get listing of files)
|
||||
*/
|
||||
public function ajaxPrepareDirectories() {
|
||||
public function ajax_prepare_directories() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
|
||||
return $cloning->start();
|
||||
|
@ -257,7 +257,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Ajax Clone Files
|
||||
*/
|
||||
public function ajaxCopyFiles() {
|
||||
public function ajax_copy_files() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
|
||||
return $cloning->start();
|
||||
|
@ -266,7 +266,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Ajax Replace Data
|
||||
*/
|
||||
public function ajaxReplaceData() {
|
||||
public function ajax_replace_data() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
return $cloning->start();
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Ajax Finish
|
||||
*/
|
||||
public function ajaxFinish() {
|
||||
public function ajax_finish() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Cloning();
|
||||
$this->url = '';
|
||||
$return = $cloning->start();
|
||||
|
@ -286,7 +286,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Ajax Delete Confirmation
|
||||
*/
|
||||
public function ajaxDeleteConfirmation() {
|
||||
public function ajax_delete_confirmation() {
|
||||
$delete = new WPStaging\Backend\Modules\Jobs\Delete();
|
||||
$delete->setData();
|
||||
$clone = $delete->getClone();
|
||||
|
@ -301,7 +301,7 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Delete clone
|
||||
*/
|
||||
public function ajaxDeleteClone() {
|
||||
public function ajax_delete_clone() {
|
||||
$delete = new WPStaging\Backend\Modules\Jobs\Delete();
|
||||
|
||||
return $delete->start();
|
||||
|
@ -310,19 +310,19 @@ class MainWP_Child_Staging {
|
|||
/**
|
||||
* Delete clone
|
||||
*/
|
||||
public function ajaxCancelClone() {
|
||||
public function ajax_cancel_clone() {
|
||||
$cancel = new WPStaging\Backend\Modules\Jobs\Cancel();
|
||||
|
||||
return $cancel->start();
|
||||
}
|
||||
|
||||
public function ajaxCancelUpdate() {
|
||||
public function ajax_cancel_update() {
|
||||
$cancel = new WPStaging\Backend\Modules\Jobs\CancelUpdate();
|
||||
|
||||
return $cancel->start();
|
||||
}
|
||||
|
||||
public function ajaxUpdateProcess() {
|
||||
public function ajax_update_process() {
|
||||
$cloning = new WPStaging\Backend\Modules\Jobs\Updating();
|
||||
|
||||
if ( ! $cloning->save() ) {
|
||||
|
@ -335,11 +335,11 @@ class MainWP_Child_Staging {
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function ajaxCheckFreeSpace() {
|
||||
return $this->hasFreeDiskSpace();
|
||||
public function ajax_check_free_space() {
|
||||
return $this->has_free_disk_space();
|
||||
}
|
||||
|
||||
public function hasFreeDiskSpace() {
|
||||
public function has_free_disk_space() {
|
||||
if ( ! function_exists( 'disk_free_space' ) ) {
|
||||
return null;
|
||||
}
|
||||
|
@ -347,26 +347,26 @@ class MainWP_Child_Staging {
|
|||
if ( false === $freeSpace ) {
|
||||
$data = array(
|
||||
'freespace' => false,
|
||||
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( ABSPATH ) ),
|
||||
'usedspace' => $this->format_size( $this->get_directory_size_incl_subdirs( ABSPATH ) ),
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
$data = array(
|
||||
'freespace' => $this->formatSize( $freeSpace ),
|
||||
'usedspace' => $this->formatSize( $this->getDirectorySizeInclSubdirs( ABSPATH ) ),
|
||||
'freespace' => $this->format_size( $freeSpace ),
|
||||
'usedspace' => $this->format_size( $this->get_directory_size_incl_subdirs( ABSPATH ) ),
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getDirectorySizeInclSubdirs( $dir ) {
|
||||
public function get_directory_size_incl_subdirs( $dir ) {
|
||||
$size = 0;
|
||||
foreach ( glob( rtrim( $dir, '/' ) . '/*', GLOB_NOSORT ) as $each ) {
|
||||
$size += is_file( $each ) ? filesize( $each ) : $this->getDirectorySizeInclSubdirs( $each );
|
||||
$size += is_file( $each ) ? filesize( $each ) : $this->get_directory_size_incl_subdirs( $each );
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
public function formatSize( $bytes, $precision = 2 ) {
|
||||
public function format_size( $bytes, $precision = 2 ) {
|
||||
if ( (float) $bytes < 1 ) {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class MainWP_Child_Themes_Check {
|
|||
private $tran_name_themes_to_batch = 'mainwp_child_tran_name_themes_to_batch';
|
||||
private $option_name_last_daily_run = 'mainwp_child_theme_last_daily_run';
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Themes_Check();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class MainWP_Child_Timecapsule {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Timecapsule();
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ class MainWP_Child_Timecapsule {
|
|||
MainWP_Helper::check_methods( $options_helper, array( 'get_plan_interval_from_subs_info', 'get_is_user_logged_in' ) );
|
||||
MainWP_Helper::check_methods( $wptc_settings, array( 'get_connected_cloud_info' ) );
|
||||
|
||||
$all_backups = $this->getBackups();
|
||||
$all_backups = $this->get_backups();
|
||||
$backups_count = 0;
|
||||
if ( is_array( $all_backups ) ) {
|
||||
$formatted_backups = array();
|
||||
|
@ -287,7 +287,7 @@ class MainWP_Child_Timecapsule {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected function getBackups( $last_time = false ) {
|
||||
protected function get_backups( $last_time = false ) {
|
||||
if ( empty( $last_time ) ) {
|
||||
$last_time = strtotime( date( 'Y-m-d', strtotime( date( 'Y-m-01' ) ) ) ); // phpcs:ignore -- local time
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ class MainWP_Child_Timecapsule {
|
|||
$last_time = time() - 24 * 7 * 8 * 60 * 60;
|
||||
}
|
||||
|
||||
$all_last_backups = $this->getBackups( $last_time );
|
||||
$all_last_backups = $this->get_backups( $last_time );
|
||||
|
||||
if ( is_array( $all_last_backups ) ) {
|
||||
$formatted_backups = array();
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace MainWP\Child;
|
|||
class MainWP_Child_Updraft_Plus_Backups {
|
||||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Updraft_Plus_Backups();
|
||||
}
|
||||
|
@ -145,10 +145,7 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
break;
|
||||
case 'restore_alldownloaded':
|
||||
$information = $this->restore_alldownloaded();
|
||||
break;
|
||||
case 'restorebackup': // not used!
|
||||
$information = $this->restore_backup();
|
||||
break;
|
||||
break;
|
||||
case 'extradbtestconnection':
|
||||
$information = $this->extradb_testconnection();
|
||||
break;
|
||||
|
@ -1734,391 +1731,6 @@ class MainWP_Child_Updraft_Plus_Backups {
|
|||
}
|
||||
}
|
||||
|
||||
// not used.
|
||||
public function restore_backup() {
|
||||
|
||||
global $updraftplus_admin, $updraftplus;
|
||||
if ( empty( $updraftplus_admin ) ) {
|
||||
require_once UPDRAFTPLUS_DIR . '/admin.php';
|
||||
}
|
||||
ob_start();
|
||||
$backup_success = $this->restore_backup( $_REQUEST['backup_timestamp'] );
|
||||
if ( empty( $updraftplus->errors ) && true === $backup_success ) {
|
||||
// If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them.
|
||||
$this->rebuild_backup_history();
|
||||
echo '<p><strong>';
|
||||
$updraftplus->log_e( 'Restore successful!' );
|
||||
echo '</strong></p>';
|
||||
$updraftplus->log( 'Restore successful' );
|
||||
$s_val = 1;
|
||||
if ( ! empty( $this->entities_to_restore ) && is_array( $this->entities_to_restore ) ) {
|
||||
foreach ( $this->entities_to_restore as $k => $v ) {
|
||||
if ( 'db' !== $v ) {
|
||||
$s_val = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
$pval = ( $updraftplus->have_addons ) ? 1 : 0;
|
||||
|
||||
} elseif ( is_wp_error( $backup_success ) ) {
|
||||
echo '<p>';
|
||||
$updraftplus->log_e( 'Restore failed...' );
|
||||
echo '</p>';
|
||||
$updraftplus->log_wp_error( $backup_success );
|
||||
$updraftplus->log( 'Restore failed' );
|
||||
$updraftplus->list_errors();
|
||||
|
||||
}
|
||||
|
||||
$output = ob_get_clean();
|
||||
|
||||
return array( 'o' => $output );
|
||||
}
|
||||
|
||||
// not used.
|
||||
private function restore_backup( $timestamp ) {
|
||||
|
||||
set_time_limit( 900 );
|
||||
|
||||
global $wp_filesystem, $updraftplus;
|
||||
$backup_history = UpdraftPlus_Backup_History::get_history();
|
||||
if ( ! is_array( $backup_history[ $timestamp ] ) ) {
|
||||
echo wp_kses_post( '<p>' . esc_html__( 'This backup does not exist in the backup history - restoration aborted. Timestamp:', 'updraftplus' ) . " $timestamp</p><br/>" );
|
||||
|
||||
return new WP_Error( 'does_not_exist', __( 'Backup does not exist in the backup history', 'updraftplus' ) );
|
||||
}
|
||||
|
||||
$extra_fields = array();
|
||||
if ( isset( $_POST['updraft_restore'] ) && is_array( $_POST['updraft_restore'] ) ) {
|
||||
foreach ( $_POST['updraft_restore'] as $entity ) {
|
||||
$_POST[ 'updraft_restore_' . $entity ] = 1;
|
||||
$extra_fields[] = 'updraft_restore_' . $entity;
|
||||
}
|
||||
}
|
||||
// Now make sure that updraft_restorer_ option fields get passed along to request_filesystem_credentials.
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
if ( 0 === strpos( $key, 'updraft_restorer_' ) ) {
|
||||
$extra_fields[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
$credentials = request_filesystem_credentials( UpdraftPlus_Options::admin_page() . "?page=updraftplus&action=updraft_restore&backup_timestamp=$timestamp", '', false, false, $extra_fields );
|
||||
WP_Filesystem( $credentials );
|
||||
if ( $wp_filesystem->errors->get_error_code() ) {
|
||||
echo '<p><em><a href="http://updraftplus.com/faqs/asked-ftp-details-upon-restorationmigration-updates/">' . esc_html__( 'Why am I seeing this?', 'updraftplus' ) . '</a></em></p>';
|
||||
foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
|
||||
show_message( $message );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
// Set up logging.
|
||||
$updraftplus->backup_time_nonce();
|
||||
$updraftplus->jobdata_set( 'job_type', 'restore' );
|
||||
$updraftplus->jobdata_set( 'job_time_ms', $updraftplus->job_time_ms );
|
||||
$updraftplus->logfile_open( $updraftplus->nonce );
|
||||
|
||||
echo '<h1>' . esc_html__( 'UpdraftPlus Restoration: Progress', 'updraftplus' ) . '</h1><div id="updraft-restore-progress">';
|
||||
$this->show_admin_warning( '<a href="#" onclick="event.preventDefault(); mainwp_updraft_popuplog(\'' . htmlspecialchars( $updraftplus->nonce ) . '\', this);" >' . __( 'Follow this link to download the log file for this restoration (needed for any support requests).', 'updraftplus' ) . '</a>' );
|
||||
|
||||
$updraft_dir = trailingslashit( $updraftplus->backups_dir_location() );
|
||||
$foreign_known = apply_filters( 'updraftplus_accept_archivename', array() );
|
||||
|
||||
$service = ( isset( $backup_history[ $timestamp ]['service'] ) ) ? $backup_history[ $timestamp ]['service'] : false;
|
||||
if ( ! is_array( $service ) ) {
|
||||
$service = array( $service );
|
||||
}
|
||||
|
||||
if ( empty( $_POST['updraft_restore'] ) || ( ! is_array( $_POST['updraft_restore'] ) ) ) {
|
||||
$_POST['updraft_restore'] = array();
|
||||
}
|
||||
|
||||
$backup_set = $backup_history[ $timestamp ];
|
||||
$entities_to_restore = array();
|
||||
foreach ( $_POST['updraft_restore'] as $entity ) {
|
||||
if ( empty( $backup_set['meta_foreign'] ) ) {
|
||||
$entities_to_restore[ $entity ] = $entity;
|
||||
} else {
|
||||
if ( 'db' === $entity && ! empty( $foreign_known[ $backup_set['meta_foreign'] ] ) && ! empty( $foreign_known[ $backup_set['meta_foreign'] ]['separatedb'] ) ) {
|
||||
$entities_to_restore[ $entity ] = 'db';
|
||||
} else {
|
||||
$entities_to_restore[ $entity ] = 'wpcore';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $_POST as $key => $value ) {
|
||||
if ( 0 === strpos( $key, 'updraft_restore_' ) ) {
|
||||
$nkey = substr( $key, 16 );
|
||||
if ( ! isset( $entities_to_restore[ $nkey ] ) ) {
|
||||
$_POST['updraft_restore'][] = $nkey;
|
||||
if ( empty( $backup_set['meta_foreign'] ) ) {
|
||||
$entities_to_restore[ $nkey ] = $nkey;
|
||||
} else {
|
||||
if ( 'db' === $entity && ! empty( $foreign_known[ $backup_set['meta_foreign'] ]['separatedb'] ) ) {
|
||||
$entities_to_restore[ $nkey ] = 'db';
|
||||
} else {
|
||||
$entities_to_restore[ $nkey ] = 'wpcore';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 === count( $_POST['updraft_restore'] ) ) {
|
||||
echo esc_html( '<p>' . __( 'ABORT: Could not find the information on which entities to restore.', 'updraftplus' ) . '</p>' );
|
||||
echo esc_html( '<p>' . __( 'If making a request for support, please include this information:', 'updraftplus' ) . ' ' . count( $_POST ) . ' : ' . htmlspecialchars( serialize( $_POST ) ) . '</p>' );
|
||||
|
||||
return new WP_Error( 'missing_info', 'Backup information not found' );
|
||||
}
|
||||
|
||||
$updraftplus->log( 'Restore job started. Entities to restore: ' . implode( ', ', array_flip( $entities_to_restore ) ) );
|
||||
|
||||
$this->entities_to_restore = $entities_to_restore;
|
||||
|
||||
set_error_handler( array( $updraftplus, 'php_error' ), E_ALL & ~E_STRICT );
|
||||
|
||||
$backupable_entities = $updraftplus->get_backupable_file_entities( true, true );
|
||||
|
||||
uksort( $backup_set, array( $this, 'sort_restoration_entities' ) );
|
||||
|
||||
require_once UPDRAFTPLUS_DIR . '/restorer.php';
|
||||
|
||||
global $updraftplus_restorer;
|
||||
$updraftplus_restorer = new Updraft_Restorer( new Updraft_Restorer_Skin(), $backup_set );
|
||||
|
||||
$second_loop = array();
|
||||
|
||||
echo wp_kses_post( '<h2>' . esc_html__( 'Final checks', 'updraftplus' ) . '</h2>' );
|
||||
|
||||
if ( empty( $backup_set['meta_foreign'] ) ) {
|
||||
$entities_to_download = $entities_to_restore;
|
||||
} else {
|
||||
if ( ! empty( $foreign_known[ $backup_set['meta_foreign'] ]['separatedb'] ) ) {
|
||||
$entities_to_download = array();
|
||||
if ( in_array( 'db', $entities_to_restore ) ) {
|
||||
$entities_to_download['db'] = 1;
|
||||
}
|
||||
if ( count( $entities_to_restore ) > 1 || ! in_array( 'db', $entities_to_restore ) ) {
|
||||
$entities_to_download['wpcore'] = 1;
|
||||
}
|
||||
} else {
|
||||
$entities_to_download = array( 'wpcore' => 1 );
|
||||
}
|
||||
}
|
||||
|
||||
// First loop: make sure that files are present + readable; and populate array for second loop.
|
||||
foreach ( $backup_set as $type => $files ) {
|
||||
// All restorable entities must be given explicitly, as we can store other arbitrary data in the history array.
|
||||
if ( ! isset( $backupable_entities[ $type ] ) && 'db' !== $type ) {
|
||||
continue;
|
||||
}
|
||||
if ( isset( $backupable_entities[ $type ]['restorable'] ) && false === $backupable_entities[ $type ]['restorable'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! isset( $entities_to_download[ $type ] ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( 'wpcore' === $type && is_multisite() && 0 === $updraftplus_restorer->ud_backup_is_multisite ) {
|
||||
echo wp_kses_post( "<p>$type: <strong>" );
|
||||
esc_html_e( 'Skipping restoration of WordPress core when importing a single site into a multisite installation. If you had anything necessary in your WordPress directory then you will need to re-add it manually from the zip file.', 'updraftplus' );
|
||||
echo '</strong></p>';
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( is_string( $files ) ) {
|
||||
$files = array( $files );
|
||||
}
|
||||
|
||||
foreach ( $files as $ind => $file ) {
|
||||
$fullpath = $updraft_dir . $file;
|
||||
echo sprintf( esc_html__( 'Looking for %1$s archive: file name: %2$s', 'updraftplus' ), esc_html( $type ), esc_html( htmlspecialchars( $file ) ) ) . '<br>';
|
||||
|
||||
add_action( 'http_request_args', array( $updraftplus, 'modify_http_options' ) );
|
||||
foreach ( $service as $serv ) {
|
||||
if ( ! is_readable( $fullpath ) ) {
|
||||
$sd = ( empty( $updraftplus->backup_methods[ $serv ] ) ) ? $serv : $updraftplus->backup_methods[ $serv ];
|
||||
echo esc_html__( 'File is not locally present - needs retrieving from remote storage', 'updraftplus' ) . esc_html( " ( $sd )" );
|
||||
$this->download_file( $file, $serv );
|
||||
echo ': ';
|
||||
if ( ! is_readable( $fullpath ) ) {
|
||||
esc_html_e( 'Error', 'updraftplus' );
|
||||
} else {
|
||||
esc_html_e( 'OK', 'updraftplus' );
|
||||
}
|
||||
echo '<br>';
|
||||
}
|
||||
}
|
||||
remove_action( 'http_request_args', array( $updraftplus, 'modify_http_options' ) );
|
||||
|
||||
$index = ( 0 === $ind ) ? '' : $ind;
|
||||
// If a file size is stored in the backup data, then verify correctness of the local file.
|
||||
if ( isset( $backup_history[ $timestamp ][ $type . $index . '-size' ] ) ) {
|
||||
$fs = $backup_history[ $timestamp ][ $type . $index . '-size' ];
|
||||
echo esc_html__( 'Archive is expected to be size:', 'updraftplus' ) . ' ' . esc_html( round( $fs / 1024, 1 ) ) . ' Kb: ';
|
||||
$as = filesize( $fullpath );
|
||||
if ( $as === $fs ) {
|
||||
echo esc_html__( 'OK', 'updraftplus' ) . '<br>';
|
||||
} else {
|
||||
echo '<strong>' . esc_html__( 'Error:', 'updraftplus' ) . '</strong> ' . esc_html__( 'file is size:', 'updraftplus' ) . ' ' . esc_html( round( $as / 1024 ) ) . esc_html( " ( $fs, $as )" ) . '<br>';
|
||||
}
|
||||
} else {
|
||||
echo esc_html__( 'The backup records do not contain information about the proper size of this file.', 'updraftplus' ) . '<br>';
|
||||
}
|
||||
if ( ! is_readable( $fullpath ) ) {
|
||||
echo esc_html__( 'Could not find one of the files for restoration', 'updraftplus' ) . esc_html( " ( $file )" ) . '<br>';
|
||||
$updraftplus->log( "$file: " . __( 'Could not find one of the files for restoration', 'updraftplus' ), 'error' );
|
||||
echo '</div>';
|
||||
restore_error_handler();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $updraftplus_restorer->ud_foreign ) ) {
|
||||
$types = array( $type );
|
||||
} else {
|
||||
if ( 'db' !== $type || empty( $foreign_known[ $updraftplus_restorer->ud_foreign ]['separatedb'] ) ) {
|
||||
$types = array( 'wpcore' );
|
||||
} else {
|
||||
$types = array( 'db' );
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $types as $check_type ) {
|
||||
$info = ( isset( $backupable_entities[ $check_type ] ) ) ? $backupable_entities[ $check_type ] : array();
|
||||
$val = $updraftplus_restorer->pre_restore_backup( $files, $check_type, $info );
|
||||
if ( is_wp_error( $val ) ) {
|
||||
$updraftplus->log_wp_error( $val );
|
||||
foreach ( $val->get_error_messages() as $msg ) {
|
||||
echo '<strong>' . esc_html__( 'Error:', 'updraftplus' ) . '</strong> ' . esc_html( htmlspecialchars( $msg ) ) . '<br>';
|
||||
}
|
||||
foreach ( $val->get_error_codes() as $code ) {
|
||||
if ( 'already_exists' === $code ) {
|
||||
$this->print_delete_old_dirs_form();
|
||||
}
|
||||
}
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error.
|
||||
restore_error_handler();
|
||||
|
||||
return $val;
|
||||
} elseif ( false === $val ) {
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error.
|
||||
restore_error_handler();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $entities_to_restore as $entity => $via ) {
|
||||
if ( $via === $type ) {
|
||||
$second_loop[ $entity ] = $files;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$updraftplus_restorer->delete = ( UpdraftPlus_Options::get_updraft_option( 'updraft_delete_local' ) ) ? true : false;
|
||||
if ( 'none' === $service || 'email' === $service || empty( $service ) || ( is_array( $service ) && 1 === count( $service ) && ( in_array( 'none', $service ) || in_array( '', $service ) || in_array( 'email', $service ) ) ) || ! empty( $updraftplus_restorer->ud_foreign ) ) {
|
||||
if ( $updraftplus_restorer->delete ) {
|
||||
$updraftplus->log_e( 'Will not delete any archives after unpacking them, because there was no cloud storage for this backup' );
|
||||
}
|
||||
$updraftplus_restorer->delete = false;
|
||||
}
|
||||
|
||||
if ( ! empty( $updraftplus_restorer->ud_foreign ) ) {
|
||||
$updraftplus->log( 'Foreign backup; created by: ' . $updraftplus_restorer->ud_foreign );
|
||||
}
|
||||
|
||||
// Second loop: now actually do the restoration.
|
||||
uksort( $second_loop, array( $this, 'sort_restoration_entities' ) );
|
||||
foreach ( $second_loop as $type => $files ) {
|
||||
// Types: uploads, themes, plugins, others, db.
|
||||
$info = ( isset( $backupable_entities[ $type ] ) ) ? $backupable_entities[ $type ] : array();
|
||||
|
||||
echo ( 'db' === $type ) ? '<h2>' . esc_html__( 'Database', 'updraftplus' ) . '</h2>' : '<h2>' . esc_html( $info['description'] ) . '</h2>';
|
||||
$updraftplus->log( 'Entity: ' . $type );
|
||||
|
||||
if ( is_string( $files ) ) {
|
||||
$files = array( $files );
|
||||
}
|
||||
foreach ( $files as $fkey => $file ) {
|
||||
$last_one = ( 1 === count( $second_loop ) && 1 === count( $files ) );
|
||||
|
||||
$val = $updraftplus_restorer->restore_backup( $file, $type, $info, $last_one );
|
||||
|
||||
if ( is_wp_error( $val ) ) {
|
||||
$updraftplus->log_e( $val );
|
||||
foreach ( $val->get_error_messages() as $msg ) {
|
||||
echo '<strong>' . esc_html__( 'Error message', 'updraftplus' ) . ':</strong> ' . esc_html( htmlspecialchars( $msg ) ) . '<br>';
|
||||
}
|
||||
$codes = $val->get_error_codes();
|
||||
if ( is_array( $codes ) ) {
|
||||
foreach ( $codes as $code ) {
|
||||
$data = $val->get_error_data( $code );
|
||||
if ( ! empty( $data ) ) {
|
||||
$pdata = ( is_string( $data ) ) ? $data : serialize( $data );
|
||||
echo '<strong>' . esc_html__( 'Error data:', 'updraftplus' ) . '</strong> ' . esc_html( htmlspecialchars( $pdata ) ) . '<br>';
|
||||
if ( false !== strpos( $pdata, 'PCLZIP_ERR_BAD_FORMAT (-10)' ) ) {
|
||||
echo '<a href="http://updraftplus.com/faqs/error-message-pclzip_err_bad_format-10-invalid-archive-structure-mean/"><strong>' . esc_html__( 'Please consult this FAQ for help on what to do about it.', 'updraftplus' ) . '</strong></a><br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error.
|
||||
restore_error_handler();
|
||||
|
||||
return $val;
|
||||
} elseif ( false === $val ) {
|
||||
echo '</div>'; // close the updraft_restore_progress div even if we error.
|
||||
restore_error_handler();
|
||||
|
||||
return false;
|
||||
}
|
||||
unset( $files[ $fkey ] );
|
||||
}
|
||||
unset( $second_loop[ $type ] );
|
||||
}
|
||||
|
||||
foreach ( array( 'template', 'stylesheet', 'template_root', 'stylesheet_root' ) as $opt ) {
|
||||
add_filter( 'pre_option_' . $opt, array( $this, 'option_filter_' . $opt ) );
|
||||
}
|
||||
|
||||
// Clear any cached pages after the restore.
|
||||
$updraftplus_restorer->clear_cache();
|
||||
|
||||
if ( ! function_exists( 'validate_current_theme' ) ) {
|
||||
require_once ABSPATH . WPINC . '/themes';
|
||||
}
|
||||
|
||||
// Have seen a case where the current theme in the DB began with a capital, but not on disk - and this breaks migrating from Windows to a case-sensitive system.
|
||||
$template = get_option( 'template' );
|
||||
echo esc_html( $template );
|
||||
if ( ! empty( $template ) && WP_DEFAULT_THEME !== $template && strtolower( $template ) !== $template ) {
|
||||
|
||||
$theme_root = get_theme_root( $template );
|
||||
$theme_root2 = get_theme_root( strtolower( $template ) );
|
||||
|
||||
if ( ! file_exists( "$theme_root/$template/style.css" ) && file_exists( "$theme_root/" . strtolower( $template ) . '/style.css' ) ) {
|
||||
$updraftplus->log_e( 'Theme directory (%s) not found, but lower-case version exists; updating database option accordingly', $template );
|
||||
update_option( 'template', strtolower( $template ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! validate_current_theme() ) {
|
||||
global $updraftplus;
|
||||
echo '<strong>';
|
||||
$updraftplus->log_e( 'The current theme was not found; to prevent this stopping the site from loading, your theme has been reverted to the default theme' );
|
||||
echo '</strong>';
|
||||
}
|
||||
|
||||
echo '</div>'; // close the updraft_restore_progress div.
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function option_filter_template( $val ) {
|
||||
global $updraftplus;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ class MainWP_Child_Vulnerability_Checker {
|
|||
private $wpvulndb_api = 'https://wpvulndb.com/api/v3/';
|
||||
private $wpvulndb_token = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Vulnerability_Checker();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace MainWP\Child;
|
|||
class MainWP_Child_WooCommerce_Status {
|
||||
public static $instance = null;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_WooCommerce_Status();
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ class MainWP_Child_Wordfence {
|
|||
'learningModeGracePeriod',
|
||||
);
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_Wordfence();
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ class MainWP_Child_Wordfence {
|
|||
$information = $this->request_scan();
|
||||
break;
|
||||
case 'killScan':
|
||||
$information = $this->kill_scan();
|
||||
$information = $this->kill_ajax_scan();
|
||||
break;
|
||||
case 'set_showhide':
|
||||
$information = $this->set_showhide();
|
||||
|
@ -261,7 +261,7 @@ class MainWP_Child_Wordfence {
|
|||
$information = $this->bulk_operation();
|
||||
break;
|
||||
case 'bulkOperation':
|
||||
$information = $this->bulk_operation();
|
||||
$information = $this->bulk_ajax_operation(); // new version.
|
||||
break;
|
||||
case 'delete_file':
|
||||
$information = $this->delete_file();
|
||||
|
@ -626,7 +626,7 @@ class MainWP_Child_Wordfence {
|
|||
return wordfence::ajax_scan_callback();
|
||||
}
|
||||
|
||||
private function kill_scan() {
|
||||
private function kill_ajax_scan() {
|
||||
return wordfence::ajax_killScan_callback();
|
||||
}
|
||||
|
||||
|
@ -807,10 +807,10 @@ class MainWP_Child_Wordfence {
|
|||
'lastScanCompleted' => wfConfig::get( 'lastScanCompleted' ),
|
||||
'apiKey' => wfConfig::get( 'apiKey' ),
|
||||
'isPaid' => wfConfig::get( 'isPaid' ),
|
||||
'lastscan_timestamp' => self::Instance()->get_lastscan(),
|
||||
'todayAttBlocked' => self::Instance()->count_attacks_blocked( 1 ),
|
||||
'weekAttBlocked' => self::Instance()->count_attacks_blocked( 7 ),
|
||||
'monthAttBlocked' => self::Instance()->count_attacks_blocked( 30 ),
|
||||
'lastscan_timestamp' => self::instance()->get_lastscan(),
|
||||
'todayAttBlocked' => self::instance()->count_attacks_blocked( 1 ),
|
||||
'weekAttBlocked' => self::instance()->count_attacks_blocked( 7 ),
|
||||
'monthAttBlocked' => self::instance()->count_attacks_blocked( 30 ),
|
||||
'issueCount' => $i->getIssueCount(),
|
||||
);
|
||||
return $return;
|
||||
|
@ -996,7 +996,7 @@ SQL
|
|||
}
|
||||
}
|
||||
|
||||
public function bulk_operation() {
|
||||
public function bulk_ajax_operation() {
|
||||
return wordfence::ajax_bulkOperation_callback();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class MainWP_Child_WP_Rocket {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_WP_Rocket();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class MainWP_Child_WP_Rocket {
|
|||
return $value;
|
||||
}
|
||||
|
||||
public function isActivated() {
|
||||
public function is_activated() {
|
||||
if ( ! $this->is_plugin_installed ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class MainWP_Child_WPvivid_BackupRestore {
|
|||
public static $instance = null;
|
||||
public $is_plugin_installed = false;
|
||||
public $public_intetface;
|
||||
static function Instance() {
|
||||
static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Child_WPvivid_BackupRestore();
|
||||
}
|
||||
|
|
|
@ -145,14 +145,14 @@ class MainWP_Child {
|
|||
|
||||
MainWP_Clone::get()->init();
|
||||
MainWP_Child_Server_Information::init();
|
||||
MainWP_Client_Report::Instance()->init();
|
||||
MainWP_Child_Plugins_Check::Instance();
|
||||
MainWP_Child_Themes_Check::Instance();
|
||||
MainWP_Client_Report::instance()->init();
|
||||
MainWP_Child_Plugins_Check::instance();
|
||||
MainWP_Child_Themes_Check::instance();
|
||||
|
||||
$this->run_saved_snippets();
|
||||
|
||||
if ( ! get_option( 'mainwp_child_pubkey' ) ) {
|
||||
MainWP_Child_Branding::Instance()->save_branding_options( 'branding_disconnected', 'yes' );
|
||||
MainWP_Child_Branding::instance()->save_branding_options( 'branding_disconnected', 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' );
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ class MainWP_Child {
|
|||
public function admin_notice() {
|
||||
// Admin Notice...
|
||||
if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::is_admin() && is_admin() ) {
|
||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
$child_name = ( '' === $branding_opts['branding_preserve_title'] ) ? 'MainWP Child' : $branding_opts['branding_preserve_title'];
|
||||
$dashboard_name = ( '' === $branding_opts['branding_preserve_title'] ) ? 'MainWP Dashboard' : $branding_opts['branding_preserve_title'] . ' Dashboard';
|
||||
|
||||
|
@ -418,7 +418,7 @@ class MainWP_Child {
|
|||
$msg .= '<p style="font-size: 16px;">';
|
||||
$msg .= __( 'If you are not sure how to add this site to your Dashboard, <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/add-site-to-your-dashboard/" target="_blank">please review these instructions</a>.', 'mainwp-child' );
|
||||
$msg .= '</p>';
|
||||
if ( ! MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||
if ( ! MainWP_Child_Branding::instance()->is_branding() ) {
|
||||
$msg .= '<p>';
|
||||
$msg .= __( 'You can also turn on the unique security ID option in <a href="admin.php?page=mainwp_child_tab">', 'mainwp-child' ) . $child_name . __( ' settings</a> if you would like extra security and additional time to add this site to your Dashboard. <br/>Find out more in this help document <a href="https://mainwp.com/help/docs/set-up-the-mainwp-plugin/set-unique-security-id/" target="_blank">How do I use the child unique security ID?</a>', 'mainwp-child' );
|
||||
$msg .= '</p>';
|
||||
|
@ -426,7 +426,7 @@ class MainWP_Child {
|
|||
$msg .= '</div></div></div>';
|
||||
echo wp_kses_post( $msg );
|
||||
}
|
||||
MainWP_Child_Server_Information::showWarnings();
|
||||
MainWP_Child_Server_Information::show_warnings();
|
||||
}
|
||||
|
||||
public function localization() {
|
||||
|
@ -525,7 +525,7 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
public function admin_menu() {
|
||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
$is_hide = isset( $branding_opts['hide'] ) ? $branding_opts['hide'] : '';
|
||||
$cancelled_branding = $branding_opts['cancelled_branding'];
|
||||
|
||||
|
@ -632,7 +632,7 @@ class MainWP_Child {
|
|||
if ( isset( $_GET['tab'] ) ) {
|
||||
$shownPage = $_GET['tab'];
|
||||
}
|
||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
|
||||
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
||||
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
||||
|
@ -669,13 +669,13 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
if ( isset( $_SESSION['file'] ) ) {
|
||||
MainWP_Clone::renderRestore();
|
||||
MainWP_Clone::render_restore();
|
||||
} else {
|
||||
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
||||
if ( 0 !== (int) $sitesToClone ) {
|
||||
MainWP_Clone::render();
|
||||
} else {
|
||||
MainWP_Clone::renderNormalRestore();
|
||||
MainWP_Clone::render_normal_restore();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -684,13 +684,13 @@ class MainWP_Child {
|
|||
|
||||
<?php if ( ! $hide_server_info ) { ?>
|
||||
<div class="mainwp-child-setting-tab server-info" <?php echo ( 'server-info' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||
<?php MainWP_Child_Server_Information::renderPage(); ?>
|
||||
<?php MainWP_Child_Server_Information::render_page(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( ! $hide_connection_detail ) { ?>
|
||||
<div class="mainwp-child-setting-tab connection-detail" <?php echo ( 'connection-detail' !== $shownPage ) ? $hide_style : ''; ?>>
|
||||
<?php MainWP_Child_Server_Information::renderConnectionDetails(); ?>
|
||||
<?php MainWP_Child_Server_Information::render_connection_details(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
@ -709,7 +709,7 @@ class MainWP_Child {
|
|||
$shownPage = 'settings';
|
||||
}
|
||||
|
||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
|
||||
$hide_settings = isset( $branding_opts['remove_setting'] ) && $branding_opts['remove_setting'] ? true : false;
|
||||
$hide_restore = isset( $branding_opts['remove_restore'] ) && $branding_opts['remove_restore'] ? true : false;
|
||||
|
@ -1141,7 +1141,7 @@ class MainWP_Child {
|
|||
$method = 'zip';
|
||||
}
|
||||
|
||||
$res = MainWP_Backup::get()->createFullBackup( $newExcludes, ( isset( $_POST['f'] ) ? $_POST['f'] : $_POST['file'] ), true, $includeCoreFiles, 0, false, false, false, false, $method );
|
||||
$res = MainWP_Backup::get()->create_full_backup( $newExcludes, ( isset( $_POST['f'] ) ? $_POST['f'] : $_POST['file'] ), true, $includeCoreFiles, 0, false, false, false, false, $method );
|
||||
if ( ! $res ) {
|
||||
$information['backup'] = false;
|
||||
} else {
|
||||
|
@ -1315,7 +1315,7 @@ class MainWP_Child {
|
|||
/**
|
||||
* Security
|
||||
*/
|
||||
MainWP_Security::fixAll();
|
||||
MainWP_Security::fix_all();
|
||||
MainWP_Debug::process( $this );
|
||||
|
||||
// Register does not require auth, so we register here.
|
||||
|
@ -1388,20 +1388,20 @@ class MainWP_Child {
|
|||
|
||||
// Init extensions.
|
||||
// Handle fatal errors for those init if needed.
|
||||
MainWP_Child_IThemes_Security::Instance()->ithemes_init();
|
||||
MainWP_Child_Updraft_Plus_Backups::Instance()->updraftplus_init();
|
||||
MainWP_Child_Back_Up_Wordpress::Instance()->init();
|
||||
MainWP_Child_WP_Rocket::Instance()->init();
|
||||
MainWP_Child_Back_WP_Up::Instance()->init();
|
||||
MainWP_Child_Back_Up_Buddy::Instance();
|
||||
MainWP_Child_Wordfence::Instance()->wordfence_init();
|
||||
MainWP_Child_Timecapsule::Instance()->init();
|
||||
MainWP_Child_Staging::Instance()->init();
|
||||
MainWP_Child_Branding::Instance()->branding_init();
|
||||
MainWP_Client_Report::Instance()->creport_init();
|
||||
MainWP_Child_Pagespeed::Instance()->init();
|
||||
MainWP_Child_Links_Checker::Instance()->init();
|
||||
MainWP_Child_WPvivid_BackupRestore::Instance()->init();
|
||||
MainWP_Child_IThemes_Security::instance()->ithemes_init();
|
||||
MainWP_Child_Updraft_Plus_Backups::instance()->updraftplus_init();
|
||||
MainWP_Child_Back_Up_Wordpress::instance()->init();
|
||||
MainWP_Child_WP_Rocket::instance()->init();
|
||||
MainWP_Child_Back_WP_Up::instance()->init();
|
||||
MainWP_Child_Back_Up_Buddy::instance();
|
||||
MainWP_Child_Wordfence::instance()->wordfence_init();
|
||||
MainWP_Child_Timecapsule::instance()->init();
|
||||
MainWP_Child_Staging::instance()->init();
|
||||
MainWP_Child_Branding::instance()->branding_init();
|
||||
MainWP_Client_Report::instance()->creport_init();
|
||||
MainWP_Child_Pagespeed::instance()->init();
|
||||
MainWP_Child_Links_Checker::instance()->init();
|
||||
MainWP_Child_WPvivid_BackupRestore::instance()->init();
|
||||
|
||||
global $_wp_submenu_nopriv;
|
||||
if ( null === $_wp_submenu_nopriv ) {
|
||||
|
@ -1426,10 +1426,10 @@ class MainWP_Child {
|
|||
if ( 1 === (int) get_option( 'mainwpKeywordLinks' ) ) {
|
||||
new MainWP_Keyword_Links();
|
||||
if ( ! is_admin() ) {
|
||||
add_filter( 'the_content', array( MainWP_Keyword_Links::Instance(), 'filter_content' ), 100 );
|
||||
add_filter( 'the_content', array( MainWP_Keyword_Links::instance(), 'filter_content' ), 100 );
|
||||
}
|
||||
MainWP_Keyword_Links::Instance()->update_htaccess();
|
||||
MainWP_Keyword_Links::Instance()->redirect_cloak();
|
||||
MainWP_Keyword_Links::instance()->update_htaccess();
|
||||
MainWP_Keyword_Links::instance()->redirect_cloak();
|
||||
} elseif ( 'yes' === get_option( 'mainwp_keyword_links_htaccess_set' ) ) {
|
||||
MainWP_Keyword_Links::clear_htaccess();
|
||||
}
|
||||
|
@ -2214,7 +2214,7 @@ class MainWP_Child {
|
|||
// Already added - can't readd. Deactivate plugin.
|
||||
if ( get_option( 'mainwp_child_pubkey' ) ) {
|
||||
// set disconnect status to yes here, it will empty after reconnected.
|
||||
MainWP_Child_Branding::Instance()->save_branding_options( 'branding_disconnected', 'yes' );
|
||||
MainWP_Child_Branding::instance()->save_branding_options( 'branding_disconnected', 'yes' );
|
||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', 'yes', 'yes' );
|
||||
MainWP_Helper::error( __( 'Public key already set. Please deactivate & reactivate the MainWP Child plugin and try again.', 'mainwp-child' ) );
|
||||
|
||||
|
@ -3123,7 +3123,7 @@ class MainWP_Child {
|
|||
|
||||
$append = ( isset( $_POST['append'] ) && ( '1' == $_POST['append'] ) );
|
||||
|
||||
$res = MainWP_Backup::get()->createFullBackup( $newExcludes, $fileName, true, true, $file_descriptors, $file, $excludezip, $excludenonwp, $loadFilesBeforeZip, $ext, $pid, $append );
|
||||
$res = MainWP_Backup::get()->create_full_backup( $newExcludes, $fileName, true, true, $file_descriptors, $file, $excludezip, $excludenonwp, $loadFilesBeforeZip, $ext, $pid, $append );
|
||||
if ( ! $res ) {
|
||||
$information['full'] = false;
|
||||
} else {
|
||||
|
@ -3179,7 +3179,7 @@ class MainWP_Child {
|
|||
closedir( $dh );
|
||||
}
|
||||
|
||||
$result = MainWP_Backup::get()->createBackupDB( $filepath_prefix, $ext );
|
||||
$result = MainWP_Backup::get()->create_backup_db( $filepath_prefix, $ext );
|
||||
|
||||
MainWP_Helper::update_option( 'mainwp_child_last_db_backup_size', filesize( $result['filepath'] ) );
|
||||
|
||||
|
@ -3378,7 +3378,7 @@ class MainWP_Child {
|
|||
$this->update_external_settings();
|
||||
}
|
||||
|
||||
MainWP_Child_Branding::Instance()->save_branding_options( 'branding_disconnected', '' );
|
||||
MainWP_Child_Branding::instance()->save_branding_options( 'branding_disconnected', '' );
|
||||
MainWP_Helper::update_option( 'mainwp_child_branding_disconnected', '', 'yes' );
|
||||
if ( isset( $_POST['server'] ) ) {
|
||||
MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] );
|
||||
|
@ -3389,8 +3389,8 @@ class MainWP_Child {
|
|||
if ( $days_outdate != $_POST['numberdaysOutdatePluginTheme'] ) {
|
||||
$days_outdate = intval( $_POST['numberdaysOutdatePluginTheme'] );
|
||||
MainWP_Helper::update_option( 'mainwp_child_plugintheme_days_outdate', $days_outdate );
|
||||
MainWP_Child_Plugins_Check::Instance()->cleanup_deactivation( false );
|
||||
MainWP_Child_Themes_Check::Instance()->cleanup_deactivation( false );
|
||||
MainWP_Child_Plugins_Check::instance()->cleanup_deactivation( false );
|
||||
MainWP_Child_Themes_Check::instance()->cleanup_deactivation( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3404,8 +3404,8 @@ class MainWP_Child {
|
|||
'debug_mode' => ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) ? true : false,
|
||||
'phpversion' => phpversion(),
|
||||
'child_version' => self::$version,
|
||||
'memory_limit' => MainWP_Child_Server_Information::getPHPMemoryLimit(),
|
||||
'mysql_version' => MainWP_Child_Server_Information::getMySQLVersion(),
|
||||
'memory_limit' => MainWP_Child_Server_Information::get_php_memory_limit(),
|
||||
'mysql_version' => MainWP_Child_Server_Information::get_my_sql_version(),
|
||||
'themeactivated' => $theme_name,
|
||||
'ip' => $_SERVER['SERVER_ADDR'],
|
||||
);
|
||||
|
@ -3742,8 +3742,8 @@ class MainWP_Child {
|
|||
}
|
||||
$information['mainwpdir'] = ( MainWP_Helper::validate_mainwp_dir() ? 1 : - 1 );
|
||||
$information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' );
|
||||
$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();
|
||||
$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();
|
||||
|
||||
if ( isset( $_POST['user'] ) ) {
|
||||
$user = get_user_by( 'login', $_POST['user'] );
|
||||
|
@ -4061,8 +4061,8 @@ class MainWP_Child {
|
|||
$outPost['seo_data'] = array(
|
||||
'count_seo_links' => $link_count->get( $post_id, 'internal_link_count' ),
|
||||
'count_seo_linked' => $link_count->get( $post_id, 'incoming_link_count' ),
|
||||
'seo_score' => MainWP_Wordpress_SEO::Instance()->parse_column_score( $post_id ),
|
||||
'readability_score' => MainWP_Wordpress_SEO::Instance()->parse_column_score_readability( $post_id ),
|
||||
'seo_score' => MainWP_Wordpress_SEO::instance()->parse_column_score( $post_id ),
|
||||
'readability_score' => MainWP_Wordpress_SEO::instance()->parse_column_score_readability( $post_id ),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -4956,15 +4956,15 @@ class MainWP_Child {
|
|||
$output['information'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
MainWP_Child_Server_Information::renderCron();
|
||||
MainWP_Child_Server_Information::render_cron();
|
||||
$output['cron'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
MainWP_Child_Server_Information::renderErrorLogPage();
|
||||
MainWP_Child_Server_Information::render_error_log_page();
|
||||
$output['error'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
MainWP_Child_Server_Information::renderWPConfig();
|
||||
MainWP_Child_Server_Information::render_wp_config();
|
||||
$output['wpconfig'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
ob_start();
|
||||
|
@ -5196,11 +5196,11 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
public function keyword_links_action() {
|
||||
MainWP_Keyword_Links::Instance()->action();
|
||||
MainWP_Keyword_Links::instance()->action();
|
||||
}
|
||||
|
||||
public function branding_child_plugin() {
|
||||
MainWP_Child_Branding::Instance()->action();
|
||||
MainWP_Child_Branding::instance()->action();
|
||||
}
|
||||
|
||||
public function code_snippet() {
|
||||
|
@ -5354,40 +5354,40 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
public function wordpress_seo() {
|
||||
MainWP_Wordpress_SEO::Instance()->action();
|
||||
MainWP_Wordpress_SEO::instance()->action();
|
||||
}
|
||||
|
||||
public function client_report() {
|
||||
MainWP_Client_Report::Instance()->action();
|
||||
MainWP_Client_Report::instance()->action();
|
||||
}
|
||||
|
||||
public function page_speed() {
|
||||
MainWP_Child_Pagespeed::Instance()->action();
|
||||
MainWP_Child_Pagespeed::instance()->action();
|
||||
}
|
||||
|
||||
public function woo_com_status() {
|
||||
MainWP_Child_WooCommerce_Status::Instance()->action();
|
||||
MainWP_Child_WooCommerce_Status::instance()->action();
|
||||
}
|
||||
|
||||
public function links_checker() {
|
||||
MainWP_Child_Links_Checker::Instance()->action();
|
||||
MainWP_Child_Links_Checker::instance()->action();
|
||||
}
|
||||
|
||||
public function wordfence() {
|
||||
MainWP_Child_Wordfence::Instance()->action();
|
||||
MainWP_Child_Wordfence::instance()->action();
|
||||
}
|
||||
|
||||
public function ithemes() {
|
||||
MainWP_Child_IThemes_Security::Instance()->action();
|
||||
MainWP_Child_IThemes_Security::instance()->action();
|
||||
}
|
||||
|
||||
|
||||
public function updraftplus() {
|
||||
MainWP_Child_Updraft_Plus_Backups::Instance()->action();
|
||||
MainWP_Child_Updraft_Plus_Backups::instance()->action();
|
||||
}
|
||||
|
||||
public function wpvivid_backuprestore() {
|
||||
MainWP_Child_WPvivid_BackupRestore::Instance()->action();
|
||||
MainWP_Child_WPvivid_BackupRestore::instance()->action();
|
||||
}
|
||||
|
||||
public function backup_wp() {
|
||||
|
@ -5395,15 +5395,15 @@ class MainWP_Child {
|
|||
$error = sprintf( __( 'PHP Version %s is unsupported.', 'mainwp-child' ), phpversion() );
|
||||
MainWP_Helper::write( array( 'error' => $error ) );
|
||||
}
|
||||
MainWP_Child_Back_Up_Wordpress::Instance()->action();
|
||||
MainWP_Child_Back_Up_Wordpress::instance()->action();
|
||||
}
|
||||
|
||||
public function wp_rocket() {
|
||||
MainWP_Child_WP_Rocket::Instance()->action();
|
||||
MainWP_Child_WP_Rocket::instance()->action();
|
||||
}
|
||||
|
||||
public function backwpup() {
|
||||
MainWP_Child_Back_WP_Up::Instance()->action();
|
||||
MainWP_Child_Back_WP_Up::instance()->action();
|
||||
}
|
||||
|
||||
|
||||
|
@ -5497,27 +5497,27 @@ class MainWP_Child {
|
|||
}
|
||||
|
||||
public function skeleton_key() {
|
||||
MainWP_Child_Skeleton_Key::Instance()->action();
|
||||
MainWP_Child_Skeleton_Key::instance()->action();
|
||||
}
|
||||
|
||||
public function custom_post_type() {
|
||||
MainWP_Custom_Post_Type::Instance()->action();
|
||||
MainWP_Custom_Post_Type::instance()->action();
|
||||
}
|
||||
|
||||
public function backup_buddy() {
|
||||
MainWP_Child_Back_Up_Buddy::Instance()->action();
|
||||
MainWP_Child_Back_Up_Buddy::instance()->action();
|
||||
}
|
||||
|
||||
public function vulner_checker() {
|
||||
MainWP_Child_Vulnerability_Checker::Instance()->action();
|
||||
MainWP_Child_Vulnerability_Checker::instance()->action();
|
||||
}
|
||||
|
||||
public function time_capsule() {
|
||||
MainWP_Child_Timecapsule::Instance()->action();
|
||||
MainWP_Child_Timecapsule::instance()->action();
|
||||
}
|
||||
|
||||
public function wp_staging() {
|
||||
MainWP_Child_Staging::Instance()->action();
|
||||
MainWP_Child_Staging::instance()->action();
|
||||
}
|
||||
|
||||
public function extra_execution() {
|
||||
|
|
|
@ -6,7 +6,7 @@ class MainWP_Client_Report {
|
|||
|
||||
public static $instance = null;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Client_Report();
|
||||
}
|
||||
|
@ -47,19 +47,19 @@ class MainWP_Client_Report {
|
|||
public static function do_reports_log( $ext = '' ) {
|
||||
switch ( $ext ) {
|
||||
case 'backupbuddy':
|
||||
MainWP_Child_Back_Up_Buddy::Instance()->do_reports_log( $ext );
|
||||
MainWP_Child_Back_Up_Buddy::instance()->do_reports_log( $ext );
|
||||
break;
|
||||
case 'backupwordpress':
|
||||
MainWP_Child_Back_Up_Wordpress::Instance()->do_reports_log( $ext );
|
||||
MainWP_Child_Back_Up_Wordpress::instance()->do_reports_log( $ext );
|
||||
break;
|
||||
case 'backwpup':
|
||||
MainWP_Child_Back_WP_Up::Instance()->do_reports_log( $ext );
|
||||
MainWP_Child_Back_WP_Up::instance()->do_reports_log( $ext );
|
||||
break;
|
||||
case 'wordfence':
|
||||
MainWP_Child_Wordfence::Instance()->do_reports_log( $ext );
|
||||
MainWP_Child_Wordfence::instance()->do_reports_log( $ext );
|
||||
break;
|
||||
case 'wptimecapsule':
|
||||
MainWP_Child_Timecapsule::Instance()->do_reports_log( $ext );
|
||||
MainWP_Child_Timecapsule::instance()->do_reports_log( $ext );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ class MainWP_Client_Report {
|
|||
$args['date_to'] = date( 'Y-m-d', $args['date_to'] );
|
||||
}
|
||||
|
||||
if ( MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||
if ( MainWP_Child_Branding::instance()->is_branding() ) {
|
||||
$args['hide_child_reports'] = 1;
|
||||
}
|
||||
|
||||
|
@ -899,7 +899,7 @@ class MainWP_Client_Report {
|
|||
|
||||
public function set_showhide() {
|
||||
$hide = isset( $_POST['showhide'] ) && ( 'hide' === $_POST['showhide'] ) ? 'hide' : '';
|
||||
MainWP_Child_Branding::Instance()->save_branding_options( 'hide_child_reports', $hide );
|
||||
MainWP_Child_Branding::instance()->save_branding_options( 'hide_child_reports', $hide );
|
||||
$information['result'] = 'SUCCESS';
|
||||
|
||||
return $information;
|
||||
|
@ -907,7 +907,7 @@ class MainWP_Client_Report {
|
|||
|
||||
public function creport_init() {
|
||||
|
||||
$branding_opts = MainWP_Child_Branding::Instance()->get_branding_options();
|
||||
$branding_opts = MainWP_Child_Branding::instance()->get_branding_options();
|
||||
$hide_nag = false;
|
||||
|
||||
if ( isset( $branding_opts['hide_child_reports'] ) && 'hide' == $branding_opts['hide_child_reports'] ) {
|
||||
|
@ -918,7 +918,7 @@ class MainWP_Client_Report {
|
|||
|
||||
if ( ! $hide_nag ) {
|
||||
// check child branding settings!
|
||||
if ( MainWP_Child_Branding::Instance()->is_branding() ) {
|
||||
if ( MainWP_Child_Branding::instance()->is_branding() ) {
|
||||
$hide_nag = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkZipSupport() {
|
||||
public function check_zip_support() {
|
||||
return class_exists( 'ZipArchive' );
|
||||
}
|
||||
|
||||
|
@ -42,24 +42,24 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkZipConsole() {
|
||||
public function check_zip_console() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkWPZip() {
|
||||
public function check_wp_zip() {
|
||||
return function_exists( 'unzip_file' );
|
||||
}
|
||||
|
||||
public function removeConfigFile() {
|
||||
public function remove_config_file() {
|
||||
if ( ! $this->file || ! file_exists( $this->file ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
return false;
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
} elseif ( $this->check_zip_console() ) {
|
||||
return false;
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
if ( $zipRes ) {
|
||||
|
@ -85,7 +85,7 @@ class MainWP_Clone_Install {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function testDownload() {
|
||||
public function test_download() {
|
||||
if ( ! $this->file_exists( 'wp-content/' ) ) {
|
||||
throw new Exception( __( 'This is not a full backup.', 'mainwp-child' ) );
|
||||
}
|
||||
|
@ -107,14 +107,14 @@ class MainWP_Clone_Install {
|
|||
}
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
if ( ! $this->archiver->isOpen() ) {
|
||||
if ( ! $this->archiver->is_open() ) {
|
||||
$this->archiver->read( $this->file );
|
||||
}
|
||||
|
||||
return $this->archiver->file_exists( $file );
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
} elseif ( $this->check_zip_console() ) {
|
||||
return false;
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
if ( $zipRes ) {
|
||||
|
@ -132,8 +132,8 @@ class MainWP_Clone_Install {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function readConfigurationFile() {
|
||||
$configContents = $this->getConfigContents();
|
||||
public function read_configuration_file() {
|
||||
$configContents = $this->get_config_contents();
|
||||
if ( false === $configContents ) {
|
||||
throw new Exception( __( 'Cant read configuration file from the backup.', 'mainwp-child' ) );
|
||||
}
|
||||
|
@ -147,22 +147,6 @@ class MainWP_Clone_Install {
|
|||
}
|
||||
}
|
||||
|
||||
public function setConfig( $key, $val ) {
|
||||
$this->config[ $key ] = $val;
|
||||
}
|
||||
|
||||
public function testDatabase() {
|
||||
$link = MainWP_Child_DB::connect( $this->config['dbHost'], $this->config['dbUser'], $this->config['dbPass'] );
|
||||
if ( ! $link ) {
|
||||
throw new Exception( __( 'Invalid database host or user/password.', 'mainwp-child' ) );
|
||||
}
|
||||
|
||||
$db_selected = MainWP_Child_DB::select_db( $this->config['dbName'], $link );
|
||||
if ( ! $db_selected ) {
|
||||
throw new Exception( __( 'Invalid database name.', 'mainwp-child' ) );
|
||||
}
|
||||
}
|
||||
|
||||
public function clean() {
|
||||
$files = glob( WP_CONTENT_DIR . '/dbBackup*.sql' );
|
||||
foreach ( $files as $file ) {
|
||||
|
@ -190,11 +174,11 @@ class MainWP_Clone_Install {
|
|||
}
|
||||
}
|
||||
|
||||
public function updateWPConfig() {
|
||||
public function update_wp_config() {
|
||||
$wpConfig = file_get_contents( ABSPATH . 'wp-config.php' );
|
||||
$wpConfig = $this->replaceVar( 'table_prefix', $this->config['prefix'], $wpConfig );
|
||||
$wpConfig = $this->replace_var( 'table_prefix', $this->config['prefix'], $wpConfig );
|
||||
if ( isset( $this->config['lang'] ) ) {
|
||||
$wpConfig = $this->replaceDefine( 'WPLANG', $this->config['lang'], $wpConfig );
|
||||
$wpConfig = $this->replace_define( 'WPLANG', $this->config['lang'], $wpConfig );
|
||||
}
|
||||
file_put_contents( ABSPATH . 'wp-config.php', $wpConfig );
|
||||
}
|
||||
|
@ -283,21 +267,6 @@ class MainWP_Clone_Install {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected function recalculateSerializedLengths( $pObject ) {
|
||||
return preg_replace_callback(
|
||||
'|s:(\d+):"(.*?)";|',
|
||||
array(
|
||||
$this,
|
||||
'recalculateSerializedLengths_callback',
|
||||
),
|
||||
$pObject
|
||||
);
|
||||
}
|
||||
|
||||
protected function recalculateSerializedLengths_callback( $matches ) {
|
||||
return 's:' . strlen( $matches[2] ) . ':"' . $matches[2] . '";';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check value to find if it was serialized.
|
||||
*
|
||||
|
@ -356,7 +325,7 @@ class MainWP_Clone_Install {
|
|||
}
|
||||
}
|
||||
|
||||
public function getConfigContents() {
|
||||
public function get_config_contents() {
|
||||
if ( 'extracted' === $this->file ) {
|
||||
return file_get_contents( '../clone/config.txt' );
|
||||
}
|
||||
|
@ -366,21 +335,21 @@ class MainWP_Clone_Install {
|
|||
}
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
if ( ! $this->archiver->isOpen() ) {
|
||||
if ( ! $this->archiver->is_open() ) {
|
||||
$this->archiver->read( $this->file );
|
||||
}
|
||||
$content = $this->archiver->getFromName( 'clone/config.txt' );
|
||||
$content = $this->archiver->get_from_name( 'clone/config.txt' );
|
||||
|
||||
return $content;
|
||||
} else {
|
||||
|
||||
if ( $this->checkZipConsole() ) {
|
||||
if ( $this->check_zip_console() ) {
|
||||
return false;
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
if ( $zipRes ) {
|
||||
$content = $zip->getFromName( 'clone/config.txt' );
|
||||
$content = $zip->get_from_name( 'clone/config.txt' );
|
||||
$zip->close();
|
||||
|
||||
return $content;
|
||||
|
@ -406,26 +375,26 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function extractBackup() {
|
||||
public function extract_backup() {
|
||||
if ( ! $this->file || ! file_exists( $this->file ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( null !== $this->archiver ) {
|
||||
if ( ! $this->archiver->isOpen() ) {
|
||||
if ( ! $this->archiver->is_open() ) {
|
||||
$this->archiver->read( $this->file );
|
||||
}
|
||||
return $this->archiver->extractTo( ABSPATH );
|
||||
} elseif ( ( filesize( $this->file ) >= 50000000 ) && $this->checkWPZip() ) {
|
||||
return $this->extractWPZipBackup();
|
||||
} elseif ( $this->checkZipConsole() ) {
|
||||
return $this->extractZipConsoleBackup();
|
||||
} elseif ( $this->checkZipSupport() ) {
|
||||
return $this->extractZipBackup();
|
||||
} elseif ( ( filesize( $this->file ) < 50000000 ) && $this->checkWPZip() ) {
|
||||
return $this->extractWPZipBackup();
|
||||
return $this->archiver->extract_to( ABSPATH );
|
||||
} elseif ( ( filesize( $this->file ) >= 50000000 ) && $this->check_wp_zip() ) {
|
||||
return $this->extract_wp_zip_backup();
|
||||
} elseif ( $this->check_zip_console() ) {
|
||||
return $this->extract_zip_console_backup();
|
||||
} elseif ( $this->check_zip_support() ) {
|
||||
return $this->extract_zip_backup();
|
||||
} elseif ( ( filesize( $this->file ) < 50000000 ) && $this->check_wp_zip() ) {
|
||||
return $this->extract_wp_zip_backup();
|
||||
} else {
|
||||
return $this->extractZipPclBackup();
|
||||
return $this->extract_zip_pcl_backup();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,11 +403,11 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function extractZipBackup() {
|
||||
public function extract_zip_backup() {
|
||||
$zip = new ZipArchive();
|
||||
$zipRes = $zip->open( $this->file );
|
||||
if ( $zipRes ) {
|
||||
$zip->extractTo( ABSPATH );
|
||||
$zip->extract_to( ABSPATH );
|
||||
$zip->close();
|
||||
|
||||
return true;
|
||||
|
@ -447,7 +416,7 @@ class MainWP_Clone_Install {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function extractWPZipBackup() {
|
||||
public function extract_wp_zip_backup() {
|
||||
MainWP_Helper::get_wp_filesystem();
|
||||
global $wp_filesystem;
|
||||
|
||||
|
@ -463,7 +432,7 @@ class MainWP_Clone_Install {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function extractZipPclBackup() {
|
||||
public function extract_zip_pcl_backup() {
|
||||
$zip = new PclZip( $this->file );
|
||||
if ( 0 === $zip->extract( PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER ) ) {
|
||||
return false;
|
||||
|
@ -480,7 +449,7 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function extractZipConsoleBackup() {
|
||||
public function extract_zip_console_backup() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -493,7 +462,7 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return string Replaced define statement with new value
|
||||
*/
|
||||
protected function replaceDefine( $constant, $value, $content ) {
|
||||
protected function replace_define( $constant, $value, $content ) {
|
||||
return preg_replace( '/(define *\( *[\'"]' . $constant . '[\'"] *, *[\'"])(.*?)([\'"] *\))/is', '${1}' . $value . '${3}', $content );
|
||||
}
|
||||
|
||||
|
@ -506,7 +475,7 @@ class MainWP_Clone_Install {
|
|||
*
|
||||
* @return string Replaced variable value with new value
|
||||
*/
|
||||
protected function replaceVar( $varname, $value, $content ) {
|
||||
protected function replace_var( $varname, $value, $content ) {
|
||||
return preg_replace( '/(\$' . $varname . ' *= *[\'"])(.*?)([\'"] *;)/is', '${1}' . $value . '${3}', $content );
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class MainWP_Clone {
|
|||
return self::$instance;
|
||||
}
|
||||
|
||||
public function addSecurityNonce( $action ) {
|
||||
public function add_security_nonce( $action ) {
|
||||
if ( ! is_array( $this->security_nonces ) ) {
|
||||
$this->security_nonces = array();
|
||||
}
|
||||
|
@ -37,13 +37,13 @@ class MainWP_Clone {
|
|||
$this->security_nonces[ $action ] = wp_create_nonce( $action );
|
||||
}
|
||||
|
||||
public function getSecurityNonces() {
|
||||
public function get_security_nonces() {
|
||||
return $this->security_nonces;
|
||||
}
|
||||
|
||||
public function addAction( $action, $callback ) {
|
||||
public function add_action( $action, $callback ) {
|
||||
add_action( 'wp_ajax_' . $action, $callback );
|
||||
$this->addSecurityNonce( $action );
|
||||
$this->add_security_nonce( $action );
|
||||
}
|
||||
|
||||
public function secure_request( $action = '', $query_arg = 'security' ) {
|
||||
|
@ -90,9 +90,9 @@ class MainWP_Clone {
|
|||
}
|
||||
|
||||
public function init() {
|
||||
add_action( 'check_admin_referer', array( self::get_class_name(), 'permalinkChanged' ) );
|
||||
add_action( 'check_admin_referer', array( self::get_class_name(), 'permalink_changed' ) );
|
||||
if ( get_option( 'mainwp_child_clone_permalink' ) || get_option( 'mainwp_child_restore_permalink' ) ) {
|
||||
add_action( 'admin_notices', array( self::get_class_name(), 'permalinkAdminNotice' ) );
|
||||
add_action( 'admin_notices', array( self::get_class_name(), 'permalink_admin_notice' ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ class MainWP_Clone {
|
|||
$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 );
|
||||
|
||||
self::renderStyle();
|
||||
self::render_style();
|
||||
|
||||
if ( '0' === $sitesToClone ) {
|
||||
echo '<div class="mainwp-child_info-box-red"><strong>' . esc_html__( 'Cloning is currently off - To turn on return to your main dashboard and turn cloning on on the Clone page.', 'mainwp-child' ) . '</strong></div>';
|
||||
|
@ -237,12 +237,12 @@ class MainWP_Clone {
|
|||
<?php
|
||||
}
|
||||
|
||||
self::renderCloneFromServer();
|
||||
self::render_clone_from_server();
|
||||
|
||||
self::renderJavaScript();
|
||||
self::render_java_script();
|
||||
}
|
||||
|
||||
public static function renderNormalRestore() {
|
||||
public static function render_normal_restore() {
|
||||
$uploadError = false;
|
||||
$uploadFile = false;
|
||||
|
||||
|
@ -267,7 +267,7 @@ class MainWP_Clone {
|
|||
$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 );
|
||||
|
||||
self::renderStyle();
|
||||
self::render_style();
|
||||
?>
|
||||
<div class="postbox">
|
||||
<h2 class="hndle"><span><strong><?php esc_html_e( 'Option 1:', 'mainwp-child' ); ?></strong> <?php esc_html_e( 'Restore', 'mainwp-child' ); ?></span></h2>
|
||||
|
@ -298,7 +298,7 @@ class MainWP_Clone {
|
|||
?>
|
||||
<p><?php esc_html_e( 'Upload backup in .zip format (Maximum filesize for your server settings: ', 'mainwp-child' ); ?><?php echo esc_html( $uploadSize ); ?>)</p>
|
||||
<?php
|
||||
$branding_title = MainWP_Child_Branding::Instance()->get_branding_title();
|
||||
$branding_title = MainWP_Child_Branding::instance()->get_branding_title();
|
||||
if ( '' != $branding_title ) {
|
||||
$branding_msg = 'If you have a FULL backup created by basic ' . esc_html( stripslashes( $branding_title ) ) . ' Backup system you may restore it by uploading here. Backups created by 3rd party plugins will not work.';
|
||||
} else {
|
||||
|
@ -319,8 +319,8 @@ class MainWP_Clone {
|
|||
</div>
|
||||
<?php
|
||||
|
||||
self::renderCloneFromServer();
|
||||
self::renderJavaScript();
|
||||
self::render_clone_from_server();
|
||||
self::render_java_script();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -333,7 +333,7 @@ class MainWP_Clone {
|
|||
* Author: Dion Hulse
|
||||
* Author URI: http://dd32.id.au/
|
||||
*/
|
||||
public static function renderCloneFromServer() {
|
||||
public static function render_clone_from_server() {
|
||||
$page = $_REQUEST['page'];
|
||||
$sitesToClone = get_option( 'mainwp_child_clone_sites' );
|
||||
$url = admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone#title_03' );
|
||||
|
@ -490,7 +490,7 @@ class MainWP_Clone {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function renderJavaScript() {
|
||||
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 );
|
||||
?>
|
||||
|
@ -498,7 +498,7 @@ class MainWP_Clone {
|
|||
<script language="javascript">
|
||||
var child_security_nonces = [];
|
||||
<?php
|
||||
$security_nonces = self::get()->getSecurityNonces();
|
||||
$security_nonces = self::get()->get_security_nonces();
|
||||
foreach ( $security_nonces as $k => $v ) {
|
||||
echo 'child_security_nonces[' . "'" . $k . "'" . '] = ' . "'" . $v . "';\n";
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ class MainWP_Clone {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function renderStyle() {
|
||||
public static function render_style() {
|
||||
?>
|
||||
<style>
|
||||
#mainwp-child_clone_status {
|
||||
|
@ -1129,14 +1129,14 @@ class MainWP_Clone {
|
|||
}
|
||||
|
||||
public function init_ajax() {
|
||||
$this->addAction( 'mainwp-child_clone_backupcreate', array( &$this, 'cloneBackupCreate' ) );
|
||||
$this->addAction( 'mainwp-child_clone_backupcreatepoll', array( &$this, 'cloneBackupCreatePoll' ) );
|
||||
$this->addAction( 'mainwp-child_clone_backupdownload', array( &$this, 'cloneBackupDownload' ) );
|
||||
$this->addAction( 'mainwp-child_clone_backupdownloadpoll', array( &$this, 'cloneBackupDownloadPoll' ) );
|
||||
$this->addAction( 'mainwp-child_clone_backupextract', array( &$this, 'cloneBackupExtract' ) );
|
||||
$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' ) );
|
||||
$this->add_action( 'mainwp-child_clone_backupdownload', array( &$this, 'clone_backup_download' ) );
|
||||
$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 cloneBackupCreate() {
|
||||
public function clone_backup_create() {
|
||||
try {
|
||||
$this->secure_request( 'mainwp-child_clone_backupcreate' );
|
||||
|
||||
|
@ -1191,7 +1191,7 @@ class MainWP_Clone {
|
|||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
public function cloneBackupCreatePoll() {
|
||||
public function clone_backup_create_poll() {
|
||||
try {
|
||||
$this->secure_request( 'mainwp-child_clone_backupcreatepoll' );
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ class MainWP_Clone {
|
|||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
public function cloneBackupDownload() {
|
||||
public function clone_backup_download() {
|
||||
try {
|
||||
$this->secure_request( 'mainwp-child_clone_backupdownload' );
|
||||
|
||||
|
@ -1331,7 +1331,7 @@ class MainWP_Clone {
|
|||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
public function cloneBackupDownloadPoll() {
|
||||
public function clone_backup_download_poll() {
|
||||
try {
|
||||
$this->secure_request( 'mainwp-child_clone_backupdownloadpoll' );
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ class MainWP_Clone {
|
|||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
public function cloneBackupExtract() {
|
||||
public function clone_backup_extract() {
|
||||
try {
|
||||
$this->secure_request( 'mainwp-child_clone_backupextract' );
|
||||
|
||||
|
@ -1392,16 +1392,16 @@ class MainWP_Clone {
|
|||
$testFull = true;
|
||||
}
|
||||
$cloneInstall = new MainWP_Clone_Install( $file );
|
||||
$cloneInstall->readConfigurationFile();
|
||||
$cloneInstall->read_configuration_file();
|
||||
|
||||
$plugins = get_option( 'mainwp_temp_clone_plugins' );
|
||||
$themes = get_option( 'mainwp_temp_clone_themes' );
|
||||
|
||||
if ( $testFull ) {
|
||||
$cloneInstall->testDownload();
|
||||
$cloneInstall->test_download();
|
||||
}
|
||||
$cloneInstall->removeConfigFile();
|
||||
$cloneInstall->extractBackup();
|
||||
$cloneInstall->remove_config_file();
|
||||
$cloneInstall->extract_backup();
|
||||
|
||||
$pubkey = get_option( 'mainwp_child_pubkey' );
|
||||
$uniqueId = get_option( 'mainwp_child_uniqueId' );
|
||||
|
@ -1434,7 +1434,7 @@ class MainWP_Clone {
|
|||
MainWP_Helper::update_option( 'mainwp_child_clone_permalink', true, 'yes' );
|
||||
}
|
||||
|
||||
$cloneInstall->updateWPConfig();
|
||||
$cloneInstall->update_wp_config();
|
||||
$cloneInstall->clean();
|
||||
|
||||
if ( false !== $plugins ) {
|
||||
|
@ -1487,7 +1487,7 @@ class MainWP_Clone {
|
|||
die( json_encode( $output ) );
|
||||
}
|
||||
|
||||
public static function permalinkChanged( $action ) {
|
||||
public static function permalink_changed( $action ) {
|
||||
if ( 'update-permalink' === $action ) {
|
||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) || isset( $_POST['tag_base'] ) ) {
|
||||
delete_option( 'mainwp_child_clone_permalink' );
|
||||
|
@ -1496,7 +1496,7 @@ class MainWP_Clone {
|
|||
}
|
||||
}
|
||||
|
||||
public static function permalinkAdminNotice() {
|
||||
public static function permalink_admin_notice() {
|
||||
if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) || isset( $_POST['tag_base'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ class MainWP_Clone {
|
|||
<?php
|
||||
}
|
||||
|
||||
public static function renderRestore() {
|
||||
public static function render_restore() {
|
||||
if ( '' === session_id() ) {
|
||||
session_start();
|
||||
}
|
||||
|
@ -1545,7 +1545,7 @@ class MainWP_Clone {
|
|||
die( '<meta http-equiv="refresh" content="0;url=' . esc_url( admin_url() ) . '">' );
|
||||
}
|
||||
|
||||
self::renderStyle();
|
||||
self::render_style();
|
||||
?>
|
||||
<div class="postbox">
|
||||
<h2 class="hndle"><?php esc_html_e( 'Restore', 'mainwp-child' ); ?></h2>
|
||||
|
@ -1563,7 +1563,7 @@ class MainWP_Clone {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php self::renderJavaScript(); ?>
|
||||
<?php self::render_java_script(); ?>
|
||||
<script type="text/javascript">translations['clone_complete'] = '<?php esc_html_e( 'Restore process completed successfully!', 'mainwp-child' ); ?>';</script>
|
||||
<?php
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class MainWP_Custom_Post_Type {
|
|||
public static $information = array();
|
||||
public $plugin_translate = 'mainwp-child';
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null == self::$instance ) {
|
||||
self::$instance = new MainWP_Custom_Post_Type();
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ class MainWP_Helper {
|
|||
);
|
||||
|
||||
$wprocket_activated = false;
|
||||
if ( MainWP_Child_WP_Rocket::Instance()->isActivated() ) {
|
||||
if ( MainWP_Child_WP_Rocket::instance()->is_activated() ) {
|
||||
if ( function_exists( 'get_rocket_option' ) ) {
|
||||
$wprocket_activated = true;
|
||||
foreach ( $wprocket_fields as $field ) {
|
||||
|
|
|
@ -14,7 +14,7 @@ class MainWP_Keyword_Links {
|
|||
protected $link_exact_match = 1;
|
||||
protected $link_case_sensitive = 1;
|
||||
|
||||
static function Instance() {
|
||||
static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Keyword_Links();
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
// print_r($this->keyword_links);
|
||||
$this->siteurl = get_option( 'home' );
|
||||
add_action( 'permalink_structure_changed', array( &$this, 'permalinkChanged' ), 10, 2 );
|
||||
add_action( 'permalink_structure_changed', array( &$this, 'permalink_changed' ), 10, 2 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +59,7 @@ class MainWP_Keyword_Links {
|
|||
}
|
||||
|
||||
|
||||
public function permalinkChanged( $old_struct, $new_struct ) {
|
||||
public function permalink_changed( $old_struct, $new_struct ) {
|
||||
if ( '1' !== get_option( 'mainwpKeywordLinks' ) ) {
|
||||
if ( 'yes' === get_option( 'mainwp_keyword_links_htaccess_set' ) ) {
|
||||
$this->update_htaccess( false, true ); // force clear
|
||||
|
|
|
@ -15,7 +15,7 @@ class MainWP_Security {
|
|||
return __CLASS__;
|
||||
}
|
||||
|
||||
public static function fixAll() {
|
||||
public static function fix_all() {
|
||||
self::remove_wp_version();
|
||||
self::remove_rsd();
|
||||
self::remove_wlw();
|
||||
|
@ -33,7 +33,7 @@ class MainWP_Security {
|
|||
// Prevent listing wp-content, wp-content/plugins, wp-content/themes, wp-content/uploads.
|
||||
private static $listingDirectories = null;
|
||||
|
||||
private static function init_listingDirectories() {
|
||||
private static function init_listing_directories() {
|
||||
if ( null === self::$listingDirectories ) {
|
||||
$wp_upload_dir = wp_upload_dir();
|
||||
self::$listingDirectories = array(
|
||||
|
@ -46,7 +46,7 @@ class MainWP_Security {
|
|||
}
|
||||
|
||||
public static function prevent_listing_ok() {
|
||||
self::init_listingDirectories();
|
||||
self::init_listing_directories();
|
||||
foreach ( self::$listingDirectories as $directory ) {
|
||||
$file = $directory . DIRECTORY_SEPARATOR . 'index.php';
|
||||
if ( ! file_exists( $file ) ) {
|
||||
|
@ -58,7 +58,7 @@ class MainWP_Security {
|
|||
}
|
||||
|
||||
public static function prevent_listing() {
|
||||
self::init_listingDirectories();
|
||||
self::init_listing_directories();
|
||||
foreach ( self::$listingDirectories as $directory ) {
|
||||
$file = $directory . DIRECTORY_SEPARATOR . 'index.php';
|
||||
if ( ! file_exists( $file ) ) {
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace MainWP\Child;
|
|||
class MainWP_Wordpress_SEO {
|
||||
public static $instance = null;
|
||||
|
||||
public static function Instance() {
|
||||
public static function instance() {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new MainWP_Wordpress_SEO();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class Tar_Archiver {
|
|||
}
|
||||
}
|
||||
|
||||
public function getExtension() {
|
||||
public function get_extension() {
|
||||
if ( 'tar.bz2' == $this->type ) {
|
||||
return '.tar.bz2';
|
||||
}
|
||||
|
@ -60,14 +60,14 @@ class Tar_Archiver {
|
|||
return '.tar';
|
||||
}
|
||||
|
||||
public function zipFile( $files, $archive ) {
|
||||
public function zip_file( $files, $archive ) {
|
||||
$this->create( $archive );
|
||||
if ( $this->archive ) {
|
||||
foreach ( $files as $filepath ) {
|
||||
$this->addFile( $filepath, basename( $filepath ) );
|
||||
$this->add_file( $filepath, basename( $filepath ) );
|
||||
}
|
||||
|
||||
$this->addData( pack( 'a1024', '' ) );
|
||||
$this->add_data( pack( 'a1024', '' ) );
|
||||
$this->close();
|
||||
|
||||
return true;
|
||||
|
@ -76,7 +76,7 @@ class Tar_Archiver {
|
|||
return false;
|
||||
}
|
||||
|
||||
private function createPidFile( $file ) {
|
||||
private function create_pid_file( $file ) {
|
||||
if ( false === $this->pidFile ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ class Tar_Archiver {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function updatePidFile() {
|
||||
public function update_pid_file() {
|
||||
if ( false === $this->pidFile ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class Tar_Archiver {
|
|||
return true;
|
||||
}
|
||||
|
||||
private function completePidFile() {
|
||||
private function complete_pid_file() {
|
||||
if ( false === $this->pidFile ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ class Tar_Archiver {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function createFullBackup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp, $append = false ) {
|
||||
$this->createPidFile( $filepath );
|
||||
public function create_full_backup( $filepath, $excludes, $addConfig, $includeCoreFiles, $excludezip, $excludenonwp, $append = false ) {
|
||||
$this->create_pid_file( $filepath );
|
||||
|
||||
$this->excludeZip = $excludezip;
|
||||
|
||||
|
@ -133,7 +133,7 @@ class Tar_Archiver {
|
|||
|
||||
if ( $append && file_exists( $filepath ) ) {
|
||||
$this->mode = self::APPEND;
|
||||
$this->prepareAppend( $filepath );
|
||||
$this->prepare_append( $filepath );
|
||||
} else {
|
||||
$this->mode = self::CREATE;
|
||||
$this->create( $filepath );
|
||||
|
@ -181,14 +181,14 @@ class Tar_Archiver {
|
|||
unset( $coreFiles );
|
||||
}
|
||||
|
||||
$db_files = $this->backup->createBackupDB( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup', false, $this );
|
||||
$db_files = $this->backup->create_backup_db( dirname( $filepath ) . DIRECTORY_SEPARATOR . 'dbBackup', false, $this );
|
||||
|
||||
foreach ( $db_files as $db_file ) {
|
||||
$this->addFile( $db_file, basename( WP_CONTENT_DIR ) . '/' . basename( $db_file ) );
|
||||
$this->add_file( $db_file, basename( WP_CONTENT_DIR ) . '/' . basename( $db_file ) );
|
||||
}
|
||||
|
||||
if ( file_exists( ABSPATH . '.htaccess' ) ) {
|
||||
$this->addFile( ABSPATH . '.htaccess', 'mainwp-htaccess' );
|
||||
$this->add_file( ABSPATH . '.htaccess', 'mainwp-htaccess' );
|
||||
}
|
||||
|
||||
foreach ( $nodes as $node ) {
|
||||
|
@ -200,9 +200,9 @@ class Tar_Archiver {
|
|||
|
||||
if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) {
|
||||
if ( is_dir( $node ) ) {
|
||||
$this->addDir( $node, $excludes );
|
||||
$this->add_dir( $node, $excludes );
|
||||
} elseif ( is_file( $node ) ) {
|
||||
$this->addFile( $node, str_replace( ABSPATH, '', $node ) );
|
||||
$this->add_file( $node, str_replace( ABSPATH, '', $node ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,17 +251,17 @@ class Tar_Archiver {
|
|||
)
|
||||
);
|
||||
|
||||
$this->addEmptyDirectory( 'clone', 0, 0, 0, time() );
|
||||
$this->addFileFromString( 'clone/config.txt', $string );
|
||||
$this->add_empty_directory( 'clone', 0, 0, 0, time() );
|
||||
$this->add_file_from_string( 'clone/config.txt', $string );
|
||||
}
|
||||
|
||||
$this->addData( pack( 'a1024', '' ) );
|
||||
$this->add_data( pack( 'a1024', '' ) );
|
||||
$this->close();
|
||||
foreach ( $db_files as $db_file ) {
|
||||
unlink( $db_file );
|
||||
}
|
||||
|
||||
$this->completePidFile();
|
||||
$this->complete_pid_file();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -269,15 +269,15 @@ class Tar_Archiver {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function addDir( $path, $excludes ) {
|
||||
public function add_dir( $path, $excludes ) {
|
||||
if ( ( '.' == basename( $path ) ) || ( '..' == basename( $path ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addEmptyDir( $path, str_replace( ABSPATH, '', $path ) );
|
||||
$this->add_empty_dir( $path, str_replace( ABSPATH, '', $path ) );
|
||||
|
||||
if ( file_exists( rtrim( $path, '/' ) . '/.htaccess' ) ) {
|
||||
$this->addFile( rtrim( $path, '/' ) . '/.htaccess', rtrim( str_replace( ABSPATH, '', $path ), '/' ) . '/mainwp-htaccess' );
|
||||
$this->add_file( rtrim( $path, '/' ) . '/.htaccess', rtrim( str_replace( ABSPATH, '', $path ), '/' ) . '/mainwp-htaccess' );
|
||||
}
|
||||
|
||||
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $path ), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD );
|
||||
|
@ -295,9 +295,9 @@ class Tar_Archiver {
|
|||
|
||||
if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) {
|
||||
if ( $path->isDir() ) {
|
||||
$this->addEmptyDir( $name, str_replace( ABSPATH, '', $name ) );
|
||||
$this->add_empty_dir( $name, str_replace( ABSPATH, '', $name ) );
|
||||
} else {
|
||||
$this->addFile( $name, str_replace( ABSPATH, '', $name ) );
|
||||
$this->add_file( $name, str_replace( ABSPATH, '', $name ) );
|
||||
}
|
||||
}
|
||||
$name = null;
|
||||
|
@ -308,12 +308,12 @@ class Tar_Archiver {
|
|||
unset( $iterator );
|
||||
}
|
||||
|
||||
private function addData( $data ) {
|
||||
private function add_data( $data ) {
|
||||
if ( $this->debug ) {
|
||||
$this->chunk .= $data;
|
||||
|
||||
if ( strlen( $this->chunk ) > $this->chunkSize ) {
|
||||
$this->writeChunk();
|
||||
$this->write_chunk();
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -335,7 +335,7 @@ class Tar_Archiver {
|
|||
}
|
||||
}
|
||||
|
||||
private function writeChunk() {
|
||||
private function write_chunk() {
|
||||
$len = strlen( $this->chunk );
|
||||
if ( 0 == $len ) {
|
||||
return;
|
||||
|
@ -362,15 +362,15 @@ class Tar_Archiver {
|
|||
$this->chunk = '';
|
||||
}
|
||||
|
||||
private function addEmptyDir( $path, $entryName ) {
|
||||
private function add_empty_dir( $path, $entryName ) {
|
||||
$stat = stat( $path );
|
||||
|
||||
$this->addEmptyDirectory( $entryName, $stat['mode'], $stat['uid'], $stat['gid'], $stat['mtime'] );
|
||||
$this->add_empty_directory( $entryName, $stat['mode'], $stat['uid'], $stat['gid'], $stat['mtime'] );
|
||||
}
|
||||
|
||||
private function addEmptyDirectory( $entryName, $mode, $uid, $gid, $mtime ) {
|
||||
private function add_empty_directory( $entryName, $mode, $uid, $gid, $mtime ) {
|
||||
if ( self::APPEND == $this->mode ) {
|
||||
if ( true === $this->checkBeforeAppend( $entryName ) ) {
|
||||
if ( true === $this->check_before_append( $entryName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -411,8 +411,8 @@ class Tar_Archiver {
|
|||
$checksum = pack( 'a8', sprintf( '%07o', $checksum ) );
|
||||
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||
|
||||
$this->addData( $block );
|
||||
$this->addData( pack( 'a512', $entryName ) );
|
||||
$this->add_data( $block );
|
||||
$this->add_data( pack( 'a512', $entryName ) );
|
||||
$entryName = substr( $entryName, 0, 100 );
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ class Tar_Archiver {
|
|||
$checksum = pack( 'a8', sprintf( '%07o', $checksum ) );
|
||||
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||
|
||||
$this->addData( $block );
|
||||
$this->add_data( $block );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ class Tar_Archiver {
|
|||
protected $gcCnt = 0;
|
||||
protected $cnt = 0;
|
||||
|
||||
private function addFile( $path, $entryName ) {
|
||||
private function add_file( $path, $entryName ) {
|
||||
if ( ( '.' == basename( $path ) ) || ( '..' == basename( $path ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -468,11 +468,11 @@ class Tar_Archiver {
|
|||
|
||||
$this->log( 'Adding ' . $path );
|
||||
|
||||
$this->updatePidFile();
|
||||
$this->update_pid_file();
|
||||
|
||||
$rslt = false;
|
||||
if ( self::APPEND == $this->mode ) {
|
||||
$rslt = $this->checkBeforeAppend( $entryName );
|
||||
$rslt = $this->check_before_append( $entryName );
|
||||
if ( true === $rslt ) {
|
||||
return true;
|
||||
}
|
||||
|
@ -537,10 +537,10 @@ class Tar_Archiver {
|
|||
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||
|
||||
if ( ! isset( $rslt['bytesRead'] ) ) {
|
||||
$this->addData( $block );
|
||||
$this->add_data( $block );
|
||||
}
|
||||
if ( ! isset( $rslt['bytesRead'] ) ) {
|
||||
$this->addData( pack( 'a512', $entryName ) );
|
||||
$this->add_data( pack( 'a512', $entryName ) );
|
||||
}
|
||||
$entryName = substr( $entryName, 0, 100 );
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ class Tar_Archiver {
|
|||
$this->block = substr_replace( $this->block, $checksum, 148, 8 );
|
||||
|
||||
if ( ! isset( $rslt['bytesRead'] ) ) {
|
||||
$this->addData( $this->block );
|
||||
$this->add_data( $this->block );
|
||||
}
|
||||
|
||||
if ( isset( $rslt['bytesRead'] ) ) {
|
||||
|
@ -586,12 +586,12 @@ class Tar_Archiver {
|
|||
if ( $toRead > 0 ) {
|
||||
$this->tempContent = fread( $fp, $toRead );
|
||||
|
||||
$this->addData( $this->tempContent );
|
||||
$this->add_data( $this->tempContent );
|
||||
|
||||
$remainder = 512 - ( strlen( $this->tempContent ) + $alreadyRead );
|
||||
$this->log( 'DEBUG-Added ' . strlen( $this->tempContent ) . '(before: ' . $alreadyRead . ') will pack: ' . $remainder . ' (packed: ' . strlen( pack( 'a' . $remainder, '' ) ) );
|
||||
if ( $remainder > 0 ) {
|
||||
$this->addData( pack( 'a' . $remainder ), '' );
|
||||
$this->add_data( pack( 'a' . $remainder ), '' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -602,13 +602,13 @@ class Tar_Archiver {
|
|||
$read = strlen( $this->tempContent );
|
||||
$divide = $read % 512;
|
||||
|
||||
$this->addData( substr( $this->tempContent, 0, $read - $divide ) );
|
||||
$this->add_data( substr( $this->tempContent, 0, $read - $divide ) );
|
||||
|
||||
if ( $divide > 0 ) {
|
||||
$this->addData( pack( 'a512', substr( $this->tempContent, - 1 * $divide ) ) );
|
||||
$this->add_data( pack( 'a512', substr( $this->tempContent, - 1 * $divide ) ) );
|
||||
}
|
||||
|
||||
$this->updatePidFile();
|
||||
$this->update_pid_file();
|
||||
}
|
||||
|
||||
fclose( $fp );
|
||||
|
@ -616,11 +616,11 @@ class Tar_Archiver {
|
|||
return true;
|
||||
}
|
||||
|
||||
private function addFileFromString( $entryName, $content ) {
|
||||
private function add_file_from_string( $entryName, $content ) {
|
||||
$this->log( 'Add from string ' . $entryName );
|
||||
|
||||
if ( self::APPEND == $this->mode ) {
|
||||
if ( true === $this->checkBeforeAppend( $entryName ) ) {
|
||||
if ( true === $this->check_before_append( $entryName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -661,8 +661,8 @@ class Tar_Archiver {
|
|||
$checksum = pack( 'a8', sprintf( '%07o', $checksum ) );
|
||||
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||
|
||||
$this->addData( $block );
|
||||
$this->addData( pack( 'a512', $entryName ) );
|
||||
$this->add_data( $block );
|
||||
$this->add_data( pack( 'a512', $entryName ) );
|
||||
$entryName = substr( $entryName, 0, 100 );
|
||||
}
|
||||
}
|
||||
|
@ -695,17 +695,17 @@ class Tar_Archiver {
|
|||
$checksum = pack( 'a8', sprintf( '%07o', $checksum ) );
|
||||
$block = substr_replace( $block, $checksum, 148, 8 );
|
||||
|
||||
$this->addData( $block );
|
||||
$this->add_data( $block );
|
||||
$i = 0;
|
||||
while ( ( $line = substr( $content, $i ++ * 512, 512 ) ) != '' ) {
|
||||
$this->addData( pack( 'a512', $line ) );
|
||||
$this->add_data( pack( 'a512', $line ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function checkBeforeAppend( $entryName ) {
|
||||
$rslt = $this->isNextFile( $entryName );
|
||||
private function check_before_append( $entryName ) {
|
||||
$rslt = $this->is_next_file( $entryName );
|
||||
|
||||
if ( true === $rslt ) {
|
||||
return true;
|
||||
|
@ -753,7 +753,7 @@ class Tar_Archiver {
|
|||
* @return array|bool
|
||||
* @throws Exception
|
||||
*/
|
||||
private function isNextFile( $entryName ) {
|
||||
private function is_next_file( $entryName ) {
|
||||
$currentOffset = ftell( $this->archive );
|
||||
$rslt = array( 'startOffset' => $currentOffset );
|
||||
try {
|
||||
|
@ -910,11 +910,11 @@ class Tar_Archiver {
|
|||
}
|
||||
}
|
||||
|
||||
public function isOpen() {
|
||||
public function is_open() {
|
||||
return ! empty( $this->archive );
|
||||
}
|
||||
|
||||
public function prepareAppend( $filepath ) {
|
||||
public function prepare_append( $filepath ) {
|
||||
if ( $this->debug ) {
|
||||
if ( 'tar.gz' == substr( $filepath, - 6 ) ) {
|
||||
$text = chr( 31 ) . chr( 139 ) . chr( 8 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 ) . chr( 0 );
|
||||
|
@ -929,7 +929,7 @@ class Tar_Archiver {
|
|||
echo ord( $read[ $i ] ) . "\n";
|
||||
}
|
||||
|
||||
if ( ! $this->isValidBlock( substr( $read, 10, $pos - 10 ) ) ) {
|
||||
if ( ! $this->is_valid_block( substr( $read, 10, $pos - 10 ) ) ) {
|
||||
throw new Exception( 'invalid!' );
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ class Tar_Archiver {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ! $this->isValidBlock( substr( $read, 10 ) ) ) {
|
||||
if ( ! $this->is_valid_block( substr( $read, 10 ) ) ) {
|
||||
throw new Exception( 'invalid!' );
|
||||
}
|
||||
|
||||
|
@ -980,7 +980,7 @@ class Tar_Archiver {
|
|||
}
|
||||
|
||||
public function close( $closeLog = true ) {
|
||||
$this->writeChunk();
|
||||
$this->write_chunk();
|
||||
$this->log( 'Closing archive' );
|
||||
|
||||
if ( $closeLog && $this->logHandle ) {
|
||||
|
@ -998,7 +998,7 @@ class Tar_Archiver {
|
|||
}
|
||||
}
|
||||
|
||||
public function getFromName( $entryName ) {
|
||||
public function get_from_name( $entryName ) {
|
||||
if ( ! $this->archive ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1125,7 +1125,7 @@ class Tar_Archiver {
|
|||
return false;
|
||||
}
|
||||
|
||||
public function extractTo( $to ) {
|
||||
public function extract_to( $to ) {
|
||||
/** @var $wp_filesystem WP_Filesystem_Base */
|
||||
global $wp_filesystem;
|
||||
|
||||
|
@ -1230,7 +1230,7 @@ class Tar_Archiver {
|
|||
return null;
|
||||
}
|
||||
|
||||
public function isValidBlock( $block ) {
|
||||
public function is_valid_block( $block ) {
|
||||
$test = gzinflate( $block );
|
||||
if ( false === $test ) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue