mainwp-child/class/class-mainwp-debug.php
codefactor-io a44b994f5e [CodeFactor] Apply fixes
[ci skip] [skip ci]
2020-05-21 04:40:14 +00:00

44 lines
1.2 KiB
PHP

<?php
/**
* MainWP Child Plugin Debug.
*/
namespace MainWP\Child;
/**
* Class MainWP_Debug
*
* @package MainWP\Child
*/
class MainWP_Debug {
/**
* Render MainWP Backup & test debugging output.
*
* @param $mainWPChild MainWP_Child Instance.
*/
public static function process( &$mainWPChild ) {
if ( ! isset( $_GET['mainwpdebug'] ) || ! defined( 'MAINWP_CHILD_DEBUG' ) || ( MAINWP_CHILD_DEBUG !== true ) ) {
return;
}
echo '<pre>';
$start = microtime( true );
if ( 'fullbackup' == $_GET['mainwpdebug'] ) {
$_POST['type'] = 'full';
$_POST['excludebackup'] = '1';
$_POST['excludecache'] = '1';
$_POST['excludezip'] = '1';
$_POST['excludenonwp'] = '1';
$_POST['ext'] = 'tar.gz';
print_r( $mainWPChild->backup( false ) ); // phpcs:ignore -- debug feature.
} elseif ( 'test' == $_GET['mainwpdebug'] ) {
print_r( get_included_files() ); // phpcs:ignore -- debug feature.
} else {
print_r( MainWP_Child_Stats::get_instance()->get_site_stats( array(), false ) ); // phpcs:ignore -- debug feature.
}
$stop = microtime( true );
die( "\n\n\n" . 'duration: ' . ( $stop - $start ) . 's</pre>' );
}
}