--- ../drupal/modules/system.module 2005-03-09 04:00:02.000000000 +0100 +++ modules/system.module 2005-03-13 21:17:34.000000000 +0100 @@ -467,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')) { @@ -488,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); @@ -505,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']); --- ../drupal/modules/forum.module 2005-03-09 16:00:01.000000000 +0100 +++ modules/forum.module 2005-03-13 21:16:53.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) { --- includes/bootstrap.inc 2005-01-09 16:00:01.000000000 +0100 +++ ../drupal/includes/bootstrap.inc 2005-03-13 21:12:32.000000000 +0100 @@ -610,7 +610,9 @@ function drupal_set_message($message = N $_SESSION['messages'][$type] = array(); } - $_SESSION['messages'][$type][] = $message; + if (!in_array($message, $_SESSION['messages'][$type])) { + $_SESSION['messages'][$type][] = $message; + } } return $_SESSION['messages'];