Unverified Commit 7a7e0aa0 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2830326 by dww, mpdonadio, cebasqueira, Wim Leers, amateescu, jungle,...

Issue #2830326 by dww, mpdonadio, cebasqueira, Wim Leers, amateescu, jungle, xjm, daffie, Pasqualle: Broken link to 'Put your site into maintenance mode' on update.php results in WSOD

(cherry picked from commit 240e303d)
parent dbb47914
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -216,8 +216,10 @@ protected function info(Request $request) {
    ];

    $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')->toString(TRUE)->getGeneratedUrl(),
      ':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.');
+17 −0
Original line number Diff line number Diff line
@@ -641,6 +641,23 @@ public function testSuccessfulMultilingualUpdateFunctionality() {
    $this->assertResponse(200);
  }

  /**
   * Tests maintenance mode link on update.php.
   */
  public function testMaintenanceModeLink() {
    $admin_user = $this->drupalCreateUser([
      'administer software updates',
      'access administration pages',
      'administer site configuration',
    ]);
    $this->drupalLogin($admin_user);
    $this->drupalGet($this->updateUrl, ['external' => TRUE]);
    $this->assertResponse(200);
    $this->clickLink('maintenance mode');
    $this->assertResponse(200);
    $this->assertEquals('Maintenance mode', $this->cssSelect('main h1')[0]->getText());
  }

  /**
   * Helper function to run updates via the browser.
   */