diff options
author | David Rothstein <drothstein@gmail.com> | 2012-08-29 10:10:47 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2012-08-29 10:10:47 -0400 |
commit | c6200e83f52bf0aedf5d6fca7a1960ebdc5307be (patch) | |
tree | fb93ae3f6c71098c17bf066453102f7e3a40ba08 | |
parent | 03c644b2ca3f22e96d0532df2d91d023cb2c54e6 (diff) | |
download | brdo-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.
-rw-r--r-- | CHANGELOG.txt | 3 | ||||
-rw-r--r-- | modules/update/update.fetch.inc | 14 | ||||
-rw-r--r-- | modules/update/update.test | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 878a65ffb..4f58527e2 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,9 @@ Drupal 7.16, xxxx-xx-xx (development version) ----------------------- +- Modified the Update manager module to allow drupal.org to collect usage + statistics for individual modules and themes, rather than only for entire + projects. - Fixed a regression which caused a "call to undefined function drupal_find_base_themes()" fatal error under rare circumstances. 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'."); |