mainwp-child/class/class-mainwp-debug.php

35 lines
1,021 B
PHP
Raw Normal View History

2020-03-26 14:05:04 +00:00
<?php
2020-05-05 20:13:38 +07:00
namespace MainWP\Child;
2020-03-26 14:05:04 +00:00
class MainWP_Debug {
/**
2020-05-12 20:19:58 +07:00
* @param $mainWPChild MainWP_Child
2020-03-26 14:05:04 +00:00
*/
2020-05-12 20:19:58 +07:00
public static function process( &$mainWPChild ) {
2020-05-13 01:18:02 +07:00
if ( ! isset( $_GET['mainwpdebug'] ) || ! defined( 'MAINWP_CHILD_DEBUG' ) || ( MAINWP_CHILD_DEBUG !== true ) ) {
2020-03-26 14:05:04 +00:00
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';
2020-05-12 20:19:58 +07:00
print_r( $mainWPChild->backup( false ) ); // phpcs:ignore -- debug feature.
} elseif ( 'test' == $_GET['mainwpdebug'] ) {
2020-05-07 23:22:05 +07:00
print_r( get_included_files() ); // phpcs:ignore -- debug feature.
2020-03-26 14:05:04 +00:00
} else {
2020-05-12 20:19:58 +07:00
print_r( MainWP_Child_Stats::get_instance()->get_site_stats( array(), false ) ); // phpcs:ignore -- debug feature.
2020-03-26 14:05:04 +00:00
}
$stop = microtime( true );
die( "\n\n\n" . 'duration: ' . ( $stop - $start ) . 's</pre>' );
}
}