Problem/Motivation

migrate_drupal migration credentials are stored in as a key_value pair in the database. However, uninstalling the migrate_drupal module does not delete these key_value pairs from the database.

Steps to reproduce

  1. install and set up migrate_drupal
  2. verify the contents of the `migrate_drupal_7` row in the key_value table
  3. uninstall migrate_drupal
  4. verify the contents of the `migrate_drupal_7` row in the key_value table

Proposed resolution

When migrate_drupal is uninstalled, the migrate_drupal_6 and migrate_drupal_7 key_value pairs should be removed

Issue fork drupal-3224907

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thhafner created an issue. See original summary.

thhafner’s picture

Title: Uninstalling migrate_drupal_ui Does Not Remove Stored Migration Credentials from the database » Uninstalling migrate_drupal_ui Does Not Remove Stored Migration Credentials From the Database
thhafner’s picture

Issue summary: View changes

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dcam made their first commit to this issue’s fork.

dcam’s picture

Title: Uninstalling migrate_drupal_ui Does Not Remove Stored Migration Credentials From the Database » Orphaned state keys after migrate_drupal uninstall
Issue summary: View changes
Issue tags: -migrate, -Migrate UI +Security improvements

I verified that this is still an issue. But not quite for the reasons originally reported. The relevant state keys are created by the migrate_drupal module, not migrate_drupal_ui. It's natural that the state keys would still be in the database if migrate_drupal_ui is uninstalled and migrate_drupal is not. But migrate_drupal doesn't remove them either, which probably isn't a good thing for security. In any case, a module should clean up its stuff when being uninstalled.

It's easy enough to update the module to remove those state keys on uninstall and to create a test for it. But this issue suggests that there are sites out there where migrate_drupal is already uninstalled that have orphaned state keys. I have no idea how those should be handled. If there's a precedent, then let me know.

Since the Drupal migration modules are being removed for D12, then I think this issue should be handled before then. That way, anyone who still has migrate_drupal installed on their site will have the keys removed properly.

dcam’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs Review Queue Initiative

Seems pretty straight forward

Ran the test-only pipeline

1) Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalUninstallTest::testUninstall
Failed asserting that Array &0 [
    'key' => 'upgrade',
    'database' => Array &1 [],
] is null.
/builds/issue/drupal-3224907/core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalUninstallTest.php:38

Which what would be expected.

LGTM

  • catch committed ca674ff9 on 11.x
    Issue #3224907 by dcam, thhafner: Orphaned state keys after...

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.