You are here

function drush_unused_modules_show_modules in Unused Modules 6

Same name and namespace in other branches
  1. 8 unused_modules.drush.inc \drush_unused_modules_show_modules()
  2. 7 unused_modules.drush.inc \drush_unused_modules_show_modules()

Drush callback.

Prints a table with orphaned modules.

Parameters

string $op: Either 'all' or 'disabled'.

Return value

string themed table.

1 call to drush_unused_modules_show_modules()
drush_unused_modules in ./unused_modules.drush.inc
Drush command callback.

File

./unused_modules.drush.inc, line 137
Drush implementation for the unused_modules module.

Code

function drush_unused_modules_show_modules($op = 'all') {
  $modules = _unused_modules_get_modules_by_project();
  $header = array(
    'Project',
    'Module',
    'Module enabled',
    'Project has Enabled Modules',
    'Project Path',
  );

  // With Drush, the first row is the header.
  $rows = array();
  $rows[] = $header;
  foreach ($modules as $module) {
    if ($op == 'all') {
      $rows[$module->name] = array(
        $module->project,
        $module->name,
        $module->module_is_enabled ? t("Yes") : t("No"),
        $module->project_has_enabled_modules ? t("Yes") : t("No"),
        $module->project_path,
      );
    }
    elseif ($op == 'disabled') {
      if (!$module->project_has_enabled_modules) {
        $rows[$module->name] = array(
          $module->project,
          $module->name,
          $module->module_is_enabled ? t("Yes") : t("No"),
          $module->project_has_enabled_modules ? t("Yes") : t("No"),
          $module->project_path,
        );
      }
    }
  }
  if (!$rows) {
    drush_print("Hurray, no orphaned modules!");
  }
  drush_print_table($rows, TRUE);
}