Issue #986888 by bfroehle, bdone, grwgreg: Fixed Undefined index warning in 'Available Updates List' with hidden=TRUE base themes.
parent
ccb9c924b0
commit
59bd679e79
|
@ -262,6 +262,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.
|
* Makes sure that if we fetch from a broken URL, sane things happen.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -80,16 +80,17 @@ function update_get_projects() {
|
||||||
/**
|
/**
|
||||||
* Populates an array of project data.
|
* Populates an array of project data.
|
||||||
*
|
*
|
||||||
* This iterates over a list of the installed modules or themes and groups them
|
* This iterates over a list of the installed modules or themes and groups
|
||||||
* by project and status. A few parts of this function assume that enabled
|
* them by project and status. A few parts of this function assume that
|
||||||
* modules and themes are always processed first, and if disabled modules or
|
* enabled modules and themes are always processed first, and if disabled
|
||||||
* themes are being processed (there is a setting to control if disabled code
|
* modules or themes are being processed (there is a setting to control if
|
||||||
* should be included or not in the 'Available updates' report), those are only
|
* disabled code should be included in the Available updates report or not),
|
||||||
* processed after $projects has been populated with information about the
|
* those are only processed after $projects has been populated with
|
||||||
* enabled code. Modules and themes set as hidden are always ignored. This
|
* information about the enabled code. 'Hidden' modules are always ignored.
|
||||||
* function also records the latest change time on the .info files for each
|
* 'Hidden' themes are ignored only if they have no enabled sub-themes.
|
||||||
* module or theme, which is important data which is used when deciding if the
|
* This function also records the latest change time on the .info
|
||||||
* cached available update data should be invalidated.
|
* 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
|
* @param $projects
|
||||||
* Reference to the array of project data of what's installed on this site.
|
* 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()) {
|
function update_process_info_list(&$projects, $list, $project_type, $status, $additional_whitelist = array()) {
|
||||||
foreach ($list as $file) {
|
foreach ($list as $file) {
|
||||||
// A disabled base theme of an enabled sub-theme still has all of its code
|
// A disabled or hidden base theme of an enabled sub-theme still has all
|
||||||
// run by the sub-theme, so we include it in our "enabled" projects list.
|
// of its code run by the sub-theme, so we include it in our "enabled"
|
||||||
if ($status && !$file->status && !empty($file->sub_themes)) {
|
// projects list.
|
||||||
|
if ($status && !empty($file->sub_themes)) {
|
||||||
foreach ($file->sub_themes as $key => $name) {
|
foreach ($file->sub_themes as $key => $name) {
|
||||||
// Build a list of enabled sub-themes.
|
// Build a list of enabled sub-themes.
|
||||||
if ($list[$key]->status) {
|
if ($list[$key]->status) {
|
||||||
$file->enabled_sub_themes[$key] = $name;
|
$file->enabled_sub_themes[$key] = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If there are no enabled subthemes, we should ignore this base theme
|
// If the theme is disabled and there are no enabled subthemes, we
|
||||||
// for the enabled case. If the site is trying to display disabled
|
// should ignore this base theme for the enabled case. If the site is
|
||||||
// themes, we'll catch it then.
|
// trying to display disabled themes, we'll catch it then.
|
||||||
if (empty($file->enabled_sub_themes)) {
|
if (!$file->status && empty($file->enabled_sub_themes)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +136,8 @@ function update_process_info_list(&$projects, $list, $project_type, $status, $ad
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if it's a hidden module or theme.
|
// Skip if it's a hidden module or hidden theme without enabled sub-themes.
|
||||||
if (!empty($file->info['hidden'])) {
|
if (!empty($file->info['hidden']) && empty($file->enabled_sub_themes)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue