WP_CLI
Runner::do_early_invoke
Perform the early invocation of a command.
Метод класса: Runner{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->do_early_invoke( $when );
- $when(строка) (обязательный)
- Named execution hook.
Код Runner::do_early_invoke() Runner::do early invoke WP-CLI 2.13.0-alpha
private function do_early_invoke( $when ) {
WP_CLI::debug( "Executing hook: {$when}", 'hooks' );
if ( ! isset( $this->early_invoke[ $when ] ) ) {
return;
}
// Search the value of @when from the command method.
$real_when = '';
$r = $this->find_command_to_run( $this->arguments );
if ( is_array( $r ) ) {
list( $command, $final_args, $cmd_path ) = $r;
foreach ( $this->early_invoke as $_when => $_path ) {
foreach ( $_path as $cmd ) {
if ( $cmd === $cmd_path ) {
$real_when = $_when;
}
}
}
}
foreach ( $this->early_invoke[ $when ] as $path ) {
if ( $this->cmd_starts_with( $path ) ) {
if ( empty( $real_when ) || ( $real_when && $real_when === $when ) ) {
$this->run_command_and_exit();
}
}
}
}