function drush_command_belongs_to_disabled_module

6.x drush.php drush_command_belongs_to_disabled_module()
5.x drush.php drush_command_belongs_to_disabled_module()

Check if the given command belongs to a disabled module

Return value

Array with a command-like bootstrap error or FALSE if Drupal was not bootstrapped fully or the command does not belong to a diabled module.

1 call to drush_command_belongs_to_disabled_module()


./drush.php, line 148
drush is a PHP script implementing a command line shell for Drupal.


function drush_command_belongs_to_disabled_module() {
  if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
    $commands = drush_get_commands();
    $arguments = drush_get_arguments();
    $command_name = array_shift($arguments);
    if (isset($commands[$command_name])) {
      // We found it. Load its module name and set an error.
      if (is_array($commands[$command_name]['drupal dependencies']) && count($commands[$command_name]['drupal dependencies'])) {
        $modules = implode(', ', $commands[$command_name]['drupal dependencies']);
      else {
        // The command does not define Drupal dependencies. Derive them.
        $command_files = drush_get_context('DRUSH_COMMAND_FILES', array());
        $command_path = $commands[$command_name]['path'] . DIRECTORY_SEPARATOR . $commands[$command_name]['commandfile'] . '';
        $modules = array_search($command_path, $command_files);
      return array(
        'bootstrap_errors' => array(
          'DRUSH_COMMAND_DEPENDENCY_ERROR' => dt('Command !command needs the following module(s) enabled to run: !dependencies.', array('!command' => $command_name, '!dependencies' => $modules)),

  return FALSE;