function drush_pm_uninstall

8.0.x drush_pm_uninstall()
6.x drush_pm_uninstall()
7.x drush_pm_uninstall()
3.x drush_pm_uninstall()
4.x drush_pm_uninstall()
5.x drush_pm_uninstall()
master drush_pm_uninstall()

Command callback. Uninstall one or more modules. // TODO: Use drupal_execute on system_modules_uninstall_confirm_form so that input is validated.

1 string reference to 'drush_pm_uninstall'
drush_upgrade_site_upgrade_prepare in commands/core/
Prepare to upgrade; the first step is to disable all contrib modules.


commands/pm/, line 1038
The drush Project Manager


function drush_pm_uninstall() {
  $modules = _convert_csv_to_array(func_get_args());

  drush_include_engine('drupal', 'environment');
  $module_info = drush_get_modules();
  $required = drupal_required_modules();

  // Discards modules which are enabled, not found or already uninstalled.
  foreach ($modules as $key => $module) {
    if (!isset($module_info[$module])) {
      // The module does not exist in the system.
      drush_log(dt('Module !module was not found and will not be uninstalled.', array('!module' => $module)), 'warning');
    else if ($module_info[$module]->status) {
      // The module is enabled.
      drush_log(dt('!module is not disabled. Use `pm-disable` command before `pm-uninstall`.', array('!module' => $module)), 'warning');
    else if ($module_info[$module]->schema_version == -1) { // SCHEMA_UNINSTALLED
      // The module is uninstalled.
      drush_log(dt('!module is already uninstalled.', array('!module' => $module)), 'ok');
    else {
      $dependents = array();
      foreach (drush_module_dependents(array($module), $module_info) as $dependent) {
        if (!in_array($dependent, $required) && ($module_info[$dependent]->schema_version != -1)) {
          $dependents[] = $dependent;
      if (count($dependents)) {
        drush_log(dt('To uninstall !module, the following modules must be uninstalled first: !required', array('!module' => $module, '!required' => implode(', ', $dependents))), 'error');

  // Inform the user which modules will finally be uninstalled.
  if (empty($modules)) {
    return drush_log(dt('There were no modules that could be uninstalled.'), 'ok');
  else {
    drush_print(dt('The following modules will be uninstalled: !modules', array('!modules' => implode(', ', $modules))));
    if (!drush_confirm(dt('Do you really want to continue?'))) {
      return drush_user_abort();

  // Disable the modules.

  // Inform the user of final status.
  foreach ($modules as $module) {
    drush_log(dt('!module was successfully uninstalled.', array('!module' => $module)), 'ok');