Skip to content

Commit

Permalink
Properly register command class
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber committed Mar 8, 2017
1 parent ceff62b commit fa12bf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
9 changes: 8 additions & 1 deletion media-command.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
require_once $autoload;
}

WP_CLI::add_command( 'media', 'Media_Command' );
WP_CLI::add_command( 'media', 'Media_Command', array(
'before_invoke' => function () {
if ( !wp_image_editor_supports() ) {
WP_CLI::error( 'No support for generating images found. ' .
'Please install the Imagick or GD PHP extensions.' );
}
}
) );
10 changes: 0 additions & 10 deletions src/Media_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,3 @@ private function needs_regeneration( $att_id, $fullsizepath ) {
return false;
}
}

WP_CLI::add_command( 'media', 'Media_Command', array(
'before_invoke' => function () {
if ( !wp_image_editor_supports() ) {
WP_CLI::error( 'No support for generating images found. ' .
'Please install the Imagick or GD PHP extensions.' );
}
}
) );

0 comments on commit fa12bf7

Please sign in to comment.