Index: update_advanced.compare.inc =================================================================== RCS file: update_advanced.compare.inc diff -N update_advanced.compare.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ update_advanced.compare.inc 2 Apr 2008 13:41:01 -0000 @@ -0,0 +1,103 @@ +status)) { + // Skip disabled modules or themes. + continue; + } + + // Skip if the .info file is broken. + if (empty($file->info)) { + continue; + } + + // If the .info doesn't define the 'project', try to figure it out. + if (!isset($file->info['project'])) { + $file->info['project'] = update_get_project_name($file); + } + + // If we still don't know the 'project', give up. + if (empty($file->info['project'])) { + continue; + } + + // If we don't already know it, grab the change time on the .info file + // itself. Note: we need to use the ctime, not the mtime (modification + // time) since many (all?) tar implementations will go out of their way to + // set the mtime on the files it creates to the timestamps recorded in the + // tarball. We want to see the last time the file was changed on disk, + // which is left alone by tar and correctly set to the time the .info file + // was unpacked. + if (!isset($file->info['_info_file_ctime'])) { + $info_filename = dirname($file->filename) .'/'. $file->name .'.info'; + $file->info['_info_file_ctime'] = filectime($info_filename); + } + + $project_name = $file->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 or themes. + $projects[$project_name] = array( + 'name' => $project_name, + 'info' => $file->info, + 'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0, + 'includes' => array($file->name => $file->info['name']), + 'project_type' => $project_name == 'drupal' ? 'core' : (empty($file->status) ? 'disabled-'. $project_type : $project_type), + ); + } + else { + $projects[$project_name]['includes'][$file->name] = $file->info['name']; + $projects[$project_name]['info']['_info_file_ctime'] = max($projects[$project_name]['info']['_info_file_ctime'], $file->info['_info_file_ctime']); + } + } +} Index: update_advanced.fetch.inc =================================================================== RCS file: update_advanced.fetch.inc diff -N update_advanced.fetch.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ update_advanced.fetch.inc 2 Apr 2008 13:41:01 -0000 @@ -0,0 +1,20 @@ + $interval) { + // We build the project list cache before update module gets a chance. + module_load_include('inc', 'update_advanced', 'update_advanced.compare'); + update_advanced_get_projects(); + } +} + +/** + * Wrapper to load the include file and then refresh the release data. + */ +function update_advanced_refresh() { + // Build the project cache our way. + module_load_include('inc', 'update_advanced', 'update_advanced.compare'); + $projects = update_advanced_get_projects(); + // Refresh the release data. + $output = update_refresh(); + // update_refresh() deletes the cache, so we set the projects array into the cache table. + cache_set('update_project_projects', $projects, 'cache_update', time() + 3600); + return $output; +} Index: update_advanced.report.inc =================================================================== RCS file: update_advanced.report.inc diff -N update_advanced.report.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ update_advanced.report.inc 2 Apr 2008 13:41:01 -0000 @@ -0,0 +1,19 @@ + 'radios', + '#title' => t('What to check'), + '#default_value' => variable_get('update_advanced_projects', 'enabled'), + '#options' => array( + 'enabled' => t('Only enabled modules and themes.'), + 'all' => t('All modules and themes.'), + ), + '#description' => t('Select whether drupal should check for updates of disabled modules and themes.'), + ); + $values = variable_get('update_advanced_project_settings', array()); $form['update_advanced_project_settings'] = array('#tree' => TRUE); @@ -77,6 +88,7 @@ function theme_update_advanced_settings( $output = ''; $output .= drupal_render($form['update_notify_emails']); $output .= drupal_render($form['update_check_frequency']); + $output .= drupal_render($form['update_advanced_projects']); $output .= drupal_render($form['update_notification_threshold']); $header = array( @@ -118,6 +130,8 @@ function theme_update_advanced_settings( 'core' => t('Drupal core'), 'module' => t('Modules'), 'theme' => t('Themes'), + 'disabled-module' => t('Disabled modules'), + 'disabled-theme' => t('Disabled themes'), ); foreach ($project_types as $type_name => $type_label) { if (!empty($rows[$type_name])) { @@ -155,5 +169,21 @@ function theme_update_advanced_settings( function update_advanced_settings_submit($form, &$form_state) { unset($form_state['values']['data']); unset($form_state['values']['available']); + + if ($form_state['values']['op'] == t('Reset to defaults')) { + if (variable_get('update_advanced_projects', 'enabled') != 'enabled') { + // If the setting is changed, rebuild the update cache. + update_advanced_refresh(); + } + variable_del('update_advanced_projects'); + } + else { + if (variable_get('update_advanced_projects', 'enabled') != $form_state['update_advanced_projects']) { + // If the setting is changed, rebuild the update cache. + update_advanced_refresh(); + } + variable_set('update_advanced_projects', $form_state['update_advanced_projects']); + } + return update_settings_submit($form, $form_state); }