summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcatch2013-02-15 12:33:11 +0000
committercatch2013-02-15 12:33:11 +0000
commit59bd679e790ecdaa3522a763141643024aa55360 (patch)
tree91dc01715c19469b1eb0b91726d7b4278d9d075c
parentccb9c924b0f5b69eb73e8389e82c2a56f63526ae (diff)
Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning in 'Available Updates List' with hidden=TRUE base themes.
-rw-r--r--core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php30
-rw-r--r--core/modules/update/update.compare.inc40
2 files changed, 51 insertions, 19 deletions
diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
index 2817c86..1fdd0b3 100644
--- a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
+++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php
@@ -263,6 +263,36 @@ class UpdateContribTest extends UpdateTestBase {
}
/**
+ * Tests updates with a hidden base theme.
+ */
+ function testUpdateHiddenBaseTheme() {
+ module_load_include('compare.inc', 'update');
+
+ // Enable the subtheme.
+ theme_enable(array('update_test_subtheme'));
+
+ // Add a project and initial state for base theme and subtheme.
+ $system_info = array(
+ // Hide the update_test_basetheme.
+ 'update_test_basetheme' => array(
+ 'project' => 'update_test_basetheme',
+ 'hidden' => TRUE,
+ ),
+ // Show the update_test_subtheme.
+ 'update_test_subtheme' => array(
+ 'project' => 'update_test_subtheme',
+ 'hidden' => FALSE,
+ ),
+ );
+ config('update_test.settings')->set('system_info', $system_info)->save();
+ $projects = update_get_projects();
+ $theme_data = system_rebuild_theme_data();
+ update_process_info_list($projects, $theme_data, 'theme', TRUE);
+
+ $this->assertTrue(!empty($projects['update_test_basetheme']), 'Valid base theme (update_test_basetheme) was found.');
+ }
+
+ /**
* Makes sure that if we fetch from a broken URL, sane things happen.
*/
function testUpdateBrokenFetchURL() {
diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc
index 59ce287..199f641 100644
--- a/core/modules/update/update.compare.inc
+++ b/core/modules/update/update.compare.inc
@@ -80,16 +80,17 @@ function update_get_projects() {
/**
* Populates an array of project data.
*
- * This iterates over a list of the installed modules or themes and groups them
- * by project and status. A few parts of this function assume that enabled
- * modules and themes are always processed first, and if disabled modules or
- * themes are being processed (there is a setting to control if disabled code
- * should be included or not in the 'Available updates' report), those are only
- * processed after $projects has been populated with information about the
- * enabled code. Modules and themes set as hidden are always ignored. This
- * function also records the latest change time on the .info files for each
- * module or theme, which is important data which is used when deciding if the
- * cached available update data should be invalidated.
+ * This iterates over a list of the installed modules or themes and groups
+ * them by project and status. A few parts of this function assume that
+ * enabled modules and themes are always processed first, and if disabled
+ * modules or themes are being processed (there is a setting to control if
+ * disabled code should be included in the Available updates report or not),
+ * those are only processed after $projects has been populated with
+ * information about the enabled code. 'Hidden' modules are always ignored.
+ * 'Hidden' themes are ignored only if they have no enabled sub-themes.
+ * This function also records the latest change time on the .info
+ * files for each module or theme, which is important data which is used when
+ * deciding if the cached available update data should be invalidated.
*
* @param $projects
* Reference to the array of project data of what's installed on this site.
@@ -108,19 +109,20 @@ function update_get_projects() {
*/
function update_process_info_list(&$projects, $list, $project_type, $status, $additional_whitelist = array()) {
foreach ($list as $file) {
- // A disabled base theme of an enabled sub-theme still has all of its code
- // run by the sub-theme, so we include it in our "enabled" projects list.
- if ($status && !$file->status && !empty($file->sub_themes)) {
+ // A disabled or hidden base theme of an enabled sub-theme still has all
+ // of its code run by the sub-theme, so we include it in our "enabled"
+ // projects list.
+ if ($status && !empty($file->sub_themes)) {
foreach ($file->sub_themes as $key => $name) {
// Build a list of enabled sub-themes.
if ($list[$key]->status) {
$file->enabled_sub_themes[$key] = $name;
}
}
- // If there are no enabled subthemes, we should ignore this base theme
- // for the enabled case. If the site is trying to display disabled
- // themes, we'll catch it then.
- if (empty($file->enabled_sub_themes)) {
+ // If the theme is disabled and there are no enabled subthemes, we
+ // should ignore this base theme for the enabled case. If the site is
+ // trying to display disabled themes, we'll catch it then.
+ if (!$file->status && empty($file->enabled_sub_themes)) {
continue;
}
}
@@ -134,8 +136,8 @@ function update_process_info_list(&$projects, $list, $project_type, $status, $ad
continue;
}
- // Skip if it's a hidden module or theme.
- if (!empty($file->info['hidden'])) {
+ // Skip if it's a hidden module or hidden theme without enabled sub-themes.
+ if (!empty($file->info['hidden']) && empty($file->enabled_sub_themes)) {
continue;
}