Problem/Motivation
When module upgraded from 8.x-1.0 to 2.x it's not possible to run drush updb.
Starting from 2.x version this module using "migrate_tools" module as dependency and this module installed in update hook path_redirect_import_update_9001.
But drush updb failed because registration of drush services in cotainer runs before drush updb command and drush service /src/Commands/PathRedirectImportCommands.php extends MigrateToolsCommands class from migrate_tools module which was not installed yet. This is leads to error after running drush updb:
[error] Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php)
Steps to reproduce
- Install module "path_redirect_import" version 8.x-1.0-beta5. Make sure that the module "migrate_tools" is not installed.
- Upgrade module "path_redirect_import" to 2.0.5 version
- Run
drush updb
Result:
[error] Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php)
Proposed resolution
Disable drush service "path_redirect_import.commands" before module "migrate_tools" not installed.
Remaining tasks
Write a patch
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3313386_11.patch | 679 bytes | d0t15t |
| #10 | 3313386-10.patch | 1.53 KB | plopesc |
| #8 | 3313386-8.patch | 1.08 KB | eugene.brit |
| #8 | interdiff_2-8.txt | 934 bytes | eugene.brit |
| #3 | 3313386-2-drush-updb-fails.patch | 1010 bytes | qzmenko |
Issue fork path_redirect_import-3313386
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
Comment #3
qzmenkoCreated MR, please review. Also patch attached.
Comment #4
qzmenkoComment #5
scottsawyerBrilliant, and it works. Even better.
Comment #6
prabuthe commentedI am getting this error
Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 25 of C:\Sapient\new\ej-d8-sites\docroot\modules\contrib\path_redirect_import\src\Commands\PathRedirectImportCommands.php).
[30;43;1m[warning][39;49;22m Drush command terminated abnormally.
Comment #7
alina.basarabeanu commentedWith the patch applied, I get a new error:
The service "drush.command.services" has a dependency on a non-existent service "path_redirect_import.commands".
Comment #8
eugene.britAdded 'path_redirect_import.redirect_export' service to the #2 patch
Comment #9
alina.basarabeanu commentedPatch #8 fixed the drush command error.
Comment #10
plopescNew patch version including some minor changes.
Comment #12
plopescPatch committed.
Marking issue as fixed.
Thank you!
Comment #14
d0t15t commentedI'm having this issue again, but the issue is that Drupal\migrate_tools\Commands\MigrateToolsCommands has moved to: Drupal\migrate_tools\Drush\MigrateToolsCommands
Comment #15
alina.basarabeanu commentedI tried to use the dev version without the patch but the issue is not resolved.
Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /var/www/html/docroot/modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php).Will have to continue using the patch from #8.
Please reopen the issue as is not fixed.
Comment #16
alina.basarabeanu commentedActually, this issue is related to https://www.drupal.org/project/path_redirect_import/issues/3373025
The patch from 3373025 fixed the issue
Comment #17
tmwagner commentedI concur with #16. The error described in #15 was corrected for us with the patch from https://www.drupal.org/project/path_redirect_import/issues/3373025
Comment #18
lucasvm commentedPatch #11 worked for us, Drupal 10.1.2
Comment #19
rclemings commented@lucasvm: This issue is closed but the issue mentioned in comments #16 and #17 has an identical patch and is RTBC, so it might be better to post any further comments there.
Comment #21
ddavisboxleitner commentedOur team also came to this issue looking for help on the error. We were seeing this after upgrading:
Error: Class "Drupal\migrate_tools\Commands\MigrateToolsCommands" not found in include() (line 27 of /var/www/html/docroot/modules/contrib/path_redirect_import/src/Commands/PathRedirectImportCommands.php).
We agree with #16 as well, the patch from https://www.drupal.org/project/path_redirect_import/issues/3373025 updates the path and resolves the error.