PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/src/php/wp-cli/commands/internals/eval-file.php

https://github.com/ericmann/wp-cli
PHP | 22 lines | 13 code | 4 blank | 5 comment | 2 complexity | ea232d9ef1b7c1d76db143793748dd86 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. WP_CLI::add_command( 'eval-file', new EvalFile_Command );
  3. class EvalFile_Command extends WP_CLI_Command {
  4. /**
  5. * Loads and executes a PHP file after loading WordPress.
  6. *
  7. * @synopsis <path>
  8. */
  9. public function __invoke( $args, $assoc_args ) {
  10. foreach ( $args as $file ) {
  11. if ( !file_exists( $file ) ) {
  12. WP_CLI::error( "'$file' does not exist." );
  13. } else {
  14. include( $file );
  15. }
  16. }
  17. }
  18. }