From c6200e83f52bf0aedf5d6fca7a1960ebdc5307be Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Wed, 29 Aug 2012 10:10:47 -0400 Subject: Issue #1036780 by Mike Wacker, tim.plunkett | cafuego: Enabled Drupal.org to collect stats on enabled sub-modules and core modules. --- modules/update/update.fetch.inc | 14 +++++++++++--- modules/update/update.test | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'modules/update') 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'."); -- cgit v1.2.3