Index: update_status.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.css,v
retrieving revision 1.20.2.4
diff -u -p -r1.20.2.4 update_status.css
--- update_status.css 1 Jun 2009 19:52:28 -0000 1.20.2.4
+++ update_status.css 13 Jun 2009 05:00:39 -0000
@@ -109,6 +109,14 @@ table.update-status,
width: 12em;
}
+.update-status-settings tr.update-status-settings-label td.update-status-settings-label {
+ font-size: 75%;
+ font-weight: bold;
+ background: #ddd;
+ color: #666;
+ padding: 0 0 0 2em; /* LTR */
+}
+
.update-status .check-manually {
padding-left: 1em;
}
Index: update_status.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.module,v
retrieving revision 1.83.2.47
diff -u -p -r1.83.2.47 update_status.module
--- update_status.module 13 Jun 2009 03:09:20 -0000 1.83.2.47
+++ update_status.module 13 Jun 2009 05:00:40 -0000
@@ -167,6 +167,12 @@ function update_status_status() {
function update_status_settings() {
$form = array();
+ $form['update_status_check_disabled'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Check for updates of disabled modules'),
+ '#default_value' => variable_get('update_status_check_disabled', FALSE),
+ );
+
if ($available = update_status_get_available(TRUE)) {
$values = variable_get('update_status_settings', array());
$form['projects'] = array('#tree' => TRUE);
@@ -262,6 +268,7 @@ function theme_update_status_settings($f
$output .= drupal_render($form['notify_emails']);
$output .= drupal_render($form['check_frequency']);
$output .= drupal_render($form['notification_threshold']);
+ $output .= drupal_render($form['update_status_check_disabled']);
$header = array(
array('data' => t('Project'), 'class' => 'update-status-project'),
@@ -288,14 +295,37 @@ function theme_update_status_settings($f
'class' => 'update-status-notes',
'data' => drupal_render($form['projects'][$key]['notes']),
);
- $rows[] = $row;
+ if (!isset($rows[$project['project_type']])) {
+ $rows[$project['project_type']] = array();
+ }
+ $rows[$project['project_type']][] = $row;
}
}
- $output .= theme('table', $header, $rows, array('class' => 'update-status-settings'));
+ $split_rows = array();
+ $project_types = array(
+ 'core' => t('Drupal core'),
+ 'module' => t('Modules'),
+ 'disabled-module' => t('Disabled modules'),
+ );
+ foreach ($project_types as $type_name => $type_label) {
+ if (!empty($rows[$type_name])) {
+ $split_rows[] = array(
+ 'class' => 'update-status-settings-label',
+ 'data' => array(
+ array(
+ 'class' => 'update-status-settings-label',
+ 'data' => $type_label,
+ 'colspan' => 3,
+ ),
+ ),
+ );
+ $split_rows = array_merge($split_rows, $rows[$type_name]);
+ }
+ }
+ $output .= theme('table', $header, $split_rows, array('class' => 'update-status-settings'));
$output .= '
';
-
$output .= drupal_render($form);
return $output;
}
@@ -327,6 +357,20 @@ function update_status_settings_validate
}
}
+/**
+ * Submit callback handler for the update status settings tab.
+ *
+ * Saves all the settings to the database.
+ *
+ * Also invalidates the cache of available updates if the "Check for updates
+ * of disabled modules" setting is being changed. Both the advanced settings
+ * table and the available updates report need to refetch available update
+ * data after this setting changes or they're going to show misleading things
+ * (for example, listing all of the disabled projects on the site with the "No
+ * available releases found" warning).
+ *
+ * @see update_status_settings()
+ */
function update_status_settings_submit($form_id, $form_values) {
variable_set('update_status_check_frequency', $form_values['check_frequency']);
variable_set('update_status_notification_threshold', $form_values['notification_threshold']);
@@ -344,6 +388,16 @@ function update_status_settings_submit($
variable_set('update_status_notify_emails', $emails);
}
variable_set('update_status_settings', $form_values['projects']);
+
+ // See if the update_status_check_disabled setting is being enabled, and
+ // if so, invalidate all cached update status data.
+ $check_disabled = variable_get('update_status_check_disabled', FALSE);
+ if ($form_values['update_status_check_disabled'] != $check_disabled) {
+ drupal_set_message(t('The %update_advanced_check_disabled setting has been changed, attempted to refetch available update data.', array('%update_advanced_check_disabled' => t('Check for updates of disabled modules'))));
+ update_status_invalidate_cache();
+ }
+ variable_set('update_status_check_disabled', $form_values['update_status_check_disabled']);
+
drupal_set_message(t('Your changes have been saved.'));
}
@@ -669,15 +723,30 @@ function update_status_get_projects() {
// Extract current files from database.
system_get_files_database($files, 'module');
+ _update_status_process_info_list(&$projects, $files, 'module');
+ if (variable_get('update_status_check_disabled', FALSE)) {
+ _update_status_process_info_list(&$projects, $files, 'disabled-module');
+ }
- foreach ($files as $filename => $file) {
- // Skip not enabled modules.
- if (empty($file->status)) {
+ asort($projects);
+ // Allow other modules to alter projects before fetching and comparing.
+ foreach (module_implements('update_status_projects_alter') as $module) {
+ $function = $module .'_update_status_projects_alter';
+ $function($projects);
+ }
+ _update_status_cache_set('update_status_project_projects', serialize($projects), time() + (60 * 60));
+ return $projects;
+}
+
+function _update_status_process_info_list(&$projects, $list, $project_type) {
+ $module_target_status = $project_type == 'module' ? 1 : 0;
+ foreach ($list as $file) {
+ if ($file->status != $module_target_status) {
continue;
}
+
$info_filename = dirname($file->filename) .'/'. $file->name .'.info';
$file->info = _module_parse_info_file($info_filename);
-
// Skip if this is broken.
if (empty($file->info)) {
continue;
@@ -716,28 +785,22 @@ function update_status_get_projects() {
continue;
}
- if (!isset($projects[$info['project']])) {
+ $project_name = $info['project'];
+ if (!isset($projects[$project_name])) {
// Only process this if we haven't done this project, since a single
// project can have multiple modules.
- $projects[$info['project']] = array(
- 'name' => $info['project'],
+ $projects[$project_name] = array(
+ 'name' => $project_name,
'info' => $info,
'datestamp' => isset($info['datestamp']) ? $info['datestamp'] : 0,
'modules' => array($file->name => $info['name']),
+ 'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
);
}
- else {
- $projects[$info['project']]['modules'][$file->name] = $info['name'];
+ elseif ($projects[$project_name]['project_type'] == $project_type) {
+ $projects[$project_name]['modules'][$file->name] = $info['name'];
}
}
- asort($projects);
- // Allow other modules to alter projects before fetching and comparing.
- foreach (module_implements('update_status_projects_alter') as $module) {
- $function = $module .'_update_status_projects_alter';
- $function($projects);
- }
- _update_status_cache_set('update_status_project_projects', serialize($projects), time() + (60 * 60));
- return $projects;
}
/**
@@ -1253,9 +1316,6 @@ function theme_update_status_report($dat
return $output;
}
- // Move 'drupal' to the top.
- $data = array('drupal' => $data['drupal']) + $data;
-
$header = array();
$rows = array();
@@ -1403,13 +1463,26 @@ function theme_update_status_report($dat
$row .= "\n"; // info div.
- $rows[] = array(
+ if (!isset($rows[$project['project_type']])) {
+ $rows[$project['project_type']] = array();
+ }
+ $rows[$project['project_type']][] = array(
'class' => $class,
'data' => array($row),
);
}
- $output .= theme('table', $header, $rows, array('class' => 'update-status'));
+ $project_types = array(
+ 'core' => t('Drupal core'),
+ 'module' => t('Modules'),
+ 'disabled-module' => t('Disabled modules'),
+ );
+ foreach ($project_types as $type_name => $type_label) {
+ if (!empty($rows[$type_name])) {
+ $output .= "\n". $type_label ."
\n";
+ $output .= theme('table', $header, $rows[$type_name], array('class' => 'update-status'));
+ }
+ }
drupal_add_css(drupal_get_path('module', 'update_status') .'/update_status.css');
return $output;
}