summaryrefslogtreecommitdiff
path: root/modules/update
diff options
context:
space:
mode:
Diffstat (limited to 'modules/update')
-rw-r--r--modules/update/update.compare.inc5
-rw-r--r--modules/update/update.fetch.inc14
-rw-r--r--modules/update/update.test5
3 files changed, 19 insertions, 5 deletions
diff --git a/modules/update/update.compare.inc b/modules/update/update.compare.inc
index cd8b762d0..6e0c5feee 100644
--- a/modules/update/update.compare.inc
+++ b/modules/update/update.compare.inc
@@ -592,7 +592,10 @@ function update_calculate_project_update_status($project, &$project_data, $avail
// See if this is a higher major version than our target and yet still
// supported. If so, record it as an "Also available" release.
- if ($release['version_major'] > $target_major) {
+ // Note: some projects have a HEAD release from CVS days, which could
+ // be one of those being compared. They would not have version_major
+ // set, so we must call isset first.
+ if (isset($release['version_major']) && $release['version_major'] > $target_major) {
if (in_array($release['version_major'], $supported_majors)) {
if (!isset($project_data['also'])) {
$project_data['also'] = array();
diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc
index 860a1b975..bf0039f44 100644
--- a/modules/update/update.fetch.inc
+++ b/modules/update/update.fetch.inc
@@ -288,17 +288,25 @@ function _update_build_fetch_url($project, $site_key = '') {
$name = $project['name'];
$url = _update_get_fetch_url_base($project);
$url .= '/' . $name . '/' . DRUPAL_CORE_COMPATIBILITY;
- // Only append a site_key and the version information if we have a site_key
- // in the first place, and if this is not a disabled module or theme. We do
- // not want to record usage statistics for disabled code.
+
+ // Only append usage infomation if we have a site key and the project is
+ // enabled. We do not want to record usage statistics for disabled projects.
if (!empty($site_key) && (strpos($project['project_type'], 'disabled') === FALSE)) {
+ // Append the site key.
$url .= (strpos($url, '?') !== FALSE) ? '&' : '?';
$url .= 'site_key=';
$url .= rawurlencode($site_key);
+
+ // Append the version.
if (!empty($project['info']['version'])) {
$url .= '&version=';
$url .= rawurlencode($project['info']['version']);
}
+
+ // Append the list of modules or themes enabled.
+ $list = array_keys($project['includes']);
+ $url .= '&list=';
+ $url .= rawurlencode(implode(',', $list));
}
return $url;
}
diff --git a/modules/update/update.test b/modules/update/update.test
index e297194ae..b29f6ac86 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -769,6 +769,7 @@ class UpdateCoreUnitTestCase extends DrupalUnitTestCase {
$project['project_type'] = '';
$project['info']['version'] = '';
$project['info']['project status url'] = 'http://www.example.com';
+ $project['includes'] = array('module1' => 'Module 1', 'module2' => 'Module 2');
$site_key = '';
$expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$url = _update_build_fetch_url($project, $site_key);
@@ -785,14 +786,16 @@ class UpdateCoreUnitTestCase extends DrupalUnitTestCase {
$project['project_type'] = '';
$expected = 'http://www.example.com/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$expected .= '?site_key=site_key';
+ $expected .= '&list=' . rawurlencode('module1,module2');
$url = _update_build_fetch_url($project, $site_key);
$this->assertEqual($url, $expected, "When site_key provided, '$url' should be '$expected'.");
- // http://drupal.org/node/1481156 test incorrect logic when url contains
+ // http://drupal.org/node/1481156 test incorrect logic when URL contains
// a question mark.
$project['info']['project status url'] = 'http://www.example.com/?project=';
$expected = 'http://www.example.com/?project=/' . $project['name'] . '/' . DRUPAL_CORE_COMPATIBILITY;
$expected .= '&site_key=site_key';
+ $expected .= '&list=' . rawurlencode('module1,module2');
$url = _update_build_fetch_url($project, $site_key);
$this->assertEqual($url, $expected, "When ? is present, '$url' should be '$expected'.");