Commit 319f5ef9 authored by Dries's avatar Dries

- Patch #499828 by Dave Reid, Darren Oh, dww | Dries: fixed wrong release date...

- Patch #499828 by Dave Reid, Darren Oh, dww | Dries: fixed wrong release date on multi-module projects. Now with extra tests!
parent 2c154dc9
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
<title>Drupal</title>
<short_name>drupal</short_name>
<dc:creator>Drupal</dc:creator>
<api_version>7.x</api_version>
<recommended_major>7</recommended_major>
<supported_majors>7</supported_majors>
<default_major>7</default_major>
<project_status>published</project_status>
<link>http://example.com/project/drupal</link>
<terms>
<term><name>Projects</name><value>Drupal project</value></term>
</terms>
<releases>
<release>
<name>Drupal 7.0</name>
<version>7.0</version>
<tag>DRUPAL-7-0</tag>
<version_major>7</version_major>
<version_patch>0</version_patch>
<status>published</status>
<release_link>http://example.com/drupal-7-0-release</release_link>
<download_link>http://example.com/drupal-7-0.tar.gz</download_link>
<date>1250424521</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>1073741824</filesize>
<terms>
<term><name>Release type</name><value>New features</value></term>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
<release>
<name>Drupal 7.x-dev</name>
<version>7.x-dev</version>
<tag>DRUPAL-7</tag>
<version_major>7</version_major>
<version_extra>dev</version_extra>
<status>published</status>
<release_link>http://example.com/drupal-7-x-dev-release</release_link>
<download_link>http://example.com/drupal-7.x-dev.tar.gz</download_link>
<date>1250424581</date>
<mdhash>b966255555d9c9b86d480ca08cfaa98e</mdhash>
<filesize>2147483648</filesize>
<terms>
<term><name>Release type</name><value>Bug fixes</value></term>
</terms>
</release>
</releases>
</project>
......@@ -117,6 +117,10 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
$file->info['_info_file_ctime'] = filectime($info_filename);
}
if (!isset($file->info['datestamp'])) {
$file->info['datestamp'] = 0;
}
$project_name = $file->info['project'];
// Figure out what project type we're going to use to display this module
......@@ -139,7 +143,7 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
$projects[$project_name] = array(
'name' => $project_name,
'info' => $file->info,
'datestamp' => isset($file->info['datestamp']) ? $file->info['datestamp'] : 0,
'datestamp' => $file->info['datestamp'],
'includes' => array($file->name => $file->info['name']),
'project_type' => $project_display_type,
'project_status' => $status,
......@@ -153,6 +157,7 @@ function _update_process_info_list(&$projects, $list, $project_type, $status) {
// for disabled modules, too.
$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']);
$projects[$project_name]['datestamp'] = max($projects[$project_name]['datestamp'], $file->info['datestamp']);
}
elseif (empty($status)) {
// If we have a project_name that matches, but the project_display_type
......
......@@ -68,6 +68,30 @@ class UpdateTestCase extends DrupalWebTestCase {
$this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-2-release'), t('Link to release notes appears.'));
}
/**
* Ensure proper results where there are date mismatches among modules.
*/
function testDatestampMismatch() {
$system_info = array(
'#all' => array(
// We need to think we're running a -dev snapshot to see dates.
'version' => '7.0-dev',
'datestamp' => time(),
),
'block' => array(
// This is 2001-09-09 01:46:40 GMT, so test for "2001-Sep-".
'datestamp' => '1000000000',
),
);
variable_set('update_test_system_info', $system_info);
$this->refreshUpdateData('dev-snapshot.xml');
$this->drupalGet('admin/reports/updates');
$this->assertNoText(t('2001-Sep-'));
$this->assertText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertNoText(t('Security update required!'));
}
/**
* Helper function: force te update cache to refresh based on the contents of
* the specified XML file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment