cvs diff: Diffing .
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 28 Sep 2009 21:16:28 -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.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.install,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 update_status.install
--- update_status.install 28 Sep 2009 18:20:59 -0000 1.1.2.8
+++ update_status.install 28 Sep 2009 21:16:28 -0000
@@ -39,6 +39,7 @@ function update_status_uninstall() {
'update_status_notification_threshold',
'update_status_last',
'update_status_fetch_url',
+ 'update_status_check_disabled',
);
foreach ($variables as $variable) {
variable_del($variable);
@@ -119,4 +120,3 @@ function update_status_update_5203() {
}
return $ret;
}
-
Index: update_status.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.module,v
retrieving revision 1.83.2.49
diff -u -p -r1.83.2.49 update_status.module
--- update_status.module 28 Sep 2009 21:03:18 -0000 1.83.2.49
+++ update_status.module 28 Sep 2009 21:16:29 -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 check for updates of disabled modules setting has been changed, attempted to refetch available update data.'));
+ 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,12 +723,27 @@ 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)) {
+ // 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);
@@ -720,19 +789,21 @@ function update_status_get_projects() {
$info['datestamp'] = 0;
}
- 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' => $info['datestamp'],
'modules' => array($file->name => $info['name']),
+ 'project_type' => $project_name == 'drupal' ? 'core' : $project_type,
);
}
- else {
- $projects[$info['project']]['modules'][$file->name] = $info['name'];
- $projects[$info['project']]['datestamp'] = max($projects[$info['project']]['datestamp'], $info['datestamp']);
+ elseif ($projects[$project_name]['project_type'] == $project_type) {
+ $projects[$project_name]['modules'][$file->name] = $info['name'];
+ $projects[$project_name]['datestamp'] = max($projects[$project_name]['datestamp'], $info['datestamp']);
}
}
asort($projects);
@@ -1258,9 +1329,6 @@ function theme_update_status_report($dat
return $output;
}
- // Move 'drupal' to the top.
- $data = array('drupal' => $data['drupal']) + $data;
-
$header = array();
$rows = array();
@@ -1408,13 +1476,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;
}
@@ -1466,7 +1547,7 @@ function update_status_refresh() {
// available release data, since even if we fail to fetch new data, we need
// to clear out the stale data at this point.
_update_status_cache_clear('update_status_available_releases');
-
+
$max_fetch_attempts = variable_get('update_status_max_fetch_attempts', UPDATE_STATUS_MAX_FETCH_ATTEMPTS);
foreach ($projects as $key => $project) {
cvs diff: Diffing po