WP_CLI\Context
Auto::is_command_to_run_as_admin()
Check whether the current WP-CLI command is amongst those we want to run as admin.
Метод класса: Auto{}
Хуков нет.
Возвращает
true|false
. Whether the current command should be run as admin.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_command_to_run_as_admin();
Код Auto::is_command_to_run_as_admin() Auto::is command to run as admin WP-CLI 2.8.0-alpha
private function is_command_to_run_as_admin() { $command = WP_CLI::get_runner()->arguments; foreach ( self::COMMANDS_TO_RUN_AS_ADMIN as $command_to_run_as_admin ) { if ( array_slice( $command, 0, count( $command_to_run_as_admin ) ) === $command_to_run_as_admin ) { WP_CLI::debug( 'Detected a command to be intercepted: ' . implode( ' ', $command ), Context::DEBUG_GROUP ); return true; } } return false; }