mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-21 06:39:02 +08:00
Merge pull request #58 from runcommand/48-stage-template
Register some basic hooks for the template stage
This commit is contained in:
commit
dd0f772a6b
2 changed files with 31 additions and 1 deletions
21
features/profile-stage-template.feature
Normal file
21
features/profile-stage-template.feature
Normal file
|
@ -0,0 +1,21 @@
|
|||
Feature: Profile the template render stage
|
||||
|
||||
Scenario: Profiler loads a table with the correct hooks
|
||||
Given a WP install
|
||||
|
||||
When I run `wp profile --stage=template --fields=hook`
|
||||
Then STDOUT should be a table containing rows:
|
||||
| hook |
|
||||
| |
|
||||
| template_redirect |
|
||||
| |
|
||||
| template_include |
|
||||
| |
|
||||
| wp_head |
|
||||
| |
|
||||
| loop_start |
|
||||
| |
|
||||
| loop_end |
|
||||
| |
|
||||
| wp_footer |
|
||||
| total |
|
|
@ -295,7 +295,16 @@ class Command {
|
|||
}
|
||||
|
||||
// Load the theme template.
|
||||
if ( ! $this->focus_stage && ! $this->focus_hook ) {
|
||||
if ( 'template' === $this->focus_stage ) {
|
||||
$this->set_stage_hooks( array(
|
||||
'template_redirect',
|
||||
'template_include',
|
||||
'wp_head',
|
||||
'loop_start',
|
||||
'loop_end',
|
||||
'wp_footer',
|
||||
) );
|
||||
} else if ( ! $this->focus_stage && ! $this->focus_hook ) {
|
||||
$logger = new Logger( 'stage', 'template' );
|
||||
$logger->start();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue