summaryrefslogtreecommitdiff
path: root/modules/update
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2012-08-29 10:10:47 -0400
committerDavid Rothstein <drothstein@gmail.com>2012-08-29 10:10:47 -0400
commitc6200e83f52bf0aedf5d6fca7a1960ebdc5307be (patch)
treefb93ae3f6c71098c17bf066453102f7e3a40ba08 /modules/update
parent03c644b2ca3f22e96d0532df2d91d023cb2c54e6 (diff)
downloadbrdo-c6200e83f52bf0aedf5d6fca7a1960ebdc5307be.tar.gz
brdo-c6200e83f52bf0aedf5d6fca7a1960ebdc5307be.tar.bz2
Issue #1036780 by Mike Wacker, tim.plunkett | cafuego: Enabled Drupal.org to collect stats on enabled sub-modules and core modules.
Diffstat (limited to 'modules/update')
-rw-r--r--modules/update/update.fetch.inc14
-rw-r--r--modules/update/update.test3
2 files changed, 14 insertions, 3 deletions
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..3286afb4f 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,6 +786,7 @@ 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'.");
@@ -793,6 +795,7 @@ class UpdateCoreUnitTestCase extends DrupalUnitTestCase {
$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'.");