diff --git a/core/modules/update/update.api.php b/core/modules/update/update.api.php index b5c8120..720e04e 100644 --- a/core/modules/update/update.api.php +++ b/core/modules/update/update.api.php @@ -23,7 +23,7 @@ * report. In rare cases, a module might want to alter the data associated with * a project already in the list. * - * @param $projects + * @param array $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 @@ -34,7 +34,7 @@ * @see update_get_projects() * @see \Drupal\Core\Utility\ProjectInfo->processInfoList() */ -function hook_update_projects_alter(&$projects) { +function hook_update_projects_alter(array &$projects) { // Hide a site-specific module from the list. unset($projects['site_specific_module']); @@ -76,13 +76,13 @@ function hook_update_projects_alter(&$projects) { /** * Alter the information about available updates for projects. * - * @param $projects + * @param array $projects * Reference to an array of information about available updates to each * project installed on the system. * * @see update_calculate_project_data() */ -function hook_update_status_alter(&$projects) { +function hook_update_status_alter(array &$projects) { $settings = \Drupal::config('update_advanced.settings')->get('projects'); foreach ($projects as $project => $project_info) { if (isset($settings[$project]) && isset($settings[$project]['check']) && @@ -112,7 +112,7 @@ function hook_update_status_alter(&$projects) { * @param string $directory * The directory that the archive was extracted into. * - * @return + * @return array * If there are any problems, return an array of error messages. If there are * no problems, return an empty array. * diff --git a/core/modules/update/update.authorize.inc b/core/modules/update/update.authorize.inc index 8709e56..288de45 100644 --- a/core/modules/update/update.authorize.inc +++ b/core/modules/update/update.authorize.inc @@ -11,6 +11,7 @@ */ use Drupal\Core\Updater\UpdaterException; +use Drupal\Core\FileTransfer; /** * Updates existing projects when invoked by authorize.php. @@ -18,10 +19,10 @@ * Callback for system_authorized_init() in * update_manager_update_ready_form_submit(). * - * @param $filetransfer + * @param \Drupal\Core\FileTransfer $filetransfer * The FileTransfer object created by authorize.php for use during this * operation. - * @param $projects + * @param array $projects * A nested array of projects to install into the live webroot, keyed by * project name. Each subarray contains the following keys: * - project: The canonical project short name. @@ -29,7 +30,7 @@ * for this project. * - local_url: The locally installed location of new code to update with. */ -function update_authorize_run_update($filetransfer, $projects) { +function update_authorize_run_update(FileTransfer $filetransfer, array $projects) { $operations = array(); foreach ($projects as $project_info) { $operations[] = array( @@ -62,7 +63,7 @@ function update_authorize_run_update($filetransfer, $projects) { * Callback for system_authorized_init() in * update_manager_install_form_submit(). * - * @param FileTransfer $filetransfer + * @param \Drupal\Core\FileTransfer $filetransfer * The FileTransfer object created by authorize.php for use during this * operation. * @param string $project @@ -75,7 +76,7 @@ function update_authorize_run_update($filetransfer, $projects) { * The URL to the locally installed temp directory where the project has * already been downloaded and extracted into. */ -function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) { +function update_authorize_run_install(FileTransfer $filetransfer, $project, $updater_name, $local_url) { $operations[] = array( 'update_authorize_batch_copy_project', array( @@ -112,12 +113,12 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l * @param string $local_url * The URL to the locally installed temp directory where the project has * already been downloaded and extracted into. - * @param FileTransfer $filetransfer + * @param \Drupal\Core\FileTransfer $filetransfer * The FileTransfer object to use for performing this operation. * @param array $context * Reference to an array used for Batch API storage. */ -function update_authorize_batch_copy_project($project, $updater_name, $local_url, $filetransfer, &$context) { +function update_authorize_batch_copy_project($project, $updater_name, $local_url, FileTransfer $filetransfer, array &$context) { // Initialize some variables in the Batch API $context array. if (!isset($context['results']['log'])) { @@ -180,12 +181,12 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url * authorize.php will render a report. Also responsible for putting the site * back online and clearing the update status storage after a successful update. * - * @param $success + * @param bool $success * TRUE if the batch operation was successful; FALSE if there were errors. - * @param $results + * @param array $results * An associative array of results from the batch operation. */ -function update_authorize_update_batch_finished($success, $results) { +function update_authorize_update_batch_finished($success, array $results) { foreach ($results['log'] as $messages) { if (!empty($messages['#abort'])) { $success = FALSE; @@ -246,12 +247,12 @@ function update_authorize_update_batch_finished($success, $results) { * authorize.php will render a report. Also responsible for putting the site * back online after a successful install if necessary. * - * @param $success + * @param bool $success * TRUE if the batch operation was a success; FALSE if there were errors. - * @param $results + * @param array $results * An associative array of results from the batch operation. */ -function update_authorize_install_batch_finished($success, $results) { +function update_authorize_install_batch_finished($success, array $results) { foreach ($results['log'] as $messages) { if (!empty($messages['#abort'])) { $success = FALSE; @@ -308,7 +309,7 @@ function update_authorize_install_batch_finished($success, $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(&$project_results, $message, $success = TRUE) { +function _update_batch_create_message(array &$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 86f7244..f36d65d 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -23,7 +23,7 @@ * module or theme but do not visit certain pages that automatically clear this * data. * - * @return + * @return array * An associative array of currently enabled projects keyed by the * machine-readable project short name. Each project contains: * - name: The machine-readable project short name. @@ -64,10 +64,10 @@ function update_get_projects() { * installed versions, and other information that is required before we can * compare against the available releases to produce the status report. * - * @param $projects + * @param array $projects * Array of project information from update_get_projects(). */ -function update_process_project_info(&$projects) { +function update_process_project_info(array &$projects) { foreach ($projects as $key => $project) { // Assume an official release until we see otherwise. $install_type = 'official'; @@ -123,7 +123,7 @@ function update_process_project_info(&$projects) { * @param array $available * Data about available project releases. * - * @return + * @return array * An array of installed projects with current update status information. * * @see update_get_available() @@ -131,7 +131,7 @@ function update_process_project_info(&$projects) { * @see update_process_project_info() * @see update_project_storage() */ -function update_calculate_project_data($available) { +function update_calculate_project_data(array $available) { // Retrieve the projects from storage, if present. $projects = update_project_storage('update_project_data'); // If $projects is empty, then the data must be rebuilt. @@ -216,12 +216,12 @@ function update_calculate_project_data($available) { * version (e.g., 5.x-1.5-beta1, 5.x-1.5-beta2, and 5.x-1.5). Development * snapshots for a given major version are always listed last. * - * @param $project_data + * @param array $project_data * An array containing information about a specific project. - * @param $available + * @param array $available * Data about available project releases of a specific project. */ -function update_calculate_project_update_status(&$project_data, $available) { +function update_calculate_project_update_status(array &$project_data, array $available) { foreach (array('title', 'link') as $attribute) { if (!isset($project_data[$attribute]) && isset($available[$attribute])) { $project_data[$attribute] = $available[$attribute]; @@ -560,11 +560,11 @@ function update_calculate_project_update_status(&$project_data, $available) { * 'update_available_releases' collection -- it needs to persist longer than 1 * hour and never get invalidated just by visiting a page on the site. * - * @param $key + * @param string $key * The key of data to return. Valid options are 'update_project_data' and * 'update_project_projects'. * - * @return + * @return array * The stored value of the $projects array generated by * update_calculate_project_data() or update_get_projects(), or an empty array * when the storage is cleared. diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index eeb28d4..59c0e2f 100644 --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -72,4 +72,3 @@ function _update_cron_notify() { } } } - diff --git a/core/modules/update/update.install b/core/modules/update/update.install index 328288b..213afc9 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -10,19 +10,18 @@ /** * Implements hook_requirements(). * - * @return - * An array describing the status of the site regarding available updates. If - * 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 - * 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 - * returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or UPDATE_UNKNOWN). This - * is used for generating the appropriate email notification messages during - * update_cron(), and might be useful for other modules that invoke - * update_requirements() to find out if the site is up to date or not. + * Returns an array describing the status of the site regarding available + * updates. If 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 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 + * returned (UPDATE_NOT_SECURE, UPDATE_NOT_CURRENT, or UPDATE_UNKNOWN). This is + * used for generating the appropriate email notification messages during + * update_cron(), and might be useful for other modules that invoke + * update_requirements() to find out if the site is up to date or not. * * @see _update_message_text() * @see _update_cron_notify() @@ -83,20 +82,20 @@ function update_uninstall() { * This is shared for both core and contrib to generate the right elements in * the array for hook_requirements(). * - * @param $project + * @param array $project * Array of information about the project we're testing as returned by * update_calculate_project_data(). - * @param $type + * @param string $type * What kind of project this is ('core' or 'contrib'). * - * @return + * @return array * An array to be included in the nested $requirements array. * * @see hook_requirements() * @see update_requirements() * @see update_calculate_project_data() */ -function _update_requirement_check($project, $type) { +function _update_requirement_check(array $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 41866c7..3572f86 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -41,12 +41,12 @@ /** * Batch callback: Performs actions when the download batch is completed. * - * @param $success + * @param bool $success * TRUE if the batch operation was successful, FALSE if there were errors. - * @param $results + * @param array $results * An associative array of results from the batch operation. */ -function update_manager_download_batch_finished($success, $results) { +function update_manager_download_batch_finished($success, array $results) { if (!empty($results['errors'])) { $item_list = array( '#theme' => 'item_list', @@ -76,12 +76,12 @@ function update_manager_download_batch_finished($success, $results) { * The update manager operation we're in the middle of. Can be either 'update' * or 'install'. Use to provide operation-specific interface text. * - * @return + * @return bool * TRUE if the update manager should continue to the next step in the * workflow, or FALSE if we've hit a fatal configuration and must halt the * workflow. */ -function _update_manager_check_backends(&$form, $operation) { +function _update_manager_check_backends(array &$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,6 +146,7 @@ function _update_manager_check_backends(&$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); @@ -197,7 +198,7 @@ function update_manager_archive_verify($project, $archive_file, $directory) { * * Returns the local path if the file has already been downloaded. * - * @param $url + * @param string $url * The URL of the file on the server. * * @return string @@ -239,7 +240,7 @@ function update_manager_file_get($url) { * * @see update_manager_download_page() */ -function update_manager_batch_project_get($project, $url, &$context) { +function update_manager_batch_project_get($project, $url, array &$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; @@ -294,7 +295,7 @@ function update_manager_batch_project_get($project, $url, &$context) { * it. However, it is supported here because it is a common configuration on * shared hosting, and there is nothing Drupal can do to prevent it. * - * @return + * @return bool * TRUE if local file transfers are allowed on this server, or FALSE if not. * * @see install_check_requirements() diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 0619dbb..60c7a6f 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -16,7 +16,6 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Site\Settings; -use Symfony\Cmf\Component\Routing\RouteObjectInterface; // These are internally used constants for this code, do not modify. @@ -257,7 +256,8 @@ 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. @@ -381,7 +381,7 @@ function update_get_available($refresh = FALSE) { * * @see \Drupal\update\UpdateFetcher::createFetchTask() */ -function update_create_fetch_task($project) { +function update_create_fetch_task(array $project) { \Drupal::service('update.processor')->createFetchTask($project); } @@ -408,14 +408,14 @@ function update_fetch_data() { /** * Batch callback: Performs actions when all fetch tasks have been completed. * - * @param $success + * @param bool $success * TRUE if the batch operation was successful; FALSE if there were errors. - * @param $results + * @param array $results * An associative array of results from the batch operation, including the key * 'updated' which holds the total number of projects we fetched available * update data for. */ -function update_fetch_data_finished($success, $results) { +function update_fetch_data_finished($success, array $results) { if ($success) { if (!empty($results)) { if (!empty($results['updated'])) { @@ -450,7 +450,7 @@ function update_fetch_data_finished($success, $results) { * @see _update_cron_notify() * @see _update_message_text() */ -function update_mail($key, &$message, $params) { +function update_mail($key, array &$message, array $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)); @@ -574,10 +574,11 @@ function _update_message_text($msg_type, $msg_reason, $report_link = FALSE, $lan * for the keys used. * * @return int + * Callback return value for uasort(). * * @see update_requirements() */ -function _update_project_status_sort($a, $b) { +function _update_project_status_sort(array $a, array $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 @@ -600,12 +601,9 @@ function _update_project_status_sort($a, $b) { * An associative array containing: * - last: The timestamp when the site last checked for available updates. * - * @return string - * Rendered HTML for the last time we checked for update data. - * * @see theme_update_report() */ -function template_preprocess_update_last_check(&$variables) { +function template_preprocess_update_last_check(array &$variables) { $variables['time'] = \Drupal::service('date.formatter')->formatInterval(REQUEST_TIME - $variables['last']); $variables['link'] = \Drupal::l(t('Check manually'), new Url('update.manual_status', array(), array('query' => drupal_get_destination()))); } diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 61146b4..ef49122 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -20,7 +20,7 @@ * * @ingroup themeable */ -function template_preprocess_update_report(&$variables) { +function template_preprocess_update_report(array &$variables) { $data = $variables['data']; $last = \Drupal::state()->get('update.last_check') ?: 0; @@ -130,7 +130,7 @@ function template_preprocess_update_report(&$variables) { * * @ingroup themeable */ -function template_preprocess_update_project_status(&$variables) { +function template_preprocess_update_project_status(array &$variables) { // Storing by reference because we are sorting the project values. $project = &$variables['project']; $includes_status = $variables['includes_status'];