WP_CLI\Bootstrap
LoadExecCommand{}
Class LoadExtraCommand.
Loads a command that was passed through the --exec=<php-code> option.
No Hooks.
Usage
$LoadExecCommand = new LoadExecCommand(); // use class methods
Methods
Notes
- Package: WP_CLI\Bootstrap
LoadExecCommand{} LoadExecCommand{} code WP-CLI 2.8.0-alpha
final class LoadExecCommand implements BootstrapStep { /** * Process this single bootstrapping step. * * @param BootstrapState $state Contextual state to pass into the step. * * @return BootstrapState Modified state to pass to the next step. */ public function process( BootstrapState $state ) { if ( $state->getValue( BootstrapState::IS_PROTECTED_COMMAND, false ) ) { return $state; } $runner = new RunnerInstance(); if ( ! isset( $runner()->config['exec'] ) ) { return $state; } foreach ( $runner()->config['exec'] as $php_code ) { eval( $php_code ); // phpcs:ignore Squiz.PHP.Eval.Discouraged } return $state; } }