Issue #3133305 by quietone, daffie, xjm, benjifisher, longwave: Use \Drupal::VERSION to get the version in Migrate UI rather than hardcoding it
parent
705ab0ab86
commit
4d49b84991
|
@ -94,7 +94,10 @@ class IdConflictForm extends MigrateUpgradeFormBase {
|
|||
|
||||
$form['warning'] = [
|
||||
'#type' => 'markup',
|
||||
'#markup' => '<p>' . $this->t('It looks like you have content on your new site which <strong>may be overwritten</strong> if you continue to run this upgrade. The upgrade should be performed on a clean Drupal 8 installation. For more information see the <a target="_blank" href=":id-conflicts-handbook">upgrade handbook</a>.', [':id-conflicts-handbook' => 'https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#id_conflicts']) . '</p>',
|
||||
'#markup' => '<p>' . $this->t('It looks like you have content on your new site which <strong>may be overwritten</strong> if you continue to run this upgrade. The upgrade should be performed on a clean Drupal @version installation. For more information see the <a target="_blank" href=":id-conflicts-handbook">upgrade handbook</a>.', [
|
||||
'@version' => $this->destinationSiteVersion,
|
||||
':id-conflicts-handbook' => 'https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-drupal-6-or-7-to-drupal-8#id_conflicts',
|
||||
]) . '</p>',
|
||||
];
|
||||
|
||||
return $form;
|
||||
|
|
|
@ -82,7 +82,10 @@ class IncrementalForm extends MigrateUpgradeFormBase {
|
|||
// https://www.drupal.org/node/2687849
|
||||
$form['upgrade_option_item'] = [
|
||||
'#type' => 'item',
|
||||
'#prefix' => $this->t('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal 8. Rollbacks are not yet supported through the user interface. For more information, see the <a href=":url">upgrading handbook</a>.', [':url' => 'https://www.drupal.org/upgrade/migrate']),
|
||||
'#prefix' => $this->t('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal @version. Rollbacks are not yet supported through the user interface. For more information, see the <a href=":url">upgrading handbook</a>.', [
|
||||
'@version' => $this->destinationSiteVersion,
|
||||
':url' => 'https://www.drupal.org/upgrade/migrate',
|
||||
]),
|
||||
'#description' => $this->t('Last upgrade: @date', ['@date' => $this->dateFormatter->format($date_performed)]),
|
||||
];
|
||||
return $form;
|
||||
|
|
|
@ -25,6 +25,13 @@ abstract class MigrateUpgradeFormBase extends FormBase {
|
|||
*/
|
||||
protected $store;
|
||||
|
||||
/**
|
||||
* The destination site major version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $destinationSiteVersion;
|
||||
|
||||
/**
|
||||
* Constructs the Migrate Upgrade Form Base.
|
||||
*
|
||||
|
@ -60,6 +67,8 @@ abstract class MigrateUpgradeFormBase extends FormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
// Get the current major version.
|
||||
list($this->destinationSiteVersion) = explode('.', \Drupal::VERSION, 2);
|
||||
$form = [];
|
||||
$form['actions']['#type'] = 'actions';
|
||||
$form['actions']['submit'] = [
|
||||
|
|
|
@ -34,7 +34,8 @@ class OverviewForm extends MigrateUpgradeFormBase {
|
|||
$form['#title'] = $this->t('Upgrade');
|
||||
|
||||
$form['info_header'] = [
|
||||
'#markup' => '<p>' . $this->t('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8. See the <a href=":url">Drupal site upgrades handbook</a> for more information.', [
|
||||
'#markup' => '<p>' . $this->t('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal @version. See the <a href=":url">Drupal site upgrades handbook</a> for more information.', [
|
||||
'@version' => $this->destinationSiteVersion,
|
||||
':url' => 'https://www.drupal.org/upgrade/migrate',
|
||||
]),
|
||||
];
|
||||
|
@ -45,7 +46,7 @@ class OverviewForm extends MigrateUpgradeFormBase {
|
|||
$form['legend']['#markup'] .= '<dt>' . $this->t('Old site') . '</dt>';
|
||||
$form['legend']['#markup'] .= '<dd>' . $this->t('The site you want to upgrade.') . '</dd>';
|
||||
$form['legend']['#markup'] .= '<dt>' . $this->t('New site') . '</dt>';
|
||||
$form['legend']['#markup'] .= '<dd>' . $this->t('This empty Drupal 8 installation you will import the old site to.') . '</dd>';
|
||||
$form['legend']['#markup'] .= '<dd>' . $this->t('This empty Drupal @version installation you will import the old site to.', ['@version' => $this->destinationSiteVersion]) . '</dd>';
|
||||
$form['legend']['#markup'] .= '</dl>';
|
||||
|
||||
$info[] = $this->t('Make sure that <strong>access to the database</strong> for the old site is available from this new site.');
|
||||
|
|
|
@ -120,7 +120,7 @@ class ReviewForm extends MigrateUpgradeFormBase {
|
|||
'#type' => 'table',
|
||||
'#header' => [
|
||||
$this->t('Drupal @version', ['@version' => $version]),
|
||||
$this->t('Drupal 8'),
|
||||
$this->t('Drupal @version', ['@version' => $this->destinationSiteVersion]),
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -161,7 +161,7 @@ class ReviewForm extends MigrateUpgradeFormBase {
|
|||
'#type' => 'table',
|
||||
'#header' => [
|
||||
$this->t('Drupal @version', ['@version' => $version]),
|
||||
$this->t('Drupal 8'),
|
||||
$this->t('Drupal @version', ['@version' => $this->destinationSiteVersion]),
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -11,6 +11,13 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
|
|||
|
||||
use CreateTestContentEntitiesTrait;
|
||||
|
||||
/**
|
||||
* The destination site major version.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $destinationSiteVersion;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -19,6 +26,9 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
|
|||
|
||||
// Create content.
|
||||
$this->createContent();
|
||||
|
||||
// Get the current major version.
|
||||
[$this->destinationSiteVersion] = explode('.', \Drupal::VERSION, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +44,7 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
|
|||
$connection_options = $this->sourceDatabase->getConnectionOptions();
|
||||
$this->drupalGet('/upgrade');
|
||||
$session = $this->assertSession();
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
@ -99,7 +109,7 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
|
|||
|
||||
// Restart the upgrade process.
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
@ -140,7 +150,7 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {
|
|||
$this->createContentPostUpgrade();
|
||||
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->pageTextContains('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal 8. Rollbacks are not yet supported through the user interface.');
|
||||
$session->pageTextContains("An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal $this->destinationSiteVersion. Rollbacks are not yet supported through the user interface.");
|
||||
$this->drupalPostForm(NULL, [], t('Import new configuration and content from old site'));
|
||||
$this->drupalPostForm(NULL, $edits, t('Review upgrade'));
|
||||
$session->pageTextContains('WARNING: Content may be overwritten on your new site.');
|
||||
|
|
|
@ -62,7 +62,9 @@ class MigrateUpgradeFormStepsTest extends BrowserTestBase {
|
|||
// Overview form and for an incremental migration it is the Incremental
|
||||
// form.
|
||||
$session = $this->assertSession();
|
||||
$expected['initial'] = 'Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.';
|
||||
// Get the current major version.
|
||||
list($destination_site_version) = explode('.', \Drupal::VERSION, 2);
|
||||
$expected['initial'] = "Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $destination_site_version.";
|
||||
$expected['incremental'] = "An upgrade has already been performed on this site.";
|
||||
|
||||
foreach (['/upgrade', '/upgrade/incremental'] as $expected) {
|
||||
|
@ -113,7 +115,7 @@ class MigrateUpgradeFormStepsTest extends BrowserTestBase {
|
|||
// Test that the credential form is displayed for incremental migrations.
|
||||
$store->set('step', 'overview');
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->pageTextContains('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal 8. Rollbacks are not yet supported through the user interface.');
|
||||
$session->pageTextContains("An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal $destination_site_version. Rollbacks are not yet supported through the user interface.");
|
||||
$this->drupalPostForm(NULL, [], t('Import new configuration and content from old site'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
|
|||
$connection_options = $this->sourceDatabase->getConnectionOptions();
|
||||
$this->drupalGet('/upgrade');
|
||||
$session = $this->assertSession();
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
@ -102,7 +102,7 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
|
|||
|
||||
// Start the upgrade process.
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
|
|
@ -84,7 +84,7 @@ class NodeClassicTest extends MigrateUpgradeExecuteTestBase {
|
|||
$connection_options = $this->sourceDatabase->getConnectionOptions();
|
||||
$this->drupalGet('/upgrade');
|
||||
$session = $this->assertSession();
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
@ -112,7 +112,7 @@ class NodeClassicTest extends MigrateUpgradeExecuteTestBase {
|
|||
|
||||
// Start the upgrade process.
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
|
|
@ -76,7 +76,7 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
|
|||
$connection_options = $this->sourceDatabase->getConnectionOptions();
|
||||
$this->drupalGet('/upgrade');
|
||||
$session = $this->assertSession();
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
@ -104,7 +104,7 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
|
|||
|
||||
// Start the upgrade process.
|
||||
$this->drupalGet('/upgrade');
|
||||
$session->responseContains('Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.');
|
||||
$session->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal $this->destinationSiteVersion.");
|
||||
|
||||
$this->drupalPostForm(NULL, [], t('Continue'));
|
||||
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
|
||||
|
|
Loading…
Reference in New Issue