Skip to content

Commit

Permalink
Revert "Issue #3133305 by quietone, daffie, xjm, benjifisher, longwav…
Browse files Browse the repository at this point in the history
…e: Use \Drupal::VERSION to get the version in Migrate UI rather than hardcoding it"

This reverts commit 7dabc937971eeba8f7dcfef64e1f9c1c40b9ca25.
  • Loading branch information
xjm committed May 12, 2020
1 parent 00af64c commit 70a433e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 45 deletions.
5 changes: 1 addition & 4 deletions modules/migrate_drupal_ui/src/Form/IdConflictForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ protected function conflictsForm(array &$form, array $conflicts) {

$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 @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>',
'#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>',
];

return $form;
Expand Down
5 changes: 1 addition & 4 deletions modules/migrate_drupal_ui/src/Form/IncrementalForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// 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 @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',
]),
'#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']),
'#description' => $this->t('Last upgrade: @date', ['@date' => $this->dateFormatter->format($date_performed)]),
];
return $form;
Expand Down
9 changes: 0 additions & 9 deletions modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ abstract class MigrateUpgradeFormBase extends FormBase {
*/
protected $store;

/**
* The destination site major version.
*
* @var string
*/
protected $destinationSiteVersion;

/**
* Constructs the Migrate Upgrade Form Base.
*
Expand Down Expand Up @@ -67,8 +60,6 @@ public static function create(ContainerInterface $container) {
* {@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'] = [
Expand Down
5 changes: 2 additions & 3 deletions modules/migrate_drupal_ui/src/Form/OverviewForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$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 @version. See the <a href=":url">Drupal site upgrades handbook</a> for more information.', [
'@version' => $this->destinationSiteVersion,
'#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.', [
':url' => 'https://www.drupal.org/upgrade/migrate',
]),
];
Expand All @@ -46,7 +45,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$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 @version installation you will import the old site to.', ['@version' => $this->destinationSiteVersion]) . '</dd>';
$form['legend']['#markup'] .= '<dd>' . $this->t('This empty Drupal 8 installation you will import the old site to.') . '</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.');
Expand Down
4 changes: 2 additions & 2 deletions modules/migrate_drupal_ui/src/Form/ReviewForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'table',
'#header' => [
$this->t('Drupal @version', ['@version' => $version]),
$this->t('Drupal @version', ['@version' => $this->destinationSiteVersion]),
$this->t('Drupal 8'),
],
];

Expand Down Expand Up @@ -161,7 +161,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'table',
'#header' => [
$this->t('Drupal @version', ['@version' => $version]),
$this->t('Drupal @version', ['@version' => $this->destinationSiteVersion]),
$this->t('Drupal 8'),
],
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ abstract class MigrateUpgradeExecuteTestBase extends MigrateUpgradeTestBase {

use CreateTestContentEntitiesTrait;

/**
* The destination site major version.
*
* @var string
*/
protected $destinationSiteVersion;

/**
* {@inheritdoc}
*/
Expand All @@ -26,9 +19,6 @@ protected function setUp() {

// Create content.
$this->createContent();

// Get the current major version.
[$this->destinationSiteVersion] = explode('.', \Drupal::VERSION, 2);
}

/**
Expand All @@ -44,7 +34,7 @@ public function testMigrateUpgradeExecute() {
$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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down Expand Up @@ -109,7 +99,7 @@ public function testMigrateUpgradeExecute() {

// 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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down Expand Up @@ -150,7 +140,7 @@ public function testMigrateUpgradeExecute() {
$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 $this->destinationSiteVersion. 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 8. 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.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public function testMigrateUpgradeReviewPage() {
// Overview form and for an incremental migration it is the Incremental
// form.
$session = $this->assertSession();
// 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['initial'] = 'Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal 8.';
$expected['incremental'] = "An upgrade has already been performed on this site.";

foreach (['/upgrade', '/upgrade/incremental'] as $expected) {
Expand Down Expand Up @@ -115,7 +113,7 @@ public function testMigrateUpgradeReviewPage() {
// 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 $destination_site_version. 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 8. 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.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testMigrateUpgradeExecute() {
$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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down Expand Up @@ -102,7 +102,7 @@ public function testMigrateUpgradeExecute() {

// 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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testMigrateUpgradeExecute() {
$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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down Expand Up @@ -112,7 +112,7 @@ public function testMigrateUpgradeExecute() {

// 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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testMigrateUpgradeExecute() {
$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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down Expand Up @@ -104,7 +104,7 @@ public function testMigrateUpgradeExecute() {

// 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 $this->destinationSiteVersion.");
$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.');

$this->drupalPostForm(NULL, [], t('Continue'));
$session->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
Expand Down

0 comments on commit 70a433e

Please sign in to comment.