Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Trying to run any migration operation with the Drush integration of Migrate Tools causes a fatal error. It appears that it might be as simple as an incorrect use statement. While I found this via drush, I expect this probably would cause a fatal error for any migration at all, as soon as the source plugin manager attempts to instantiate the Disqus source plugin, it will fail.
TypeError: Argument 5 passed to Drupal\disqus\Plugin\migrate\source\DisqusComment::create() must be an instance of [error]
Drupal\migrate\Entity\MigrationInterface, instance of Drupal\migrate\Plugin\Migration given, called in
/var/www/build/html/core/modules/migrate/src/Plugin/MigratePluginManager.php on line 57 in
Drupal\disqus\Plugin\migrate\source\DisqusComment::create() (line 79 of
/var/www/build/html/modules/contrib/disqus/src/Plugin/migrate/source/DisqusComment.php) #0
/var/www/build/html/core/modules/migrate/src/Plugin/MigratePluginManager.php(57):
Drupal\disqus\Plugin\migrate\source\DisqusComment::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'disqus_source',
Array, Object(Drupal\migrate\Plugin\Migration))
#1 /var/www/build/html/core/modules/migrate/src/Plugin/Migration.php(335):
Drupal\migrate\Plugin\MigratePluginManager->createInstance('disqus_source', Array, Object(Drupal\migrate\Plugin\Migration))
#2 /var/www/build/html/modules/contrib/migrate_tools/migrate_tools.drush.inc(471): Drupal\migrate\Plugin\Migration->getSourcePlugin()
#3 /var/www/build/html/modules/contrib/migrate_tools/migrate_tools.drush.inc(147): drush_migrate_tools_migration_list('')
#4 /var/www/vendor/drush/drush/includes/command.inc(422): drush_migrate_tools_migrate_status()
#5 /var/www/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#6 /var/www/vendor/drush/drush/includes/command.inc(199): drush_command()
#7 /var/www/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#8 /var/www/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#9 /var/www/vendor/drush/drush/drush.php(12): drush_main()
#10 {main}.
Proposed resolution
Change the use statement, see if that helps it.
Remaining tasks
All the things
User interface changes
None expected.
API changes
None expected.
Data model changes
None expected.
Comment | File | Size | Author |
---|---|---|---|
#25 | 2879592-25.patch | 14.89 KB | Nuuou |
#24 | interdiff.txt | 17.31 KB | gaurav.kapoor |
#24 | 2879592-24.patch | 13.95 KB | gaurav.kapoor |
#18 | remove-migration-scripts-2879592-18.patch | 26.25 KB | jason.blanda |
#14 | interdiff.txt | 1.14 KB | marvil07 |
Comments
Comment #2
Grayside CreditAttribution: Grayside at Phase2 commentedCorrecting the use statement to
use Drupal\migrate\Plugin\MigrationInterface;
fromuse <code>Drupal\migrate\Entity\MigrationInterface;
surfaced another error:Since I am not using this migration plugin, I have attached a horrible patch that removes all the migrate plugins so I can move forward without this. Sorry not to be a better collaborator in this instance.
Comment #3
tobby CreditAttribution: tobby at Phase2 for Phase2 commentedFWIW this is probably related to a change in Migrate Plus, where they changed how migrate plugins are discovered and to use Core's Migrate plugin manager. See https://www.drupal.org/node/2752335 for the relevant change. This Disqus migrate plugin doesn't throw an automatic fatal error when using older versions of Migrate Plus and Migrate Tools (~8.x-2.x, which is intended for Drupal 8.1). This particular issue is going to pop up for later versions, like Migrate Plus and Migrate Tools 8.x-4.x, which is intended for Drupal 8.3+.
Comment #4
Grayside CreditAttribution: Grayside at Phase2 commentedThat one had my use statement correction breaking the patch.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedFor anyone facing this issue, the fix is to remove migrations from Disqus. You will need to delete the following directory in the disqus module : src/Plugin/migrate and of course, run drush cr.
Comment #6
Dylan Donkersgoed CreditAttribution: Dylan Donkersgoed at Northern Commerce commentedI encountered a similar issue when trying to run a migration of D6 comments to Disqus comments for a D8 site. The destination plugin is actually already pretty close to working and I'm attaching a patch to get it running. It:
- adds a logger channel service
- updates the use statement etc. for the logger accordingly
- implements ContainerFactoryPluginInterface so dependencies can be injected
Seems to work pretty well so far.
It's my understanding that the last couple patches are removing the migrations as a temporary fix so I haven't included them in this patch.
Comment #7
Grayside CreditAttribution: Grayside at Phase2 commentedDylan, that is correct. I wasn't trying to perform a Disqus migration, just have the module integrated into a site in which a migration needed to be run. As such, I posted a patch to suppress the migration and left the real work to someone who needed it. Thank you for contributing a more helpful step to a solution.
Comment #8
Dylan Donkersgoed CreditAttribution: Dylan Donkersgoed at Northern Commerce commentedI've expanded my patch from above to include mapping of Disqus IDs in the destination plugin and rollback functionality. It should now be possible to rollback disqus migrations and map parent comment ids from migrations.
Comment #9
Dylan Donkersgoed CreditAttribution: Dylan Donkersgoed at Northern Commerce commentedNew patch, added support for migrating comments to Disqus guest comments. They need to be approved afterwards unfortunately - seems like you should be able to approve them via the API afterwards but it doesn't seem to work with a quick test. Also made errors a bit clearer. Unfortunately date and IP can't be migrated this way.
Comment #10
sittard CreditAttribution: sittard commentedPlease could we have this committed and fixed. Thanks.
Comment #11
SweetchuckComment #12
Dylan Donkersgoed CreditAttribution: Dylan Donkersgoed at Northern Commerce commentedBefore this gets committed I want to note here that I ended up giving up on performing a migration via the module altogether due to some limitations in Disqus's API. Notably I never could get the date and IP to migrate properly (likely wasn't actually possible via the API) and got constant lockouts due to the large number of queries. Instead I wrote a one-off drush script to generate a few XML files which I imported via Disqus's migration tool. Unfortunately that won't work with Drupal's migration framework.
So before you use my patch remember that even I didn't in the end, though it should work in some circumstances.
Comment #13
sittard CreditAttribution: sittard commentedYeah I'm in a agreement.
At the moment Disqus RC3 is blocking our site migration (we don't even need to migrate Disqus comments).
As this patch is partly untested would it be possible to have a working Disqus RC4 released with the migration elements removed. Please can migration and this issue be moved to the development branch until it's fully tested and working.
Comment #14
marvil07 CreditAttribution: marvil07 at Isovera commentedI am having problems with the code on the current release when I try to execute
drush migrate-status
.I see that some of the problems are already fixed on the latest patch here, so I went ahead and updated the latest patch to fix the problem I see, but I have not really reviewed the whole patch.
Comment #15
frodeste CreditAttribution: frodeste as a volunteer and at ProsessPilotene as commentedCan someone commit the patch?
Comment #16
abu-zakham CreditAttribution: abu-zakham at Vardot commentedComment #17
Ludo.RI applied the patch #14 and it solved the intial error when doing a
drush migrate-status
. I'm using Disqus 8.x-1.0-rc3Comment #18
jason.blanda CreditAttribution: jason.blanda commentedIf you are not in need of the Disqus migration files but do need to run other migrations here is a patch to remove Disqus migration files and templates.
Comment #19
RobLoachThanks! Perhaps we should consider moving the Migration scripts to a separate module if it's causing issue. disqus_migrate or similar?
In the mean time, it sounds like https://www.drupal.org/files/issues/disqus-migrate-support-2879592-14.patch is good to go....
Comment #20
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedComment #21
WebbehLooks like this is RTBC from feedback, un-assigning #20.
Comment #22
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedThe patch provided in #14 would require a reroll and changes related to D9 compatibility included.
Comment #23
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedComment #24
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedRerolled the patch as per latest release as well as resolved all the errors which were shown when trying to run drush ms. Fixed CS issues in destination and source plugin.
Comment #25
Nuuou CreditAttribution: Nuuou commentedModified the above patch to also include some changes from a related issue, as they conflicted:
https://www.drupal.org/project/disqus/issues/3089234
Without both of these, I was unable to run "drush ms" or perform any migration-related tasks.
Comment #27
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedAfter testing, 4-5 different scenarios I believe we should commit patch in #25 and unblock things for now and in long run we can work on moving migration related logic to a different module. There is a still a warning message shown when API keys aren't configured but that is still better creating a migration blocker in all the projects which use this module. Feel free to open this issue again if someone has different thoughts.
Comment #28
gaurav.kapoor CreditAttribution: gaurav.kapoor at Axelerant for Drupal India Association commentedThanks everyone for working on this.