diff --git a/core/lib/Drupal/Core/Utility/ProjectInfo.php b/core/lib/Drupal/Core/Utility/ProjectInfo.php index 2b3ed46..89d50ad 100644 --- a/core/lib/Drupal/Core/Utility/ProjectInfo.php +++ b/core/lib/Drupal/Core/Utility/ProjectInfo.php @@ -19,9 +19,8 @@ class ProjectInfo { /** * Populates an array of project data. * - * @todo https://www.drupal.org/node/2338167 update class since extensions can - * no longer be hidden, enabled or disabled. Additionally, base themes have - * to be installed for sub themes to work. + * @todo https://www.drupal.org/node/2553909 update class since extensions can + * no longer be disabled. * * 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 @@ -29,10 +28,12 @@ class ProjectInfo { * 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.yml - * files for each module or theme, which is important data which is used when + * information about the enabled code. 'Hidden' modules and themes are + * ignored if they are not installed. 'Hidden' Modules and themes in the + * "Testing" package are ignored regardless of installation status. + * + * This function also records the latest change time on the .info.yml files + * for each module or theme, which is important data which is used when * deciding if the available update data should be invalidated. * * @param array $projects diff --git a/core/modules/update/src/Tests/UpdateContribTest.php b/core/modules/update/src/Tests/UpdateContribTest.php index 62fadd3..7fd6de5 100644 --- a/core/modules/update/src/Tests/UpdateContribTest.php +++ b/core/modules/update/src/Tests/UpdateContribTest.php @@ -66,6 +66,7 @@ function testNoReleasesAvailable() { * Tests the basic functionality of a contrib module on the status report. */ function testUpdateContribBasic() { + $project_link = \Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')); $system_info = array( '#all' => array( 'version' => '8.0.0', @@ -87,7 +88,30 @@ function testUpdateContribBasic() { $this->assertText(t('Up to date')); $this->assertRaw('

' . t('Modules') . '

'); $this->assertNoText(t('Update available')); - $this->assertRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project appears.'); + $this->assertRaw($project_link, 'Link to aaa_update_test project appears.'); + + // Since aaa_update_test is installed the fact it is hidden and in the + // Testing means it should not appear. + $system_info['aaa_update_test']['hidden'] = TRUE; + $this->config('update_test.settings')->set('system_info', $system_info)->save(); + $this->refreshUpdateStatus( + array( + 'drupal' => '0.0', + 'aaa_update_test' => '1_0', + ) + ); + $this->assertNoRaw($project_link, 'Link to aaa_update_test project does not appear.'); + + // A hidden and installed project not in the testing package should appear. + $system_info['aaa_update_test']['package'] = 'aaa_update_test'; + $this->config('update_test.settings')->set('system_info', $system_info)->save(); + $this->refreshUpdateStatus( + array( + 'drupal' => '0.0', + 'aaa_update_test' => '1_0', + ) + ); + $this->assertRaw($project_link, 'Link to aaa_update_test project appears.'); } /** diff --git a/core/modules/update/update.module b/core/modules/update/update.module index daf0676..a6ac805 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -183,7 +183,7 @@ function update_theme() { 'file' => 'update.report.inc', ), 'update_project_status' => array( - 'variables' => array('project' => array(), 'includes_status' => array()), + 'variables' => array('project' => array()), 'file' => 'update.report.inc', ), // We are using template instead of '#type' => 'table' here to keep markup diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 8bed1d2..6e1eacf 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -39,24 +39,12 @@ function template_preprocess_update_report(&$variables) { $variables['no_updates_message'] = _update_no_data(); } - $status = array(); - - // Create an array of status values keyed by module or theme name, since - // we'll need this while generating the report if we have to cross reference - // anything (e.g. subthemes which have base themes missing an update). - foreach ($data as $project) { - foreach ($project['includes'] as $key => $name) { - $status[$key] = $project['status']; - } - } - $rows = array(); foreach ($data as $project) { $project_status = array( '#theme' => 'update_project_status', '#project' => $project, - '#includes_status' => $status, ); // Build project rows. @@ -120,14 +108,10 @@ function template_preprocess_update_report(&$variables) { * @param array $variables * An associative array containing: * - project: An array of information about the project. - * - includes_status: An array of sub-project statuses where the keys are the - * shortnames of each project and the values are UPDATE_* integer constants - * as defined in update.module. */ function template_preprocess_update_project_status(&$variables) { // Storing by reference because we are sorting the project values. $project = &$variables['project']; - $includes_status = $variables['includes_status']; // Set the project title and URL. $variables['title'] = (isset($project['title'])) ? $project['title'] : $project['name'];