mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-21 06:38:51 +08:00
Merge pull request #20 from runcommand/namespace-class
Namespace the command class
This commit is contained in:
commit
9893074687
2 changed files with 11 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ( class_exists( 'WP_CLI' ) ) {
|
if ( class_exists( 'WP_CLI' ) ) {
|
||||||
require_once dirname( __FILE__ ) . '/inc/class-profile-command.php';
|
require_once dirname( __FILE__ ) . '/inc/class-command.php';
|
||||||
WP_CLI::add_command( 'profile', 'Profile_Command' );
|
WP_CLI::add_command( 'profile', 'runcommand\Profile\Command' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace runcommand\Profile;
|
||||||
|
|
||||||
|
use WP_CLI;
|
||||||
|
use WP_CLI\Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Profile the performance of a WordPress request.
|
* Profile the performance of a WordPress request.
|
||||||
*/
|
*/
|
||||||
class Profile_Command {
|
class Command {
|
||||||
|
|
||||||
private $hook_start_time = 0;
|
private $hook_start_time = 0;
|
||||||
private $hook_time = 0;
|
private $hook_time = 0;
|
||||||
|
@ -93,10 +98,10 @@ class Profile_Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->focus_scope = WP_CLI\Utils\get_flag_value( $assoc_args, 'scope' );
|
$this->focus_scope = Utils\get_flag_value( $assoc_args, 'scope' );
|
||||||
$this->focus_hook = WP_CLI\Utils\get_flag_value( $assoc_args, 'hook' );
|
$this->focus_hook = Utils\get_flag_value( $assoc_args, 'hook' );
|
||||||
|
|
||||||
if ( ! isset( \WP_CLI::get_runner()->config['url'] ) ) {
|
if ( ! isset( WP_CLI::get_runner()->config['url'] ) ) {
|
||||||
WP_CLI::add_wp_hook( 'muplugins_loaded', function(){
|
WP_CLI::add_wp_hook( 'muplugins_loaded', function(){
|
||||||
WP_CLI::set_url( home_url( '/' ) );
|
WP_CLI::set_url( home_url( '/' ) );
|
||||||
});
|
});
|
Loading…
Add table
Add a link
Reference in a new issue