From 803fa69559b57921f5c35153f152e26f0704351b Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 5 Mar 2024 16:17:18 +0000 Subject: [PATCH] Issue #3414172 by quietone: In update module convert comments to use install/uninstall --- core/modules/update/src/Form/UpdateReady.php | 2 +- core/modules/update/src/UpdateFetcher.php | 5 +- core/modules/update/src/UpdateManager.php | 2 +- .../update/src/UpdateManagerInterface.php | 8 +-- core/modules/update/src/UpdateRoot.php | 2 +- .../src/Controller/UpdateTestController.php | 7 ++- .../src/Functional/UpdateContribTest.php | 4 +- .../tests/src/Functional/UpdateUploadTest.php | 2 +- .../tests/src/Kernel/UpdateReportTest.php | 4 +- .../tests/src/Unit/UpdateFetcherTest.php | 4 +- core/modules/update/update.api.php | 52 +++++++++---------- core/modules/update/update.install | 2 +- core/modules/update/update.module | 4 +- 13 files changed, 49 insertions(+), 49 deletions(-) diff --git a/core/modules/update/src/Form/UpdateReady.php b/core/modules/update/src/Form/UpdateReady.php index d8e5fdcc6498..779ad5b5a112 100644 --- a/core/modules/update/src/Form/UpdateReady.php +++ b/core/modules/update/src/Form/UpdateReady.php @@ -52,7 +52,7 @@ class UpdateReady extends FormBase { * @param string $root * The root location under which updated projects will be saved. * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The object that manages enabled modules in a Drupal installation. + * The object that manages installed modules in a Drupal installation. * @param \Drupal\Core\State\StateInterface $state * The state key value store. * @param string $site_path diff --git a/core/modules/update/src/UpdateFetcher.php b/core/modules/update/src/UpdateFetcher.php index 6a2c7372b6eb..ff6022676760 100644 --- a/core/modules/update/src/UpdateFetcher.php +++ b/core/modules/update/src/UpdateFetcher.php @@ -123,7 +123,8 @@ public function buildFetchUrl(array $project, $site_key = '') { $url .= '/' . $name . '/current'; // Only append usage information if we have a site key and the project is - // enabled. We do not want to record usage statistics for disabled projects. + // installed. We do not want to record usage statistics for uninstalled + // projects. if (!empty($site_key) && !str_contains($project['project_type'], 'disabled')) { // Append the site key. $url .= str_contains($url, '?') ? '&' : '?'; @@ -136,7 +137,7 @@ public function buildFetchUrl(array $project, $site_key = '') { $url .= rawurlencode($project['info']['version']); } - // Append the list of modules or themes enabled. + // Append the list of modules or themes installed. $list = array_keys($project['includes']); $url .= '&list='; $url .= rawurlencode(implode(',', $list)); diff --git a/core/modules/update/src/UpdateManager.php b/core/modules/update/src/UpdateManager.php index 287f421061f9..325bbc928c0a 100644 --- a/core/modules/update/src/UpdateManager.php +++ b/core/modules/update/src/UpdateManager.php @@ -42,7 +42,7 @@ class UpdateManager implements UpdateManagerInterface { protected $updateProcessor; /** - * An array of installed and enabled projects. + * An array of installed projects. * * @var array */ diff --git a/core/modules/update/src/UpdateManagerInterface.php b/core/modules/update/src/UpdateManagerInterface.php index 32eb34cbba8d..07dff3689cea 100644 --- a/core/modules/update/src/UpdateManagerInterface.php +++ b/core/modules/update/src/UpdateManagerInterface.php @@ -33,7 +33,7 @@ interface UpdateManagerInterface { const CURRENT = 5; /** - * Fetches an array of installed and enabled projects. + * Fetches an array of installed projects. * * This is only responsible for generating an array of projects (taking into * account projects that include more than one module or theme). Other @@ -51,7 +51,7 @@ interface UpdateManagerInterface { * automatically clear this data. * * @return array - * An associative array of currently enabled projects keyed by the + * An associative array of currently installed projects keyed by the * machine-readable project short name. Each project contains: * - name: The machine-readable project short name. * - info: An array with values from the main .info.yml file for this @@ -70,8 +70,8 @@ interface UpdateManagerInterface { * human-readable name as value. * - project_type: The type of project. Allowed values are 'module' and * 'theme'. - * - project_status: This indicates if the project is enabled and will - * always be TRUE, as the function only returns enabled projects. + * - project_status: This indicates if the project is installed and will + * always be TRUE, as the function only returns installed projects. * * @see update_process_project_info() * @see update_calculate_project_data() diff --git a/core/modules/update/src/UpdateRoot.php b/core/modules/update/src/UpdateRoot.php index bfb21de2a8a3..dcecd1cab4d9 100644 --- a/core/modules/update/src/UpdateRoot.php +++ b/core/modules/update/src/UpdateRoot.php @@ -78,7 +78,7 @@ public function __toString(): string { // the Update Manager to be tested) and also ensures that new project files // added there won't be visible to the parent site and will be properly // cleaned up once the test finishes running. This is done here (rather - // than having the tests enable a module which overrides the update root + // than having the tests install a module which overrides the update root // factory service) to ensure that the parent site is automatically kept // clean without relying on test authors to take any explicit steps. See // also \Drupal\update\Tests\Functional\UpdateTestBase::setUp(). diff --git a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php index a8d15dfd672b..179cbfbba41c 100644 --- a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php +++ b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php @@ -55,10 +55,9 @@ public function updateTest($project_name, $version) { $availability_scenario = $xml_map['#all']; } else { - // The test didn't specify (for example, the webroot has other modules and - // themes installed but they're disabled by the version of the site - // running the test. So, we default to a file we know won't exist, so at - // least we'll get an empty xml response instead of a bunch of Drupal page + // The test didn't specify a project nor '#all' (for all extensions on the + // system). So, we default to a file we know won't exist, so at least + // we'll get an empty xml response instead of a bunch of Drupal page // output. $availability_scenario = '#broken#'; } diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php index 70ce45ed557c..d96bba32b37b 100644 --- a/core/modules/update/tests/src/Functional/UpdateContribTest.php +++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php @@ -337,14 +337,14 @@ public function testNormalUpdateAvailable() { } /** - * Tests that disabled themes are only shown when desired. + * Tests that uninstalled themes are only shown when desired. * * @todo https://www.drupal.org/node/2338175 extensions can not be hidden and * base themes have to be installed. */ public function testUpdateShowDisabledThemes() { $update_settings = $this->config('update.settings'); - // Make sure all the update_test_* themes are disabled. + // Make sure all the update_test_* themes are uninstalled. $extension_config = $this->config('core.extension'); foreach ($extension_config->get('theme') as $theme => $weight) { if (str_starts_with($theme, 'update_test_')) { diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php index c3afd3127d61..00dbc0b2be3a 100644 --- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php +++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php @@ -120,7 +120,7 @@ public function testUploadModule() { $info = $info_parser->parse($installedInfoFilePath); $this->assertEquals('8.x-1.0', $info['version']); - // Enable the module. + // Install the module. $this->drupalGet('admin/modules'); $this->submitForm(['modules[update_test_new_module][enable]' => TRUE], 'Install'); diff --git a/core/modules/update/tests/src/Kernel/UpdateReportTest.php b/core/modules/update/tests/src/Kernel/UpdateReportTest.php index 3a6482829188..f3e175963375 100644 --- a/core/modules/update/tests/src/Kernel/UpdateReportTest.php +++ b/core/modules/update/tests/src/Kernel/UpdateReportTest.php @@ -60,7 +60,7 @@ public static function providerTemplatePreprocessUpdateReport() { } /** - * Tests the error message when failing to fetch data without dblog enabled. + * Tests the error message when failing to fetch data without dblog installed. * * @see template_preprocess_update_fetch_error_message() */ @@ -82,7 +82,7 @@ public function testTemplatePreprocessUpdateFetchErrorMessageNoDblog() { } /** - * Tests the error message when failing to fetch data with dblog enabled. + * Tests the error message when failing to fetch data with dblog installed. * * @see template_preprocess_update_fetch_error_message() */ diff --git a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php index 725da72fa053..58d4c68ed8e1 100644 --- a/core/modules/update/tests/src/Unit/UpdateFetcherTest.php +++ b/core/modules/update/tests/src/Unit/UpdateFetcherTest.php @@ -131,14 +131,14 @@ public static function providerTestUpdateBuildFetchUrl() { $data[] = [$project, $site_key, $expected]; - // For disabled projects it shouldn't add the site key either. + // For uninstalled projects it shouldn't add the site key either. $site_key = 'site_key'; $project['project_type'] = 'disabled'; $expected = "http://www.example.com/{$project['name']}/current"; $data[] = [$project, $site_key, $expected]; - // For enabled projects, test adding the site key. + // For installed projects, test adding the site key. $project['project_type'] = ''; $expected = "http://www.example.com/{$project['name']}/current"; $expected .= '?site_key=site_key'; diff --git a/core/modules/update/update.api.php b/core/modules/update/update.api.php index ba8617df4f94..edc3f8ae83bf 100644 --- a/core/modules/update/update.api.php +++ b/core/modules/update/update.api.php @@ -18,20 +18,20 @@ * Most modules will never need to implement this hook. It is for advanced * interaction with the Update Manager module. The primary use-case for this * hook is to add projects to the list; for example, to provide update status - * data on disabled modules and themes. A contributed module might want to hide - * projects from the list; for example, if there is a site-specific module that - * doesn't have any official releases, that module could remove itself from this - * list to avoid "No available releases found" warnings on the available updates - * report. In rare cases, a module might want to alter the data associated with - * a project already in the list. + * data on uninstalled modules and themes. A contributed module might want to + * hide projects from the list; for example, if there is a site-specific module + * that doesn't have any official releases, that module could remove itself from + * this list to avoid "No available releases found" warnings on the available + * updates report. In rare cases, a module might want to alter the data + * associated with a project already in the list. * * @param $projects * Reference to an array of the projects installed on the system. This * includes all the metadata documented in the comments below for each project - * (either module or theme) that is currently enabled. The array is initially - * populated inside \Drupal\update\UpdateManager::getProjects() with the help - * of \Drupal\Core\Utility\ProjectInfo->processInfoList(), so look there for - * examples of how to populate the array with real values. + * (either module or theme) that is currently installed. The array is + * initially populated inside \Drupal\update\UpdateManager::getProjects() with + * the help of \Drupal\Core\Utility\ProjectInfo->processInfoList(), so look + * there for examples of how to populate the array with real values. * * @see \Drupal\update\UpdateManager::getProjects() * @see \Drupal\Core\Utility\ProjectInfo::processInfoList() @@ -40,38 +40,38 @@ function hook_update_projects_alter(&$projects) { // Hide a site-specific module from the list. unset($projects['site_specific_module']); - // Add a disabled module to the list. + // Add an uninstalled module to the list. // The key for the array should be the machine-readable project "short name". - $projects['disabled_project_name'] = [ + $projects['uninstalled_project_name'] = [ // Machine-readable project short name (same as the array key above). - 'name' => 'disabled_project_name', + 'name' => 'uninstalled_project_name', // Array of values from the main .info.yml file for this project. 'info' => [ - 'name' => 'Some disabled module', - 'description' => 'A module not enabled on the site that you want to see in the available updates report.', + 'name' => 'Some uninstalled module', + 'description' => 'A module not installed on the site that you want to see in the available updates report.', 'version' => '8.x-1.0', 'core' => '8.x', // The maximum file change time (the "ctime" returned by the filectime() // PHP method) for all of the .info.yml files included in this project. '_info_file_ctime' => 1243888165, ], - // The date stamp when the project was released, if known. If the disabled - // project was an officially packaged release from drupal.org, this will - // be included in the .info.yml file as the 'datestamp' field. This only - // really matters for development snapshot releases that are regenerated, - // so it can be left undefined or set to 0 in most cases. + // The date stamp when the project was released, if known. If the + // uninstalled project was an officially packaged release from drupal.org, + // this will be included in the .info.yml file as the 'datestamp' field. + // This only really matters for development snapshot releases that are + // regenerated, so it can be left undefined or set to 0 in most cases. 'datestamp' => 1243888185, // Any modules (or themes) included in this project. Keyed by machine- // readable "short name", value is the human-readable project name printed // in the UI. 'includes' => [ - 'disabled_project' => 'Disabled module', - 'disabled_project_helper' => 'Disabled module helper module', - 'disabled_project_foo' => 'Disabled module foo add-on module', + 'uninstalled_project' => 'uninstalled module', + 'uninstalled_project_helper' => 'uninstalled module helper module', + 'uninstalled_project_foo' => 'uninstalled module foo add-on module', ], - // Does this project contain a 'module', 'theme', 'disabled-module', or - // 'disabled-theme'? - 'project_type' => 'disabled-module', + // Does this project contain a 'module', 'theme', 'uninstalled-module', or + // 'uninstalled-theme'? + 'project_type' => 'uninstalled-module', ]; } diff --git a/core/modules/update/update.install b/core/modules/update/update.install index b77654d62248..ea97be24d299 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -19,7 +19,7 @@ * there is no update data, only one record will be returned, indicating that * the status of core can't be determined. If data is available, there will be * two records: one for core, and another for all of contrib (assuming there - * are any contributed modules or themes enabled on the site). In addition to + * are any contributed modules or themes installed on the site). In addition to * the fields expected by hook_requirements ('value', 'severity', and * optionally 'description'), this array will contain a 'reason' attribute, * which is an integer constant to indicate why the given status is being diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 194ec642aec2..e1ed9d852aca 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -251,8 +251,8 @@ function _update_no_data() { /** * Tries to get update information and refreshes it when necessary. * - * In addition to checking the lifetime, this function also ensures that - * there are no .info.yml files for enabled modules or themes that have a newer + * In addition to checking the lifetime, this function also ensures that there + * are no .info.yml files for installed modules or themes that have a newer * modification timestamp than the last time we checked for available update * data. If any .info.yml file was modified, it almost certainly means a new * version of something was installed. Without fresh available update data, the -- GitLab