Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.324
diff -u -p -r1.324 filter.module
--- modules/filter/filter.module	26 Mar 2010 17:14:45 -0000	1.324
+++ modules/filter/filter.module	28 Mar 2010 17:15:02 -0000
@@ -1130,6 +1130,21 @@ function filter_filter_info() {
 }
 
 /**
+ * Implements hook_system_info_alter().
+ */
+function filter_system_info_alter(&$info, $file, $type) {
+  if ($type == 'module' && $file->name == 'filter') {
+    // If a module provides a filter which is currently being used in a text
+    // format, add it as a dependency for filter.module to prevent it being
+    // disabled.
+    $modules = db_query("SELECT module FROM {filter} WHERE status = 1 AND module <> 'filter'")->fetchCol();
+    foreach ($modules as $module) {
+      $info['dependencies'][] = $module;
+    }
+  }
+}
+
+/**
  * Settings callback for the HTML filter.
  */
 function _filter_html_settings($form, &$form_state, $filter, $format, $defaults) {
Index: modules/php/php.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.install,v
retrieving revision 1.17
diff -u -p -r1.17 php.install
--- modules/php/php.install	9 Jan 2010 23:03:21 -0000	1.17
+++ modules/php/php.install	28 Mar 2010 17:15:02 -0000
@@ -36,10 +36,3 @@ function php_enable() {
     drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/config/content/formats/' . $php_format->format))));
   }
 }
-
-/**
- * Implements hook_disable().
- */
-function php_disable() {
-  drupal_set_message(t('The PHP module has been disabled. Any existing content that was using the PHP filter will now be visible in plain text. This might pose a security risk by exposing sensitive information, if any, used in the PHP code.'));
-}
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.264
diff -u -p -r1.264 system.admin.inc
--- modules/system/system.admin.inc	28 Mar 2010 10:43:40 -0000	1.264
+++ modules/system/system.admin.inc	28 Mar 2010 17:15:02 -0000
@@ -834,7 +834,7 @@ function system_modules($form, $form_sta
   // Remove hidden modules from display list.
   foreach ($files as $filename => $file) {
     if (!empty($file->info['hidden']) || !empty($file->info['required'])) {
-      unset($files[$filename]);
+      $file->info['hidden'] = TRUE;
     }
   }
 
@@ -856,98 +856,100 @@ function system_modules($form, $form_sta
 
   // Iterate through each of the modules.
   foreach ($files as $filename => $module) {
-    $extra = array();
-    $extra['enabled'] = (bool) $module->status;
-    // If this module requires other modules, add them to the array.
-    foreach ($module->requires as $requires => $v) {
-      if (!isset($files[$requires])) {
-        $extra['requires'][$requires] = t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst($requires)));
-        $extra['disabled'] = TRUE;
-      }
-      else {
-        $requires_name = $files[$requires]->info['name'];
-        if ($incompatible_version = drupal_check_incompatibility($v, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $files[$requires]->info['version']))) {
-          $extra['requires'][$requires] = t('@module (<span class="admin-missing">incompatible with</span> version @version)', array(
-            '@module' => $requires_name . $incompatible_version,
-            '@version' => $files[$requires]->info['version'],
-          ));
+    if (empty($module->info['hidden'])) {
+      $extra = array();
+      $extra['enabled'] = (bool) $module->status;
+      // If this module requires other modules, add them to the array.
+      foreach ($module->requires as $requires => $v) {
+        if (!isset($files[$requires])) {
+          $extra['requires'][$requires] = t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst($requires)));
           $extra['disabled'] = TRUE;
         }
-        elseif ($files[$requires]->status) {
-          $extra['requires'][$requires] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $requires_name));
-        }
         else {
-          $extra['requires'][$requires] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $requires_name));
+          $requires_name = $files[$requires]->info['name'];
+          if ($incompatible_version = drupal_check_incompatibility($v, str_replace(DRUPAL_CORE_COMPATIBILITY . '-', '', $files[$requires]->info['version']))) {
+            $extra['requires'][$requires] = t('@module (<span class="admin-missing">incompatible with</span> version @version)', array(
+              '@module' => $requires_name . $incompatible_version,
+              '@version' => $files[$requires]->info['version'],
+            ));
+            $extra['disabled'] = TRUE;
+          }
+          elseif ($files[$requires]->status) {
+            $extra['requires'][$requires] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $requires_name));
+          }
+          else {
+            $extra['requires'][$requires] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $requires_name));
+          }
         }
       }
-    }
-    // Generate link for module's help page, if there is one.
-    if ($help_arg && $module->status && in_array($filename, module_implements('help'))) {
-      if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) {
-        $extra['links']['help'] = array(
-          '#type' => 'link',
-          '#title' => t('Help'),
-          '#href' => "admin/help/$filename",
-          '#options' => array('attributes' => array('class' =>  array('module-link', 'module-link-help'), 'title' => t('Help'))),
-        );
+      // Generate link for module's help page, if there is one.
+      if ($help_arg && $module->status && in_array($filename, module_implements('help'))) {
+        if (module_invoke($filename, 'help', "admin/help#$filename", $help_arg)) {
+          $extra['links']['help'] = array(
+            '#type' => 'link',
+            '#title' => t('Help'),
+            '#href' => "admin/help/$filename",
+            '#options' => array('attributes' => array('class' =>  array('module-link', 'module-link-help'), 'title' => t('Help'))),
+          );
+        }
       }
-    }
-    // Generate link for module's permission, if the user has access to it.
-    if ($module->status && user_access('administer permissions') && in_array($filename, module_implements('permission'))) {
-      $extra['links']['permissions'] = array(
-        '#type' => 'link',
-        '#title' => t('Permissions'),
-        '#href' => 'admin/people/permissions',
-        '#options' => array('fragment' => 'module-' . $filename, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => t('Configure permissions'))),
-      );
-    }
-    // Generate link for module's configuration page, if the module provides
-    // one.
-    if ($module->status && isset($module->info['configure'])) {
-      $configure_link = menu_get_item($module->info['configure']);
-      if ($configure_link['access']) {
-        $extra['links']['configure'] = array(
+      // Generate link for module's permission, if the user has access to it.
+      if ($module->status && user_access('administer permissions') && in_array($filename, module_implements('permission'))) {
+        $extra['links']['permissions'] = array(
           '#type' => 'link',
-          '#title' => t('Configure'),
-          '#href' => $configure_link['href'],
-          '#options' => array('attributes' => array('class' => array('module-link', 'module-link-configure'), 'title' => $configure_link['description'])),
+          '#title' => t('Permissions'),
+          '#href' => 'admin/people/permissions',
+          '#options' => array('fragment' => 'module-' . $filename, 'attributes' => array('class' => array('module-link', 'module-link-permissions'), 'title' => t('Configure permissions'))),
         );
       }
-    }
-
-    // Mark dependents disabled so the user cannot remove required modules.
-    $dependents = array();
-    // If this module is required by other modules, list those, and then make it
-    // impossible to disable this one.
-    foreach ($module->required_by as $required_by => $v) {
-      // Hidden modules are unset already.
-      if (isset($files[$required_by])) {
-        if ($files[$required_by]->status == 1) {
-          $extra['required_by'][] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $files[$required_by]->info['name']));
-          $extra['disabled'] = TRUE;
+      // Generate link for module's configuration page, if the module provides
+      // one.
+      if ($module->status && isset($module->info['configure'])) {
+        $configure_link = menu_get_item($module->info['configure']);
+        if ($configure_link['access']) {
+          $extra['links']['configure'] = array(
+            '#type' => 'link',
+            '#title' => t('Configure'),
+            '#href' => $configure_link['href'],
+            '#options' => array('attributes' => array('class' => array('module-link', 'module-link-configure'), 'title' => $configure_link['description'])),
+          );
         }
-        else {
-          $extra['required_by'][] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $files[$required_by]->info['name']));
+      }
+
+      // Mark dependents disabled so the user cannot remove required modules.
+      $dependents = array();
+      // If this module is required by other modules, list those, and then make it
+      // impossible to disable this one.
+      foreach ($module->required_by as $required_by => $v) {
+        // Hidden modules are unset already.
+        if (isset($files[$required_by])) {
+          if ($files[$required_by]->status == 1) {
+            $extra['required_by'][] = t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => $files[$required_by]->info['name']));
+            $extra['disabled'] = TRUE;
+          }
+          else {
+            $extra['required_by'][] = t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => $files[$required_by]->info['name']));
+          }
         }
       }
+      $form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra);
+    }
+    // Add basic information to the fieldsets.
+    foreach (element_children($form['modules']) as $package) {
+      $form['modules'][$package] += array(
+        '#type' => 'fieldset',
+        '#title' => t($package),
+        '#collapsible' => TRUE,
+        '#theme' => 'system_modules_fieldset',
+        '#header' => array(
+          array('data' => t('Enabled'), 'class' => array('checkbox')),
+          t('Name'),
+          t('Version'),
+          t('Description'),
+          array('data' => t('Operations'), 'colspan' => 3),
+        ),
+      );
     }
-    $form['modules'][$module->info['package']][$filename] = _system_modules_build_row($module->info, $extra);
-  }
-  // Add basic information to the fieldsets.
-  foreach (element_children($form['modules']) as $package) {
-    $form['modules'][$package] += array(
-      '#type' => 'fieldset',
-      '#title' => t($package),
-      '#collapsible' => TRUE,
-      '#theme' => 'system_modules_fieldset',
-      '#header' => array(
-        array('data' => t('Enabled'), 'class' => array('checkbox')),
-        t('Name'),
-        t('Version'),
-        t('Description'),
-        array('data' => t('Operations'), 'colspan' => 3),
-      ),
-    );
   }
 
   $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions')));
Index: modules/system/system.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.test,v
retrieving revision 1.117
diff -u -p -r1.117 system.test
--- modules/system/system.test	12 Mar 2010 14:33:02 -0000	1.117
+++ modules/system/system.test	28 Mar 2010 17:15:04 -0000
@@ -1107,14 +1107,8 @@ class SystemMainContentFallback extends 
    */
   function testMainContentFallback() {
     $edit = array();
-    // Disable the dashboard module, which depends on the block module.
-    $edit['modules[Core][dashboard][enable]'] = FALSE;
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
-    // Disable the block module.
-    $edit['modules[Core][block][enable]'] = FALSE;
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
+    module_disable(array('dashboard'));
+    module_disable(array('block'));
     module_list(TRUE);
     $this->assertFalse(module_exists('block'), t('Block module disabled.'));
 
@@ -1144,12 +1138,7 @@ class SystemMainContentFallback extends 
     $this->assertField('mail', t('User interface still available.'));
 
     // Enable the block module again.
-    $this->drupalLogin($this->admin_user);
-    $edit = array();
-    $edit['modules[Core][block][enable]'] = 'block';
-    $this->drupalPost('admin/modules', $edit, t('Save configuration'));
-    $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
-    module_list(TRUE);
+    module_enable(array('block'));
     $this->assertTrue(module_exists('block'), t('Block module re-enabled.'));
   }
 }
Index: profiles/standard/standard.profile
===================================================================
RCS file: /cvs/drupal/drupal/profiles/standard/standard.profile,v
retrieving revision 1.1
diff -u -p -r1.1 standard.profile
--- profiles/standard/standard.profile	4 Jan 2010 23:08:34 -0000	1.1
+++ profiles/standard/standard.profile	28 Mar 2010 17:15:04 -0000
@@ -12,3 +12,17 @@ function standard_form_alter(&$form, $fo
     $form['site_information']['site_name']['#default_value'] = $_SERVER['SERVER_NAME'];
   }
 }
+
+/**
+ * Implements hook_system_info_alter().
+ *
+ * The standard profile lists several modules as dependencies, however if these
+ * continue to be listed as dependencies on runtime, they can never be disabled.
+ * therefore remove all of them once the module is installed.
+ */
+function standard_system_info_alter(&$info, $file, $type) {
+  // Ensure this hook only runs after the installation process.
+  if ($type == 'profile' && $file->name == 'standard') {
+    $info['dependencies'] = array();
+  }
+}
