Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.328 diff -u -r1.328 system.admin.inc --- modules/system/system.admin.inc 13 Jan 2011 01:08:28 -0000 1.328 +++ modules/system/system.admin.inc 8 Feb 2011 02:31:35 -0000 @@ -1334,6 +1334,65 @@ } } +function system_themes_uninstall ($form, $form_state = NULL) { + // Make sure the install API is available. + include_once DRUPAL_ROOT . '/includes/install.inc'; + + // Display the confirm form if any modules have been submitted. + if (!empty($form_state['storage']) && $confirm_form = system_modules_uninstall_confirm_form($form_state['storage'])) { + return $confirm_form; + } + + $all_themes = list_themes(); + $disabled_themes = array(); + foreach ($all_themes as $name => $theme) { + if (empty($theme->status)) { + $disabled_themes[$name] = $theme; + } + } + + // Only build the rest of the form if there are any modules available to + // uninstall. + if (!empty($disabled_modules)) { + + $profile = drupal_get_profile(); + uasort($disabled_modules, 'system_sort_modules_by_info_name'); + $form['uninstall'] = array('#tree' => TRUE); + foreach ($disabled_modules as $module) { + $module_name = $module->info['name'] ? $module->info['name'] : $module->name; + $form['modules'][$module->name]['#module_name'] = $module_name; + $form['modules'][$module->name]['name']['#markup'] = $module_name; + $form['modules'][$module->name]['description']['#markup'] = t($module->info['description']); + $form['uninstall'][$module->name] = array( + '#type' => 'checkbox', + '#title' => t('Uninstall @module module', array('@module' => $module_name)), + '#title_display' => 'invisible', + ); + // All modules which depend on this one must be uninstalled first, before + // we can allow this module to be uninstalled. (The install profile is + // excluded from this list.) + foreach (array_keys($module->required_by) as $dependent) { + if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) { + $dependent_name = isset($all_modules[$dependent]->info['name']) ? $all_modules[$dependent]->info['name'] : $dependent; + $form['modules'][$module->name]['#required_by'][] = $dependent_name; + $form['uninstall'][$module->name]['#disabled'] = TRUE; + } + } + } + $form['actions'] = array('#type' => 'actions'); + $form['actions']['submit'] = array( + '#type' => 'submit', + '#value' => t('Uninstall'), + ); + $form['#action'] = url('admin/modules/uninstall/confirm'); + } + else { + $form['modules'] = array(); + } + + return $form; +} + /** * Menu callback. Display blocked IP addresses. * Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.1003 diff -u -r1.1003 system.module --- modules/system/system.module 4 Jan 2011 00:56:23 -0000 1.1003 +++ modules/system/system.module 8 Feb 2011 02:31:36 -0000 @@ -169,6 +169,10 @@ 'render element' => 'form', 'file' => 'system.admin.inc', ), + 'system_appearance_uninstall' => array( + 'render element' => 'form', + 'file' => 'system.admin.inc', + ), 'status_report' => array( 'render element' => 'requirements', 'file' => 'system.admin.inc', @@ -612,6 +616,14 @@ 'type' => MENU_CALLBACK, 'file' => 'system.admin.inc', ); + $items['admin/appearance/uninstall'] = array( + 'title' => 'Uninstall', + 'page arguments' => array('system_appearance_uninstall'), + 'access arguments' => array('administer themes'), + 'type' => MENU_LOCAL_TASK, + 'file' => 'system.admin.inc', + 'weight' => 20 + ); $items['admin/appearance/default'] = array( 'title' => 'Set default theme', 'page callback' => 'system_theme_default',