PageRenderTime 49ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://github.com/saidiahd/wp-cli
PHP | 17 lines | 14 code | 3 blank | 0 comment | 3 complexity | 26e10696167782dd4136f58f5bd0bc35 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. WP_CLI::add_command( 'eval-file', function( $args, $assoc_args ) {
  3. if ( empty( $args ) ) {
  4. WP_CLI::line( "usage: wp eval-file <path>" );
  5. exit;
  6. }
  7. foreach ( $args as $file ) {
  8. if ( !file_exists( $file ) ) {
  9. WP_CLI::error( "'$file' does not exist." );
  10. } else {
  11. include( $file );
  12. }
  13. }
  14. } );