You are here

protected function DbUpdateController::info in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::info()
  2. 9 core/modules/system/src/Controller/DbUpdateController.php \Drupal\system\Controller\DbUpdateController::info()

Returns the info database update page.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The current request.

Return value

array A render array.

1 call to DbUpdateController::info()
DbUpdateController::handle in core/modules/system/src/Controller/DbUpdateController.php
Returns a database update page.

File

core/modules/system/src/Controller/DbUpdateController.php, line 208

Class

DbUpdateController
Controller routines for database update routes.

Namespace

Drupal\system\Controller

Code

protected function info(Request $request) {

  // Change query-strings on css/js files to enforce reload for all users.
  _drupal_flush_css_js();

  // Flush the cache of all data for the update status module.
  $this->keyValueExpirableFactory
    ->get('update')
    ->deleteAll();
  $this->keyValueExpirableFactory
    ->get('update_available_release')
    ->deleteAll();
  $build['info_header'] = [
    '#markup' => '<p>' . $this
      ->t('Use this utility to update your database whenever a new release of Drupal or a module is installed.') . '</p><p>' . $this
      ->t('For more detailed information, see the <a href="https://www.drupal.org/docs/updating-drupal">Updating Drupal guide</a>. If you are unsure what these terms mean you should probably contact your hosting provider.') . '</p>',
  ];
  $info[] = $this
    ->t("<strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.");

  // @todo Simplify with https://www.drupal.org/node/2548095
  $base_url = str_replace('/update.php', '', $request
    ->getBaseUrl());
  $info[] = $this
    ->t('Put your site into <a href=":url">maintenance mode</a>.', [
    ':url' => Url::fromRoute('system.site_maintenance_mode')
      ->setOption('base_url', $base_url)
      ->toString(TRUE)
      ->getGeneratedUrl(),
  ]);
  $info[] = $this
    ->t('<strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.');
  $info[] = $this
    ->t('Install your new files in the appropriate location, as described in the handbook.');
  $build['info'] = [
    '#theme' => 'item_list',
    '#list_type' => 'ol',
    '#items' => $info,
  ];
  $build['info_footer'] = [
    '#markup' => '<p>' . $this
      ->t('When you have performed the steps above, you may proceed.') . '</p>',
  ];
  $build['link'] = [
    '#type' => 'link',
    '#title' => $this
      ->t('Continue'),
    '#attributes' => [
      'class' => [
        'button',
        'button--primary',
      ],
    ],
    // @todo Revisit once https://www.drupal.org/node/2548095 is in.
    '#url' => Url::fromUri('base://selection'),
  ];
  return $build;
}