diff --git a/core/modules/system/system.module b/core/modules/system/system.module index d6d98c8..15f8e77 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -116,15 +116,7 @@ function system_help($route_name, RouteMatchInterface $route_match) { case 'system.modules_list': $output = '

' . t('Download additional contributed modules to extend your site\'s functionality.', array('!modules' => 'https://www.drupal.org/project/modules')) . '

'; - if (\Drupal::moduleHandler()->moduleExists('update')) { - if (update_manager_access()) { - $output .= '

' . t('Regularly review and install available updates to maintain a secure and current site. Always run the update script each time a module is updated.', array('!update-php' => \Drupal::url('system.db_update'), '!updates' => \Drupal::url('update.status'))) . '

'; - } - else { - $output .= '

' . t('Regularly review available updates to maintain a secure and current site. Always run the update script each time a module is updated.', array('!update-php' => \Drupal::url('system.db_update'), '!updates' => \Drupal::url('update.status'))) . '

'; - } - } - else { + if (!\Drupal::moduleHandler()->moduleExists('update')) { $output .= '

' . t('Regularly review available updates to maintain a secure and current site. Always run the update script each time a module is updated. Enable the Update Manager module to update and install modules and themes.', array('!update-php' => \Drupal::url('system.db_update'), '!update-manager' => \Drupal::url('system.modules_list', [], ['fragment' => 'module-update']))) . '

'; } return $output; diff --git a/core/modules/update/update.install b/core/modules/update/update.install index 060f092..3a95866 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -112,7 +112,7 @@ function _update_requirement_check($project, $type) { // _update_message_text(), and format the two translated strings together in // a single paragraph. $requirement['description'][] = ['#markup' => _update_message_text($type, $status)]; - if (update_manager_access()) { + if (_update_manager_access()) { $requirement['description'][] = ['#prefix' => ' ', '#markup' => t('See the available updates page for more information and to install your missing updates.', ['@available_updates' => \Drupal::url('update.report_update')])]; } else { @@ -145,6 +145,6 @@ function _update_requirement_check($project, $type) { if ($status != UPDATE_CURRENT && $type == 'core' && isset($project['recommended'])) { $requirement_label .= ' ' . t('(version @version available)', array('@version' => $project['recommended'])); } - $requirement['value'] = \Drupal::l($requirement_label, new Url(update_manager_access() ? 'update.report_update' : 'update.status')); + $requirement['value'] = \Drupal::l($requirement_label, new Url(_update_manager_access() ? 'update.report_update' : 'update.status')); return $requirement; } diff --git a/core/modules/update/update.module b/core/modules/update/update.module index a6ac805..63a76b6 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -74,7 +74,7 @@ function update_help($route_name, RouteMatchInterface $route_match) { $output .= '

' . t('About') . '

'; $output .= '

' . t('The Update Manager module periodically checks for new versions of your site\'s software (including contributed modules and themes), and alerts administrators to available updates. The Update Manager system is also used by some other modules to manage updates and downloads; for example, the Interface Translation module uses the Update Manager to download translations from the localization server. Note that whenever the Update Manager system is used, anonymous usage statistics are sent to Drupal.org. If desired, you may disable the Update Manager module from the Extend page; if you do so, functionality that depends on the Update Manager system will not work. For more information, see the online documentation for the Update Manager module.', array('!update' => 'https://www.drupal.org/documentation/modules/update', '!modules' => \Drupal::url('system.modules_list'))) . '

'; // Only explain the Update manager if it has not been disabled. - if (update_manager_access()) { + if (_update_manager_access()) { $output .= '

' . t('The Update Manager also allows administrators to update and install modules and themes through the administration interface.') . '

'; } $output .= '

' . t('Uses') . '

'; @@ -82,7 +82,7 @@ function update_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Checking for available updates') . '
'; $output .= '
' . t('The Available updates report displays core, contributed modules, and themes for which there are new releases available for download. On the report page, you can also check manually for updates. You can configure the frequency of update checks, which are performed during cron runs, and whether notifications are sent on the Update Manager settings page.', array('!update-report' => \Drupal::url('update.status'), '!update-settings' => \Drupal::url('update.settings'))) . '
'; // Only explain the Update manager if it has not been disabled. - if (update_manager_access()) { + if (_update_manager_access()) { $output .= '
' . t('Performing updates through the Update page') . '
'; $output .= '
' . t('The Update Manager module allows administrators to perform updates directly from the Update page. It lists all available updates, and you can confirm whether you want to download them. If you don\'t have sufficient access rights to your web server, you could be prompted for your FTP/SSH password. Afterwards the files are transferred into your site installation, overwriting your old files. Direct links to the Update page are also displayed on the Extend page and the Appearance page.', array('!modules_page' => \Drupal::url('system.modules_list'), '!themes_page' => \Drupal::url('system.themes_page'), '!update-page' => \Drupal::url('update.report_update'))) . '
'; $output .= '
' . t('Installing new modules and themes through the Install page') . '
'; @@ -93,6 +93,15 @@ function update_help($route_name, RouteMatchInterface $route_match) { case 'update.status': return '

' . t('Here you can find information about available updates for your installed modules and themes. Note that each module or theme is part of a "project", which may or may not have the same name, and might include multiple modules or themes within it.') . '

'; + + case 'system.modules_list': + if (_update_manager_access()) { + $output = '

' . t('Regularly review and install available updates to maintain a secure and current site. Always run the update script each time a module is updated.', array('!update-php' => \Drupal::url('system.db_update'), '!updates' => \Drupal::url('update.status'))) . '

'; + } + else { + $output = '

' . t('Regularly review available updates to maintain a secure and current site. Always run the update script each time a module is updated.', array('!update-php' => \Drupal::url('system.db_update'), '!updates' => \Drupal::url('update.status'))) . '

'; + } + return $output; } } @@ -155,7 +164,7 @@ function update_page_top() { } /** - * Access callback: Resolves if the current user can access updater menu items. + * Resolves if the current user can access updater menu items. * * It both enforces the 'administer software updates' permission and the global * kill switch for the authorize.php script. @@ -163,10 +172,8 @@ function update_page_top() { * @return * TRUE if the current user can access the updater menu items; FALSE * otherwise. - * - * @see update_menu() */ -function update_manager_access() { +function _update_manager_access() { return Settings::get('allow_authorize_operations', TRUE) && \Drupal::currentUser()->hasPermission('administer software updates'); } @@ -439,7 +446,7 @@ function update_mail($key, &$message, $params) { $message['body'][] = _update_message_text($msg_type, $msg_reason, $langcode); } $message['body'][] = t('See the available updates page for more information:', array(), array('langcode' => $langcode)) . "\n" . \Drupal::url('update.status', [], ['absolute' => TRUE, 'language' => $language]); - if (update_manager_access()) { + if (_update_manager_access()) { $message['body'][] = t('You can automatically install your missing updates using the Update manager:', array(), array('langcode' => $langcode)) . "\n" . \Drupal::url('update.report_update', [], ['absolute' => TRUE, 'language' => $language]); } $settings_url = \Drupal::url('update.settings', [], ['absolute' => TRUE]);