summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2009-09-27 00:15:28 (GMT)
committerDries Buytaert2009-09-27 00:15:28 (GMT)
commit319f5ef91bc07a2a2e1f34ee6dbaada4cad3ca80 (patch)
tree5d301ab859d8dc60dba11afcfeade9e8c4944d38
parent2c154dc986c6aa8e3d89ef0cf68485b2186c1013 (diff)
- Patch #499828 by Dave Reid, Darren Oh, dww | Dries: fixed wrong release date on multi-module projects. Now with extra tests!
-rw-r--r--modules/update/tests/dev-snapshot.xml50
-rw-r--r--modules/update/update.compare.inc7
-rw-r--r--modules/update/update.test24
3 files changed, 80 insertions, 1 deletions
diff --git a/modules/update/tests/dev-snapshot.xml b/modules/update/tests/dev-snapshot.xml
new file mode 100644
index 0000000..49dcc3f
--- /dev/null
+++ b/modules/update/tests/dev-snapshot.xml
@@ -0,0 +1,50 @@
+<?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>
diff --git a/modules/update/update.compare.inc b/modules/update/update.compare.inc
index e800a16..764c42c 100644
--- a/modules/update/update.compare.inc
+++ b/modules/update/update.compare.inc
@@ -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
diff --git a/modules/update/update.test b/modules/update/update.test
index 3ce3250..79fb912 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -69,6 +69,30 @@ class UpdateTestCase extends DrupalWebTestCase {
}
/**
+ * 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.
*