diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php index 3f625b1e1db20f96d952c95c58e71046f9cd5301..2761d620325e259c5ee2eaaaa3bfe8be7aa5be37 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php @@ -146,6 +146,7 @@ function testNoUpdateFunctionality() { $this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE)); $this->assertText(t('No pending updates.')); $this->assertNoLink('Administration pages'); + $this->assertNoLinkByHref('update.php', 0); $this->clickLink('Front page'); $this->assertResponse(200); @@ -154,6 +155,8 @@ function testNoUpdateFunctionality() { $this->drupalLogin($admin_user); $this->drupalPost($this->update_url, array(), t('Continue'), array('external' => TRUE)); $this->assertText(t('No pending updates.')); + $this->assertLink('Administration pages'); + $this->assertNoLinkByHref('update.php', 1); $this->clickLink('Administration pages'); $this->assertResponse(200); } @@ -170,6 +173,7 @@ function testSuccessfulUpdateFunctionality() { $this->assertText('Updates were attempted.'); $this->assertLink('site'); $this->assertNoLink('Administration pages'); + $this->assertNoLinkByHref('update.php', 0); $this->assertNoLink('logged'); $this->clickLink('Front page'); $this->assertResponse(200); @@ -183,6 +187,8 @@ function testSuccessfulUpdateFunctionality() { $this->drupalPost(NULL, array(), t('Apply pending updates')); $this->assertText('Updates were attempted.'); $this->assertLink('logged'); + $this->assertLink('Administration pages'); + $this->assertNoLinkByHref('update.php', 1); $this->clickLink('Administration pages'); $this->assertResponse(200); } diff --git a/core/update.php b/core/update.php index 607a1b7aa8de220e560e0f4950cfd99cc30b609f..8608f977fd886518b3d03c163813fc642b9f9250 100644 --- a/core/update.php +++ b/core/update.php @@ -456,6 +456,12 @@ function update_check_requirements($skip_warnings = FALSE) { drupal_container() ->set('request', $request); +// Ensure that URLs generated for the home and admin pages don't have 'update.php' +// in them. +$generator = Drupal::urlGenerator(); +$generator->setBasePath(str_replace('/core', '', $request->getBasePath()) . '/'); +$generator->setScriptPath(''); + // There can be conflicting 'op' parameters because both update and batch use // this parameter name. We need the 'op' coming from a POST request to trump // that coming from a GET request.