Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 300345

Fixes for MigrateUpgradeForm

$
0
0

Postponed on #2687843: Add back incremental migrations through the UI

Problem/Motivation

A review of the patch in #2687843: Add back incremental migrations through the UI comment #98 included some points that were outside the scope of the issue and need to be addressed.

The relevant is in comment#99

This is a copy of the points to be addressed in this issue

Now in IncrementalForm.
2.    +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
    @@ -236,6 +244,51 @@ public function submitOverviewForm(array &$form, FormStateInterface $form_state)
    +    $database_state_key = $this->state->get('migrate.fallback_state_key', '');
    +    if ($database_state_key) {

    Why would we use the fallback state key here? The user has entered explicit database credentials here, so I don't understand why we wouldn't just use those.

Now in OverviewForm.
3.    +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
    @@ -236,6 +244,51 @@ public function submitOverviewForm(array &$form, FormStateInterface $form_state)
    +      $form_state->setValue('step', 'credentials');
    +      $form_state->setRebuild();

    Nit: setValue() is chainable, so we could do ->setValue()->setRebuild().

Now in MigrateUPgradeFormBase.
4.    +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
    @@ -848,6 +877,44 @@ protected function getDatabaseTypes() {
    +   * Setup migrations.
    +   *
    +   * @param array $database
    +   *   Database array representing the source Drupal database.
    +   * @param \Drupal\Core\Form\FormStateInterface $form_state
    +   *   The current state of the form.
    +   */
    +  protected function setupMigrations(array $database, FormStateInterface $form_state) {

    Can this doc comment be expanded a bit? "Setup migrations" tells me nothing more than the method name already does.

Now in  CredentialForm.
5.    +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php
    @@ -848,6 +877,44 @@ protected function getDatabaseTypes() {
    +    $form_state->set('version', $version);
    +    $form_state->set('migrations', $migration_array);

    Nit: ->set() is chainable.

10.     +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
    @@ -315,4 +281,110 @@ protected function translatePostValues(array $values) {
    +   * @param $session
    +   *   The currenct session.

    $session needs a type hint (also in the method signature), and there's a typo in 'current'.

11.    +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
    @@ -315,4 +281,110 @@ protected function translatePostValues(array $values) {
    +   * @param $session
    +   *   The currenct session.
    +   */
    +  protected function assertIdConflict($session) {

    $session needs to be type hinted, and 'current' is misspelled. :)

12.    +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeTestBase.php
    @@ -315,4 +281,110 @@ protected function translatePostValues(array $values) {
    +    // Have to reset all the statics after migration to ensure entities are

    'statics' should be 'static caches'.

Proposed resolution

Respond to the feedback

Remaining tasks

This will needs a patch, a review etc.


Viewing all articles
Browse latest Browse all 300345

Latest Images

Trending Articles

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>