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.


commands/pm/, line 720
The drush Package Manager


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

  drush_include_engine('drupal', 'environment');
  $module_info = drush_get_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_set_error('DRUSH_PM_ENABLE_MODULE_NOT_FOUND', dt('Module !module was not found and will not be uninstalled.', array('!module' => $module)));
    else if ($module_info[$module]->status) {
      // The module is enabled.
      drush_set_error('DRUSH_PM_UNINSTALL_ACTIVE_MODULE', dt('!module is not disabled. Use `pm-disable` command before `pm-uninstall`.', array('!module' => $module)));
    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');

  // 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_log(dt('Aborting.'));

  // Disable the modules.

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