diff --git a/core/modules/update/src/Tests/UpdateTestBase.php b/core/modules/update/src/Tests/UpdateTestBase.php index 5fe09bb..c55dba0 100644 --- a/core/modules/update/src/Tests/UpdateTestBase.php +++ b/core/modules/update/src/Tests/UpdateTestBase.php @@ -65,7 +65,7 @@ protected function setUp() { * * @see Drupal\update_test\Controller\UpdateTestController::updateTest() */ - protected function refreshUpdateStatus(array $xml_map, $url = 'update-test') { + protected function refreshUpdateStatus($xml_map, $url = 'update-test') { // Tell the Update Manager module to fetch from the URL provided by // update_test module. $this->config('update.settings')->set('fetch.url', Url::fromUri('base:' . $url, array('absolute' => TRUE))->toString())->save(); diff --git a/core/modules/update/src/UpdateFetcher.php b/core/modules/update/src/UpdateFetcher.php index 88896d9..118d3a9 100644 --- a/core/modules/update/src/UpdateFetcher.php +++ b/core/modules/update/src/UpdateFetcher.php @@ -32,7 +32,7 @@ class UpdateFetcher implements UpdateFetcherInterface { protected $fetchUrl; /** - * The update settings. + * The update settings * * @var \Drupal\Core\Config\Config */ @@ -109,7 +109,7 @@ public function buildFetchUrl(array $project, $site_key = '') { /** * {@inheritdoc} */ - public function getFetchBaseUrl(array $project) { + public function getFetchBaseUrl($project) { if (isset($project['info']['project status url'])) { $url = $project['info']['project status url']; } diff --git a/core/modules/update/src/UpdateFetcherInterface.php b/core/modules/update/src/UpdateFetcherInterface.php index e936621..461a4c8 100644 --- a/core/modules/update/src/UpdateFetcherInterface.php +++ b/core/modules/update/src/UpdateFetcherInterface.php @@ -23,7 +23,7 @@ * not include the path elements to specify a particular project, version, * site_key, etc. */ - public function getFetchBaseUrl(array $project); + public function getFetchBaseUrl($project); /** * Retrieves the project information. diff --git a/core/modules/update/src/UpdateManager.php b/core/modules/update/src/UpdateManager.php index fdab65a..007b040 100644 --- a/core/modules/update/src/UpdateManager.php +++ b/core/modules/update/src/UpdateManager.php @@ -186,7 +186,7 @@ public function projectStorage($key) { /** * {@inheritdoc} */ - public function fetchDataBatch(array &$context) { + public function fetchDataBatch(&$context) { if (empty($context['sandbox']['max'])) { $context['finished'] = 0; $context['sandbox']['max'] = $this->updateProcessor->numberOfQueueItems(); diff --git a/core/modules/update/src/UpdateManagerInterface.php b/core/modules/update/src/UpdateManagerInterface.php index 3896559..c011bae 100644 --- a/core/modules/update/src/UpdateManagerInterface.php +++ b/core/modules/update/src/UpdateManagerInterface.php @@ -64,7 +64,7 @@ public function getProjects(); * @param array $context * Reference to an array used for Batch API storage. */ - public function fetchDataBatch(array &$context); + public function fetchDataBatch(&$context); /** * Clears out all the available update data and initiates re-fetching. diff --git a/core/modules/update/src/UpdateProcessor.php b/core/modules/update/src/UpdateProcessor.php index 38b2f6e..b5cf745 100644 --- a/core/modules/update/src/UpdateProcessor.php +++ b/core/modules/update/src/UpdateProcessor.php @@ -115,7 +115,7 @@ public function __construct(ConfigFactoryInterface $config_factory, QueueFactory /** * {@inheritdoc} */ - public function createFetchTask(array $project) { + public function createFetchTask($project) { if (empty($this->fetchTasks)) { $this->fetchTasks = $this->fetchTaskStore->getAll(); } @@ -140,7 +140,7 @@ public function fetchData() { /** * {@inheritdoc} */ - public function processFetchTask(array $project) { + public function processFetchTask($project) { global $base_url; // This can be in the middle of a long-running batch, so REQUEST_TIME won't @@ -266,7 +266,7 @@ public function claimQueueItem() { /** * {@inheritdoc} */ - public function deleteQueueItem(\stdClass $item) { + public function deleteQueueItem($item) { return $this->fetchQueue->deleteItem($item); } diff --git a/core/modules/update/src/UpdateProcessorInterface.php b/core/modules/update/src/UpdateProcessorInterface.php index 138f7cb..e2139c6 100644 --- a/core/modules/update/src/UpdateProcessorInterface.php +++ b/core/modules/update/src/UpdateProcessorInterface.php @@ -47,7 +47,7 @@ public function fetchData(); * @see \Drupal\update\UpdateProcessor::fetchData() * @see \Drupal\update\UpdateProcessor::processFetchTask() */ - public function createFetchTask(array $project); + public function createFetchTask($project); /** * Processes a task to fetch available update data for a single project. @@ -61,7 +61,7 @@ public function createFetchTask(array $project); * @return bool * TRUE if we fetched parsable XML, otherwise FALSE. */ - public function processFetchTask(array $project); + public function processFetchTask($project); /** * Retrieves the number of items in the update fetch queue. @@ -81,5 +81,5 @@ public function numberOfQueueItems(); * * @see \Drupal\Core\Queue\QueueInterface::deleteItem() */ - public function deleteQueueItem(\stdClass $item); + public function deleteQueueItem($item); } diff --git a/core/modules/update/tests/modules/update_test/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module index ac78780..f8de3cd 100644 --- a/core/modules/update/tests/modules/update_test/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -7,10 +7,6 @@ * Module for testing Update Manager functionality. */ -use Drupal\Core\Extension\Extension; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\BinaryFileResponse; - /** * Implements hook_system_info_alter(). * @@ -60,56 +56,6 @@ function update_test_update_status_alter(&$projects) { } /** - * Page callback: Prints mock XML for the Update Manager module. - * - * The specific XML file to print depends on two things: the project we're - * trying to fetch data for, and the desired "availability scenario" for that - * project which we're trying to test. Before attempting to fetch this data (by - * checking for updates on the available updates report), callers need to define - * the 'update_test_xml_map' variable as an array, keyed by project name, - * indicating which availability scenario to use for that project. - * - * @param string $project_name - * The project short name the update manager is trying to fetch data for (the - * fetch URLs are of the form: [base_url]/[project_name]/[core_version]). - * - * @return BinaryFileResponse|Response - * A BinaryFileResponse object containing the content of the XML release file - * for the specified project if one is available; a Response object with no - * content otherwise. - * - * @see update_test_menu() - * - * @deprecated \Drupal\update_test\Controller\UpdateTestController::updateTest() - */ -function update_test_mock_page($project_name) { - $xml_map = \Drupal::config('update_test.settings')->get('xml_map'); - if (isset($xml_map[$project_name])) { - $availability_scenario = $xml_map[$project_name]; - } - elseif (isset($xml_map['#all'])) { - $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 - // output. - $availability_scenario = '#broken#'; - } - - $path = drupal_get_path('module', 'update_test'); - $file = "$path/$project_name.$availability_scenario.xml"; - $headers = array('Content-Type' => 'text/xml; charset=utf-8'); - if (!is_file($file)) { - // Return an empty response. - return new Response('', 200, $headers); - } - return new BinaryFileResponse($file, 200, $headers); -} - -/** * Implements hook_filetransfer_info(). */ function update_test_filetransfer_info() { diff --git a/core/modules/update/tests/src/Unit/Menu/UpdateLocalTasksTest.php b/core/modules/update/tests/src/Unit/Menu/UpdateLocalTasksTest.php index cd92be9..7c1e17c 100644 --- a/core/modules/update/tests/src/Unit/Menu/UpdateLocalTasksTest.php +++ b/core/modules/update/tests/src/Unit/Menu/UpdateLocalTasksTest.php @@ -16,9 +16,6 @@ */ class UpdateLocalTasksTest extends LocalTaskIntegrationTestBase { - /** - * {@inheritdoc} - */ protected function setUp() { $this->directoryList = array('update' => 'core/modules/update'); parent::setUp(); diff --git a/core/modules/update/update.api.php b/core/modules/update/update.api.php index 92cabeb..9b6b262 100644 --- a/core/modules/update/update.api.php +++ b/core/modules/update/update.api.php @@ -34,7 +34,7 @@ * @see \Drupal\Update\UpdateManager::getProjects() * @see \Drupal\Core\Utility\ProjectInfo->processInfoList() */ -function hook_update_projects_alter(array &$projects) { +function hook_update_projects_alter(&$projects) { // Hide a site-specific module from the list. unset($projects['site_specific_module']); @@ -82,7 +82,7 @@ function hook_update_projects_alter(array &$projects) { * * @see update_calculate_project_data() */ -function hook_update_status_alter(array &$projects) { +function hook_update_status_alter(&$projects) { $settings = \Drupal::config('update_advanced.settings')->get('projects'); foreach ($projects as $project => $project_info) { if (isset($settings[$project]) && isset($settings[$project]['check']) && diff --git a/core/modules/update/update.authorize.inc b/core/modules/update/update.authorize.inc index 0662ea9..b77bfb2 100644 --- a/core/modules/update/update.authorize.inc +++ b/core/modules/update/update.authorize.inc @@ -35,7 +35,7 @@ * an instance of \Symfony\Component\HttpFoundation\Response the calling code * should use that response for the current page request. */ -function update_authorize_run_update(FileTransfer $filetransfer, array $projects) { +function update_authorize_run_update($filetransfer, $projects) { $operations = array(); foreach ($projects as $project_info) { $operations[] = array( @@ -90,7 +90,7 @@ function update_authorize_run_update(FileTransfer $filetransfer, array $projects * an instance of \Symfony\Component\HttpFoundation\Response the calling code * should use that response for the current page request. */ -function update_authorize_run_install(FileTransfer $filetransfer, $project, $updater_name, $local_url) { +function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) { $operations[] = array( 'update_authorize_batch_copy_project', array( @@ -138,7 +138,7 @@ function update_authorize_run_install(FileTransfer $filetransfer, $project, $upd * @param array $context * Reference to an array used for Batch API storage. */ -function update_authorize_batch_copy_project($project, $updater_name, $local_url, FileTransfer $filetransfer, array &$context) { +function update_authorize_batch_copy_project($project, $updater_name, $local_url, $filetransfer, &$context) { // Initialize some variables in the Batch API $context array. if (!isset($context['results']['log'])) { @@ -206,7 +206,7 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url * @param array $results * An associative array of results from the batch operation. */ -function update_authorize_update_batch_finished($success, array $results) { +function update_authorize_update_batch_finished($success, $results) { foreach ($results['log'] as $messages) { if (!empty($messages['#abort'])) { $success = FALSE; @@ -287,7 +287,7 @@ function update_authorize_update_batch_finished($success, array $results) { * @param array $results * An associative array of results from the batch operation. */ -function update_authorize_install_batch_finished($success, array $results) { +function update_authorize_install_batch_finished($success, $results) { foreach ($results['log'] as $messages) { if (!empty($messages['#abort'])) { $success = FALSE; @@ -345,7 +345,7 @@ function update_authorize_install_batch_finished($success, array $results) { * (optional) TRUE if the operation the message is about was a success, FALSE * if there were errors. Defaults to TRUE. */ -function _update_batch_create_message(array &$project_results, $message, $success = TRUE) { +function _update_batch_create_message(&$project_results, $message, $success = TRUE) { $project_results[] = array('message' => $message, 'success' => $success); } diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc index 7450104..5512e58 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -16,7 +16,7 @@ * Array of project information from * \Drupal\Update\UpdateManager::getProjects(). */ -function update_process_project_info(array &$projects) { +function update_process_project_info(&$projects) { foreach ($projects as $key => $project) { // Assume an official release until we see otherwise. $install_type = 'official'; @@ -80,7 +80,7 @@ function update_process_project_info(array &$projects) { * @see update_process_project_info() * @see \Drupal\update\UpdateManagerInterface::projectStorage() */ -function update_calculate_project_data(array $available) { +function update_calculate_project_data($available) { // Retrieve the projects from storage, if present. $projects = \Drupal::service('update.manager')->projectStorage('update_project_data'); // If $projects is empty, then the data must be rebuilt. @@ -170,7 +170,7 @@ function update_calculate_project_data(array $available) { * @param array $available * Data about available project releases of a specific project. */ -function update_calculate_project_update_status(array &$project_data, array $available) { +function update_calculate_project_update_status(&$project_data, $available) { foreach (array('title', 'link') as $attribute) { if (!isset($project_data[$attribute]) && isset($available[$attribute])) { $project_data[$attribute] = $available[$attribute]; diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index a710dd9..1b111e5 100644 --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -48,3 +48,4 @@ function _update_cron_notify() { } } } + diff --git a/core/modules/update/update.install b/core/modules/update/update.install index ca38b2b..ffaf35f 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -95,7 +95,7 @@ function update_uninstall() { * @see update_requirements() * @see update_calculate_project_data() */ -function _update_requirement_check(array $project, $type) { +function _update_requirement_check($project, $type) { $requirement = array(); if ($type == 'core') { $requirement['title'] = t('Drupal core update status'); diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index fec9118..89544a8 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -46,7 +46,7 @@ * @param array $results * An associative array of results from the batch operation. */ -function update_manager_download_batch_finished($success, array $results) { +function update_manager_download_batch_finished($success, $results) { if (!empty($results['errors'])) { $item_list = array( '#theme' => 'item_list', @@ -81,7 +81,7 @@ function update_manager_download_batch_finished($success, array $results) { * workflow, or FALSE if we've hit a fatal configuration and must halt the * workflow. */ -function _update_manager_check_backends(array &$form, $operation) { +function _update_manager_check_backends(&$form, $operation) { // If file transfers will be performed locally, we do not need to display any // warnings or notices to the user and should automatically continue the // workflow, since we won't be using a FileTransfer backend that requires @@ -146,7 +146,6 @@ function _update_manager_check_backends(array &$form, $operation) { * The Archiver object used to extract the archive. * * @throws Exception - * Was unable to extract the archive. */ function update_manager_archive_extract($file, $directory) { $archiver = archiver_get_archiver($file); @@ -242,7 +241,7 @@ function update_manager_file_get($url) { * * @see update_manager_download_page() */ -function update_manager_batch_project_get($project, $url, array &$context) { +function update_manager_batch_project_get($project, $url, &$context) { // This is here to show the user that we are in the process of downloading. if (!isset($context['sandbox']['started'])) { $context['sandbox']['started'] = TRUE; diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 437fb75..958a191 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -251,8 +251,7 @@ function update_themes_installed($themes) { /** * Implements hook_themes_uninstalled(). * - * If themes are uninstalled, we invalidate the information of available - * updates. + * If themes are uninstalled, we invalidate the information of available updates. */ function update_themes_uninstalled($themes) { // Clear all update module data. @@ -377,7 +376,7 @@ function update_get_available($refresh = FALSE) { * * @see \Drupal\update\UpdateFetcher::createFetchTask() */ -function update_create_fetch_task(array $project) { +function update_create_fetch_task($project) { \Drupal::service('update.processor')->createFetchTask($project); } @@ -407,7 +406,7 @@ function update_fetch_data() { * 'updated' which holds the total number of projects we fetched available * update data for. */ -function update_fetch_data_finished($success, array $results) { +function update_fetch_data_finished($success, $results) { if ($success) { if (!empty($results)) { if (!empty($results['updated'])) { @@ -442,7 +441,7 @@ function update_fetch_data_finished($success, array $results) { * @see _update_cron_notify() * @see _update_message_text() */ -function update_mail($key, array &$message, array $params) { +function update_mail($key, &$message, $params) { $langcode = $message['langcode']; $language = \Drupal::languageManager()->getLanguage($langcode); $message['subject'] .= t('New release(s) available for @site_name', array('@site_name' => \Drupal::config('system.site')->get('name')), array('langcode' => $langcode)); @@ -539,20 +538,8 @@ function _update_message_text($msg_type, $msg_reason, $langcode = NULL) { * Orders projects based on their status. * * Callback for uasort() within update_requirements(). - * - * @param array $a - * Associative array of information about a project. See update_get_projects() - * for the keys used. - * @param array $b - * Associative array of information about a project. See update_get_projects() - * for the keys used. - * - * @return int - * Callback return value for uasort(). - * - * @see update_requirements() */ -function _update_project_status_sort(array $a, array $b) { +function _update_project_status_sort($a, $b) { // The status constants are numerically in the right order, so we can // usually subtract the two to compare in the order we want. However, // negative status values should be treated as if they are huge, since we @@ -577,7 +564,7 @@ function _update_project_status_sort(array $a, array $b) { * * @see theme_update_report() */ -function template_preprocess_update_last_check(array &$variables) { +function template_preprocess_update_last_check(&$variables) { $variables['time'] = \Drupal::service('date.formatter')->formatTimeDiffSince($variables['last']); $variables['link'] = \Drupal::l(t('Check manually'), new Url('update.manual_status', array(), array('query' => \Drupal::destination()->getAsArray()))); } diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 540dd0f..c1b461d 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -18,7 +18,7 @@ * An associative array containing: * - data: An array of data about each project's status. */ -function template_preprocess_update_report(array &$variables) { +function template_preprocess_update_report(&$variables) { $data = $variables['data']; $last = \Drupal::state()->get('update.last_check') ?: 0; @@ -109,7 +109,7 @@ function template_preprocess_update_report(array &$variables) { * An associative array containing: * - project: An array of information about the project. */ -function template_preprocess_update_project_status(array &$variables) { +function template_preprocess_update_project_status(&$variables) { // Storing by reference because we are sorting the project values. $project = &$variables['project'];