Skip to content
Snippets Groups Projects
Commit eca8ecc0 authored by Erick Hitter's avatar Erick Hitter
Browse files

Time event execution

parent b7a1650a
No related branches found
No related tags found
No related merge requests found
......@@ -20,12 +20,14 @@ function run_event( $command ) {
return;
}
// TODO: time event execution
$start = microtime( true );
$output = \WP_CLI::runcommand( $command, array(
'return' => 'all',
) );
$end = microtime( true );
// Command failed
if ( ! is_object( $output ) || is_wp_error( $output ) ) {
trigger_error( 'WP-CLI command failed. (' . var_export( $command, true ) . ')', E_USER_WARNING );
......@@ -34,7 +36,10 @@ function run_event( $command ) {
}
// On success, reformat response for logging
$output->command = $command;
$output->command = $command;
$output->start = $start;
$output->end = $end;
$output->duration = $end - $start;
$output = var_export( $output, true );
$output = ACTION . ":\n{$output}";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment