--- system.module?rev=1.196 2005-03-05 19:41:38.000000000 +0100 +++ system.module 2005-03-06 02:56:09.000000000 +0100 @@ -456,7 +458,7 @@ function system_theme_listing() { */ function system_module_listing() { // Get current list of modules - $files = system_listing('\.module$', 'modules'); + $files = system_listing('\.module$', 'modules', 'name', 0); // Extract current files from database. system_get_files_database($files, 'module'); @@ -465,6 +467,8 @@ function system_module_listing() { $required = array('block', 'filter', 'system', 'user', 'watchdog'); $throttle_required = array_merge($required, array('throttle')); + $depends = module_invoke_all('depends'); + $edit = array(); $header = array(t('Name'), t('Description'), t('Enabled')); if (module_exist('throttle')) { @@ -486,15 +490,33 @@ function system_module_listing() { } } + if (!$file->status && in_array($file->name, $depends)) { + drupal_set_message(t('%module is switched on because other modules depend on it.', array ('%module' => $file->name)), 'error'); + $file->status = 1; + $edit['status'][$file->name] = $file->status; + } + // 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')); + if (!empty($edit)) { + $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'); + if (!empty($edit)) { + $edit['throttle'][$file->name] = $file->throttle; + } } $rows[] = $row; + + } + + if (!empty($edit)) { + $edit['type'] = 'module'; + system_listing_save($edit, t('Save configuration')); } $output = theme('table', $header, $rows); @@ -503,9 +525,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 +551,11 @@ 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.'); + if (!in_array($message, drupal_set_message())) { + drupal_set_message($message); + } + drupal_goto($_GET['q']); } } --- forum.module~ 2005-02-10 22:00:02.000000000 +0100 +++ forum.module 2005-03-06 01:29:30.000000000 +0100 @@ -25,6 +25,13 @@ function forum_help($section) { } /** + * Implementation of hook_depends(). + */ +function forum_depends() { + return 'comment'; +} + +/** * Implementation of hook_node_name(). */ function forum_node_name($node) {