--- /tmp/drupal/modules/system.module 2005-03-05 10:11:00.000000000 +0100 +++ system.module 2005-03-06 12:04:04.000000000 +0100 @@ -465,6 +467,7 @@ function system_module_listing() { $required = array('block', 'filter', 'system', 'user', 'watchdog'); $throttle_required = array_merge($required, array('throttle')); + $depends = module_invoke_all('info'); $header = array(t('Name'), t('Description'), t('Enabled')); if (module_exist('throttle')) { @@ -486,15 +489,29 @@ function system_module_listing() { } } + if (!$file->status && in_array($file->name, $depends)) { + drupal_set_message(t('%module is enabled because other modules depend on it.', array ('%module' => $file->name)), 'error'); + $file->status = 1; + $need_save = TRUE; + } + // Update the contents of the system table: db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, 'module'); db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap); $row = array($file->name, $file->description, array('data' => (in_array($file->name, $required) ? form_hidden("status][$file->name", 1) . t('required') : form_checkbox('', "status][$file->name", 1, $file->status)), 'align' => 'center')); + $edit['status'][$file->name] = $file->status; if (module_exist('throttle')) { $row[] = array('data' => (in_array($file->name, $throttle_required) ? form_hidden("throttle][$file->name", 0) . t('required') : form_checkbox(NULL, "throttle][$file->name", 1, $file->throttle, NULL)), 'align' => 'center'); + $edit['throttle'][$file->name] = $file->throttle; } $rows[] = $row; + + } + + if ($need_save) { + $edit['type'] = 'module'; + system_listing_save($edit, t('Save configuration')); } $output = theme('table', $header, $rows); @@ -503,9 +520,13 @@ function system_module_listing() { return $output; } -function system_listing_save($edit = array()) { - $op = $_POST['op']; - $edit = $_POST['edit']; +function system_listing_save($edit = array(), $op = '') { + if (empty($op)) { + $op = $_POST['op']; + } + if (empty($edit)) { + $edit = $_POST['edit']; + } if ($op == t('Save configuration')) { db_query("UPDATE {system} SET status = 0 WHERE type = '%s'", $edit['type']); @@ -525,7 +546,12 @@ function system_listing_save($edit = arr cache_clear_all(); menu_rebuild(); - drupal_set_message(t('The configuration options have been saved.')); + $message = t('The configuration options have been saved.'); + $messages = drupal_set_message(); + if (empty($messages) || !in_array($message, $messages['status'])) { + drupal_set_message($message); + } + drupal_goto($_GET['q']); } } --- /tmp/drupal/modules/forum.module 2005-03-03 21:51:27.000000000 +0100 +++ forum.module 2005-03-06 12:00:49.000000000 +0100 @@ -25,6 +25,14 @@ function forum_help($section) { } /** + * Implementation of hook_info(). + */ +function forum_info($key = 'depends') { + $info['depends'] = 'comment'; + return $info[$key]; +} + +/** * Implementation of hook_node_name(). */ function forum_node_name($node) {