After enable drupalmoduleupgrader and ran : drush dmu-analyze

It throw an exception :

" [Symfony\Component\Console\Exception\CommandNotFoundException]
Command "dmu-analyze" is not defined. "

Drush version : 9.2.1
Drupal version : 8.4.5

I ran other commands : drush dmu-list, drush dmu-upgrade. All shows same message Command is not defined.

Comments

bhagirajlimbu created an issue. See original summary.

andypost’s picture

Title: drush Command "dmu-analyze" is not defined exception » Drush 9 compatibility
Category: Bug report » Task
lmaybury’s picture

I am having the same type of problem. I used to have Drush working (by requiring it through Composer) but now it won't enable modules at all.

For example, I just used: composer require drupal/file_mdm

When I try to enable the module: drush en file_mdm

I get the following error message.

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "pm:enable" is not defined.
Did you mean one of these?
example:table
pm:disable
pm:refresh
pm:download
pm:releases
pm:releasenotes
pm:updatecode
pm:security
pm:info
pm:projectinfo
pm:updatestatus
pmi
pm-info
pm-update
pm-refresh
pm-disable
pm-security
pm-releases
pm-download
pm-updatecode
pm-projectinfo
pm-updatestatus
pm-releasenotes

When I run drush status, I get:

Drupal version : 8.4.5
Site URI : http://example.com/subdir
DB driver : mysql
DB hostname : localhost
DB port : 3306
PHP binary : /Applications/MAMP/bin/php/php7.2.1/bin/php
PHP config : /Applications/MAMP/bin/php/php7.2.1/conf/php.ini
PHP OS : Darwin
Drush script : /usr/local/bin/drush
Drush version : 9.2.1

Is this related to it being Drush 9?

jamesoakley’s picture

+1

And, now that Drupal 8.5 is released, Drush 9.x is a requirement, which means this prevents DMU being used with Drupal 8.5.x

hongpong’s picture

More info here. https://weitzman.github.io/blog/port-to-drush9 I'll take a swing at this.

hongpong’s picture

StatusFileSize
new52.51 KB

My first try at patching this for drush 9 using the auto generator and trying to replace everything.

hongpong’s picture

StatusFileSize
new53.41 KB

OK here is a much better drush 9 adaptation. I seemingly have this working on multisite now to some extent. These bad boys are coming through:

 
dmu:
   dmu:list                                       Lists available plugins.
   dmu:index                                      Indexes a target module.
   dmu:analyze                                    Analyzes a Drupal 7 module and reports the changes needed to port it to Drupal 8.
   dmu:upgrade                                    Upgrades a Drupal 7 module to Drupal 8.

I had to rewrite the options in a way that seemed sane. Also added a scan in modules/custom . I get the following:

 
drush -l http://mysite.com dmu:analyze efchx --path=/var/www/mysite/web/modules/custom/efchx
Indexing...

Array
 [error]  Object of class Drupal\Core\StringTranslation\TranslationManager could not be converted to string OutputFormatter.php:132
 [error]  E_RECOVERABLE_ERROR encountered; aborting. To ignore recoverable errors, run again with --no-halt-on-error
 [error]  Drush command terminated abnormally due to an unrecoverable error.

Taking a wild guess I tried scratching the existing translation thing that I adapted from the old format:
//$this->logger()->info(\Drupal::translation()->translate('Generated a report at @path', ['@path' => $destination]), 'success');
converted to:
$this->logger()->info('Generated a report at @path', ['@path' => $destination], 'success');

I don't think that was the issue but you can see the comments around line 134.

I tried scratching out more \Drupal::translation() commands and that seems to let me wiggle past the problem. I now get

Indexing...
 [error]  Could not find info file in /var/www/mysite/web/modules/custom/efchx
hongpong’s picture

Status: Active » Needs work
hongpong’s picture

StatusFileSize
new53.07 KB

I meant to attach this, this is the slightly earlier version before I knocked out the translates calls so much.

hongpong’s picture

I should add that also my patch on #2942307: Composer install fails is rolled into this as well. Not the best practice of course, but I needed to get the thing working.

upunkt’s picture

@HongPong Any progress? I run a completely new D8 install (no multisite) and tried to get DMU to work without success, so far. After running the patch and clearing the cache the not-defined-error was gone and the translation error appeared. Reading the Weitzman blog entry I ran drush generate drush-command-file also, now the output is nothing at all, unfortunately, I gotta undo this. Can you please include the translation stuff in a patch to help keeping up with your work?

hongpong’s picture

No progress since last update. Did you try the 9B patch? I zapped the translates on that one, its likely better than patch 10 for this issue. (the reason i attached patch 10 was because i think my translate changes were in bad form for the long run - properly we should get the translates working too. but i'm not too sharp on the multilingual side of Drupal)

rdworianyn’s picture

I just tried this with a fresh 8.5.1 installation and haven't had any success.

I downloaded the latest dev of drupalmoduleupgrader
ran composer install
Patched it with 9B
I saw that the commands showed up in drush
drush dmu-analyze my_module - doesn't do anything, no error, just returns to the command prompt.
drush dmu-upgrade my_module - doesn't do anything, no error, just returns to the command prompt.

hongpong’s picture

@rdworianyn is PHP Notice level enabled for PHP CLI on your system? It may spit some informative errors if that is enabled.

kochertj’s picture

Using...

drupalmoduleupgrader 8.x-1.3 patched with 2949601-7-fixdrush9B.patch

Error Message

[error] Drush command terminated abnormally due to an unrecoverable error.
Error: Call to undefined method Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands::_dmu_plugin_list() in /oss/modules.nmnh/htdocs/modules/contrib/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php, line 105

What are my next steps, if any?

Never mind. I fixed this myself.

  • First of all, in src/Commands/DrupalmoduleupgraderCommands.php I changed public function list($plugin_type) to public function listx($plugin_type). The reason is that list is a reserved word.
  • Secondly, I replaced foreach ($this->_dmu_plugin_list('analyzer') as $id) with foreach ($this->listx('analyzer') as $id)
Gerhard Roth’s picture

Thanks for the patch. I used the 9B patch.
When issuing
drush dmu-analyze my_module
I get
Error: Class 'Pharborist\Parser' not found in /srv/www/htdocs/drupal/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Indexer/Classes.php on line 25 #0 /srv/www/htdocs/drupal/web/modules/contrib/drupalmoduleupgrader/src/IndexerBase.php(76): Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Classes->addFile('/srv/www/htdocs...')

The grom358/pharborist programs are successfully installed in vendor directory but obviously not found.

Gerhard Roth’s picture

I also could fix my error myself following the notice of James Kochert + adding

$this->_dmu_ensure_autoload();

as the first line of function _dmu_build_target + adding the full path to the autoload.php
to the locations in function _dmu_ensure_autoload()

With this alterations the classes could be found and one module could be upgraded (as far the module can do so)

But the next module created the next error. I think I create another issue for this

  • HongPong committed 296a095 on 8.x-1.x
    Updating README.txt. Covers Windows issue #2964747, Drush 9 note #...
usurper’s picture

Thank you for the work put into this patch so far. I am wondering if it is still being worked on, as I cannot get it to work as is.

I am using Drupal version: 8.5.4 and Drush version 9.3.0

I applied patch 9B against the latest dev module.
After doing so I got the error "Class 'Pharborist\Parser' not found..." when using the dmu:analyze command as mentioned in comment #16.

After following the instructions in comment #17, I was able to get past that error, but now I get this new error after using the dmu:analyze command...

"Error: Wrong parameters for Exception([string $message [, long $code [, Throwable $previous = NULL]]]) in Exception->__construct() (line 279 of /var/www/docroot/modules/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php)"

I would greatly appreciate any help you can provide.
Thanks!

adamzimmermann’s picture

StatusFileSize
new20.62 KB

I'm not seeing any of the errors noted above, but I did have to downgrade phpdocumentor/reflection-docblock to install this module with composer.

composer require phpdocumentor/reflection-docblock:2.0.*
then...
composer require drupal/drupalmoduleupgrader
...worked without issue.

I was having issues with the patches above though, especially since composer.lock was removed in the latest release.

Attached in a new patch that seems to be working fine for me with Drush 9.

hongpong’s picture

thank you for the feedback and patch, adamzimmermann, usurper, Gerhard Roth, kochertj. Perhaps if a few people can test this on a few modules, we can commit it.

blakemorgan’s picture

With the latest patch, I am getting an "Invalid base path" error.

karolus’s picture

I'm also getting the `invalid base path` error, pointing to target.php, and this is with the latest 8.x-1.3 version of the module. Will be doing some more checks and reporting back. For my Drupal install, I'm running 8.6.1 and Drush 9.4.0.

hongpong’s picture

karolus blakemorgan can you give a little more context, thank you! Also PHP-CLI "Notice" error reporting level may give us more.

karolus’s picture

@HongPong
Thanks for the quick response—as far as PHP-CLI error reporting, what should I be doing to generate this?

Checking the Drupal logs for this install turned up nothing.

Thanks!

karolus’s picture

@HongPong
Another update--I had placed the D7 module where it should be in a D8 workflow, under modules/contrib. When, as a test, I moved it up a layer to modules/, and ran `drush dmu-analyze [module_name]`, it worked fine. I'll try the conversion, and report back!

hongpong’s picture

HI karolus,

Glad to hear that you succeeded running the conversion from modules/ . The DMU is fairly sensitive to which directory the target files are in. I just figured that, if you can get the 'notice' level to display (generally PHP-CLI has its own php.ini file which is mostly known for not having timeout limits on the process, instead of the default for regular PHP/httpd operations) then we might be able to isolate better where the error is.

acnimda’s picture

I recently tested the patch #20 and it works with drupal 8.6.2 if phpdocumentor/reflection-docblock is downgraded.

My workflow:

1.downgrade phpdocumentor/reflection-docblock
$ composer require phpdocumentor/reflection-docblock:2.0.*
2. install drupalmoduleupgrader
$ composer require drupal/drupalmoduleupgrader
3.Safe patch in folder web/modules/contrib/drupalmoduleupgrader
$ git apply -v 2949601-20-fixdrush9.patch
4. check drush dmu:analyze your_D7_module

mjkovacevich’s picture

@Joehoe
Tried to follow your steps with Drupal 8.6.2 and Drush 9.6.0-dev but no joy. The patch applied successfully but I still get 'Command "dmu-analyze" is not defined.' every time I try to run 'drush dmu-analyze d7_module --path=modules/contrib/d7_module'. I presume that was a typo with 'dmu:analyze'? But I tried that too with no joy.

Anonymous’s picture

drush dmu:analyze ok with 2949601-20-fixdrush9.patch. But now another problem :

In Target.php line 69:
Invalid base path:
webchick’s picture

Hey, @adamzimmermann. Thanks for the patch. Would you (or anyone else here) like co-maintianer access to fix this yourself?

adamzimmermann’s picture

I'm going to pass on taking on co-maintainer responsibilities, but I'm glad the patch seems to be helping others.

joseph.olstad’s picture

I have done some preliminary review of this patch. It isn't compatible with drush 8.1.17.
after applying the patch none of the dmu (drupal module upgrader) commands are found even after a cache clear.

I don't know enough yet about the differences between drush 8 and drush 9 to know why.

kavo3’s picture

Can confirm Patch #20 works with Drush version 9.4 and Drupal version 8.6.7.

Varying from @JoeHoe's instructions, I applied the patch via composer.json:

        "patches": {
            "drupal/drupalmoduleupgrader": {
                "Drush 9 compatibility": "https://www.drupal.org/files/issues/2018-08-22/2949601-20-fixdrush9.patch"
            }
        }

Also be sure to enable the module. I got caught up following along and got the "Command not defined" line because I hadn't enabled the module.

geek-merlin’s picture

I can also confirm this works.

I'd suggest to *not* remove the drush8 file so folks stuck with drush8 (there are reasons) are not lost.

joseph.olstad’s picture

yes please reroll the patch and do NOT remove the drush8 file

I prefer using drush8 for compatibility reasons.

No need to remove the drush8 file.

mobile@dpi-art.nl’s picture

I have tried everything what i read in this topic. And i solved the command undefined issue with drush 9, after i solved it with the patch #20, i'am stock with this Error: Class 'Pharborist\Parser' not found in Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->addFile(). This function calls static a method from the Parser class. Which is absolute present in the proper location.

All this happened while execute the dmu:analyze command from the Drupal root dir.

My setup is Drush version 9.5.2
Drupal 8 Version 8.6.7

UPDATE!!!

I have followed the workflow from Joehoe @comment #28
And that worked fore me, but i still have some issues:
1. The clean command is throwing an error not defined.
2. I have analyzed three different D7 custom modules, they show me indexing... after that Done. But no list of code that's going to be changed. However when i give the command upgrade, it is upgrading the code. At this moment i can not say if the upgraded code is good, i didn't have the time to investigate the code. I know it's displaying errors in the frontend, and i have to debug it.

But i wanted to edit my experience until now.

TravisJohnston’s picture

Just to chime in I am trying to get this to work and followed the steps in #28 but now I have a new message if I use drush dmu:anything

There are no commands defined in the "dmu" namespace.

and still get the not defined error if I use dmu-anything with the hyphen.

joseph.olstad’s picture

@TravisJohnston , temporary workaround, install drush 8 , replace drush with a symlink to the version of drush you want to use.

hongpong’s picture

Status: Needs work » Needs review
Issue tags: +Drush-9, +drush command
StatusFileSize
new10.97 KB

@travisjohnston let us know which version of drush you have and make sure to do "drush cr" thanks!

@marcel.krijthe Be advised that this module is best used to detect and report the issues necessary for rewrites, not attempt rewrites. (that was what the main author told me fairly recently!)

Re-roll, this time the patch doesn't remove the drush 8 inc file. This applied OK for me. Let me know how it goes, I think will be at least "OK" with drush 8 and 9 now.

TravisJohnston’s picture

Thanks @HongPong,

Drupal 8.6.10
Drush 9.5.2

I applied your new patch after a fresh download of drupalmoduleupgrader and it worked. However it deletes drush.services.yml, or perhaps it moved it be it's no longer in the root of the module.

Well to clarify, "worked" means I can now run the command. But I see a lot of errors.

when running drush dmu:analyze school_calendar


Indexing...
 [error]  Error: Class 'Pharborist\Parser' not found in Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->addFile() (line 52 of /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Plugin/DMU/Indexer/Functions.php) #0 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/IndexerBase.php(76): Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->addFile('/Users/travis/S...')
#1 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/IndexerBase.php(67): Drupal\drupalmoduleupgrader\IndexerBase->build()
#2 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Target.php(145): Drupal\drupalmoduleupgrader\IndexerBase->bind(Object(Drupal\drupalmoduleupgrader\Target))
#3 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Target.php(167): Drupal\drupalmoduleupgrader\Target->getIndexer('function')
#4 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(250): Drupal\drupalmoduleupgrader\Target->buildIndex()
#5 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(99): Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->_dmu_build_target('school_calendar')
#6 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->analyze('school_calendar', Array)
#7 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#8 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /Users/travis/Sites/d8_play/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /Users/travis/Sites/d8_play/vendor/drush/drush/src/Runtime/Runtime.php(112): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /Users/travis/Sites/d8_play/vendor/drush/drush/src/Runtime/Runtime.php(41): Drush\Runtime\Runtime->doRun(Array)
#17 /Users/travis/Sites/d8_play/vendor/drush/drush/drush.php(66): Drush\Runtime\Runtime->run(Array)
#18 /Users/travis/Sites/d8_play/vendor/drush/drush/drush(4): require('/Users/travis/S...')
#19 {main}. 
Error: Class 'Pharborist\Parser' not found in /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Plugin/DMU/Indexer/Functions.php on line 52 #0 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/IndexerBase.php(76): Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->addFile('/Users/travis/S...')
#1 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/IndexerBase.php(67): Drupal\drupalmoduleupgrader\IndexerBase->build()
#2 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Target.php(145): Drupal\drupalmoduleupgrader\IndexerBase->bind(Object(Drupal\drupalmoduleupgrader\Target))
#3 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Target.php(167): Drupal\drupalmoduleupgrader\Target->getIndexer('function')
#4 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(250): Drupal\drupalmoduleupgrader\Target->buildIndex()
#5 /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Commands/DrupalmoduleupgraderCommands.php(99): Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->_dmu_build_target('school_calendar')
#6 [internal function]: Drupal\drupalmoduleupgrader\Commands\DrupalmoduleupgraderCommands->analyze('school_calendar', Array)
#7 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#8 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#9 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/CommandProcessor.php(178): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /Users/travis/Sites/d8_play/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(302): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /Users/travis/Sites/d8_play/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(971): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /Users/travis/Sites/d8_play/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /Users/travis/Sites/d8_play/vendor/drush/drush/src/Runtime/Runtime.php(112): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /Users/travis/Sites/d8_play/vendor/drush/drush/src/Runtime/Runtime.php(41): Drush\Runtime\Runtime->doRun(Array)
#17 /Users/travis/Sites/d8_play/vendor/drush/drush/drush.php(66): Drush\Runtime\Runtime->run(Array)
#18 /Users/travis/Sites/d8_play/vendor/drush/drush/drush(4): require('/Users/travis/S...')
#19 {main}
Error: Class 'Pharborist\Parser' not found in Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer\Functions->addFile() (line 52 of /Users/travis/Sites/d8_play/modules/drupalmoduleupgrader/src/Plugin/DMU/Indexer/Functions.php).
 [error]  Drush command terminated abnormally due to an unrecoverable error. 

hongpong’s picture

@TravisJohnston have you run the composer install? this may be an issue of composer autoload pointing to the wrong place or something like that. also I did not intend for drush.services.yml to go away, i may have made a mistake in my patch.

TravisJohnston’s picture

I used the following instructions:

  • drush dl drupalmoduleupgrader
  • cd modules/drupalmoduleupgrader
  • composer install
  • drush en drupalmoduleupgrader

But I patched normally without composer.

TravisJohnston’s picture

Well I uninstalled it completely and attempted to install it through composer require but it fails every time with the repeated error of:
Can only install one of: symfony/filesystem[vX.X.X, v4.2.4] (x is incremented about 30+ times for each previous version of symfony. I tried removing symfony from the require section in composer.json and trying again but it still fails in the same way.

My hope was to try installing this way as drush dl is deprecated, and then I was going to user composer.json to apply the patch.

hongpong’s picture

oh if you match the drupal core version of symfony/filesystem it will work without freaking out, i could be wrong but I think it works correctly on any otherwise required version. I addressed an earlier variant of this problem on a previous commit on this module as well. ( https://cgit.drupalcode.org/drupalmoduleupgrader/commit/?id=726c7a7 )

"symfony/filesystem": "~2.8|~3.0",
probably we would need this instead:
"symfony/filesystem": "~2.8|~3.0|~4.2",

TravisJohnston’s picture

Sweet thanks! Will test on Monday.

hongpong’s picture

Good deal - here is the documentation on composer.json versions, if that doesn't swing it: https://getcomposer.org/doc/04-schema.md https://getcomposer.org/doc/articles/versions.md (it's long but the info is in there)

TravisJohnston’s picture

So quick update. Tried a few things and I think I just have this messed up now. So tried downloading the module first, editing the composer.json file and fixing the filesystem dependency and then ran composer install. It reported out fine but didn't do anything. Enabled the module and tried running the commands and they didn't work - but forgot to patch so I patched. The services file disappeared again, but tried commands and still neither dmu:analyze or dmu-analyze worked.

I tried then going back to the root of the site, and ran composer install, but it didn't seem to read the module. So I tried requiring it but that just tries to grab the original repo, not my module folder where I made changes to the composer.json file. So I tried adding a new repo in the root's composer.json file to look at the module directory and ran it. Still was not enabling or requiring the module.

I miss the days of D7 and not using composer so much right now..

tolstoydotcom’s picture

To the patch in #40 I added this to the $locations array:
\Drupal::service('module_handler')->getModule('drupalmoduleupgrader')->getPath() . '/vendor/autoload.php'

Then I added $this->_dmu_validate_command($module); at the start of the analyze and upgrade methods. It shows a warning but otherwise seems to work.

goose2000’s picture

I tried the downgrade #28 - went fine.
Then I just tried the composer install, getting all sorts of trouble about: Conclusion: remove symfony/filesystem v4.2.5

I tried just putting the module in place and installing but, drush finds no commands:
Command "dmu-analyze" is not defined.

Drupal 8.6.13
drush 9.6.2
composer 1.8.4
php 7.2

Composer needs a package manager. 8(

C:\inetpub\wwwroot\drupal8\web>composer require phpdocumentor/reflection-docblock:2.0.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

C:\inetpub\wwwroot\drupal8\web>
C:\inetpub\wwwroot\drupal8\web>composer require drupal/drupalmoduleupgrader
Using version ^1.4 for drupal/drupalmoduleupgrader
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install drupal/drupalmoduleupgrader 1.4.0
    - Conclusion: remove symfony/filesystem v4.2.5
    - Installation request for drupal/drupalmoduleupgrader ^1.4 -> satisfiable by drupal/drupalmoduleupgrader[1.x-dev, 1.4.0].
    - Conclusion: don't install symfony/filesystem v4.2.5
    - drupal/drupalmoduleupgrader 1.x-dev requires symfony/filesystem ~2.8|~3.0 -> satisfiable by symfony/filesystem[2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.33, v2.8.34, v2.8.35, v2.8.36, v2.8.37, v2.8.38, v2.8.39, v2.8.4, v2.8.40, v2.8.41, v2.8.42, v2.8.43, v2.8.44, v2.8.45, v2.8.46, v2.8.47, v2.8.48, v2.8.49, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.16, v3.3.17, v3.3.18, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1,

UPDATE:

was able to downgrade both of these to 3.4 and get the module to install via composer:

C:\inetpub\wwwroot\drupal8\web>composer require symfony/filesystem:3.4.*
C:\inetpub\wwwroot\drupal8\web>composer require symfony/finder:3.4.*

and it went

 C:\inetpub\wwwroot\drupal8\web>composer require drupal/drupalmoduleupgrader
Using version ^1.4 for drupal/drupalmoduleupgrader
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing cebe/markdown (1.0.3): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing grom358/pharborist (dev-master 0db9e51): Cloning 0db9e51299 from cache
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
  - Installing drupal/drupalmoduleupgrader (1.4.0): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

C:\inetpub\wwwroot\drupal8\web>
goose2000’s picture

I got the patch to apply okay, but still no commands for me.

Directory of C:\inetpub\wwwroot\drupal8\web\modules\contrib\drupalmoduleupgrader

04/04/2019  09:35 AM    <DIR>          .
04/04/2019  09:35 AM    <DIR>          ..
04/03/2019  04:14 PM                56 .gitignore
04/03/2019  04:14 PM                 0 .gitmodules
04/04/2019  09:19 AM            11,231 2949601-39-fixdrush9.patch
04/03/2019  04:14 PM               790 composer.json
04/03/2019  04:14 PM    <DIR>          config
04/03/2019  04:14 PM             9,369 drupalmoduleupgrader.drush.inc
04/03/2019  04:14 PM               513 drupalmoduleupgrader.info.yml
04/03/2019  04:14 PM             3,101 drupalmoduleupgrader.module
04/03/2019  04:14 PM             4,028 drupalmoduleupgrader.services.yml
04/03/2019  04:14 PM            18,092 LICENSE.txt
04/03/2019  04:14 PM               454 phpunit.xml.dist
04/03/2019  04:14 PM             6,140 README.txt
04/03/2019  04:14 PM    <DIR>          src
04/03/2019  04:14 PM    <DIR>          templates
04/03/2019  04:14 PM    <DIR>          tests
              11 File(s)         53,774 bytes
               6 Dir(s)  344,467,456,000 bytes free

C:\inetpub\wwwroot\drupal8\web\modules\contrib\drupalmoduleupgrader>
C:\inetpub\wwwroot\drupal8\web\modules\contrib\drupalmoduleupgrader>git apply -v 2949601-39-fixdrush9.patch
Checking patch composer.json...
Checking patch drush.services.yml...
Checking patch src/Commands/DrupalmoduleupgraderCommands.php...
Applied patch composer.json cleanly.
Applied patch drush.services.yml cleanly.
Applied patch src/Commands/DrupalmoduleupgraderCommands.php cleanly.

C:\inetpub\wwwroot\drupal8\web\modules\contrib\drupalmoduleupgrader>

C:\inetpub\wwwroot\drupal8\web>drush dmu-analyze my_module

Command "dmu-analyze" is not defined.

C:\inetpub\wwwroot\drupal8\web>drush dmu:analyze my_module

There are no commands defined in the "dmu" namespace.

joseph.olstad’s picture

Goose, see comment #49 try this

goose2000’s picture

Dang, I worked those into the patch, started with a fresh drupalmoduleupgrader - applied the patch on to it, went cleanly, then checked DrupalmoduleupgraderCommands.php - they were there. But no go, just not finding them. My edits probably bad :

+  /**
+   * Checks for autoload.php, and includes it if it exists or sets an error
+   * if it doesn't.
+   */
+  function _dmu_ensure_autoload() {
+    $locations = [
+      __DIR__ . '/vendor/autoload.php',
+      './vendor/autoload.php',
+      \Drupal::service('module_handler')->getModule('drupalmoduleupgrader')->getPath() . '/vendor/autoload.php',
+    ];
+    foreach ($locations as $location) {
+      if (file_exists($location)) {
+        require_once $location;
+        return;
+      }
+    }
+
+    throw new \Exception('no_autoload', 'autoload.php not found! Did you remember to run composer install from the drupalmoduleupgrader directory?');
+  }

start of analyze()

+  public function analyze($module, array $options = ['only' => null, 'skip' => null, 'path' => null, 'output' => null]) {
+    // See bottom of https://weitzman.github.io/blog/port-to-drush9 for details on what to change when porting a
+    // legacy command.
+    $this->_dmu_validate_command($module);
+    $target = $this->_dmu_build_target($module);
+
+    $total_issues = 0;
+    $report = new Report();

start of upgrade()

+  public function upgrade($module, array $options = ['backup' => null, 'only' => null, 'skip' => null, 'path' => null]) {
+    // See bottom of https://weitzman.github.io/blog/port-to-drush9 for details on what to change when porting a
+    // legacy command.
+    $this->_dmu_validate_command($module);
+    $target = $this->_dmu_build_target($module);
+
joseph.olstad’s picture

StatusFileSize
new1.15 KB
new11.64 KB

ok here's a rolled patch with the suggestion from 49

see interdiff

I have not tested this myself yet.

bajah1701’s picture

Just wanted to thank everyone who have worked on patches for this drush 9 issue. I can confirm that the patch at comment #20 in addition to the edits suggested in comment #15 worked like a charm.

deggertsen’s picture

Patch in #54 seems to have worked for me. Thanks!

deggertsen’s picture

StatusFileSize
new6.64 KB

Alright, I take that back. I was able to get it enabled on the site, but when trying to actually run drush dmu-analyze I get a whole slew of errors. I've attached a file with the output I'm getting.

tclnj’s picture

I'm in the same boat as @TravisJohnston in #41 after patching with #40.

Patching simply results in the Pharborist\Parser error, no matter how it's applied.

joshi.rohit100’s picture

Status: Needs review » Needs work
  1. +++ b/drupalmoduleupgrader.drush.inc
    @@ -128,7 +128,9 @@ function _dmu_plugin_list($plugin_type) {
    +  $path = \Drupal::service('module_handler')->getModule('drupalmoduleupgrader')->getPath();
    

    Do we really need this as assumption for D8 is that user will use the composer.

  2. +++ b/src/Commands/DrupalmoduleupgraderCommands.php
    @@ -0,0 +1,303 @@
    +  function _dmu_get_directory($module) {
    

    not specified access (public/protected) etc

joshi.rohit100’s picture

Adding steps if anyone facing any problem in running command with Drush 9 -

1. Download the latest Drupal (I tried with 8.8) and set up a site.
2. Add the drupalmoduleupgrader via composer (as this has dependencies) by "composer require drupal/drupalmoduleupgrader"
3. Apply the patch in 54. Patch can be applied manually or via git by just replacing the drupalmoduleupgrader module added via composer by git clone.
4.Enable the module
5. Run the command.

joshi.rohit100’s picture

Status: Needs work » Needs review
StatusFileSize
new9.18 KB
new11.7 KB

Patch contains more refinements.

amitgoyal’s picture

Status: Needs review » Reviewed & tested by the community

I was able to apply the patch (#61) successfully.

$ git apply -v 2949601-61.patch
Checking patch composer.json...
Checking patch drupalmoduleupgrader.drush.inc...
Checking patch drush.services.yml...
Checking patch src/Commands/DrupalmoduleupgraderCommands.php...
Applied patch composer.json cleanly.
Applied patch drupalmoduleupgrader.drush.inc cleanly.
Applied patch drush.services.yml cleanly.
Applied patch src/Commands/DrupalmoduleupgraderCommands.php cleanly.

I have also followed the instructions in #60 and was able successfully run drush commands (dmu-analyze, dmu-upgrade, dmu-list etc. ) provided by dmu module.

$ drush dmu-analyze password_reset_tabs
Indexing...
done.
$ drush dmu-upgrade password_reset_tabs
Indexing...
done.

Thanks everyone. Looks good to me!

ashu1629’s picture

I was able to apply the patch (#61) successfully.

Thanks, @joshi.rohit100 for the refined patch.

gábor hojtsy’s picture

I don't think any feature patches are committable until we have tests passing, so let's focus on resolving that. In #3074473: DMU tests don't work with PHP 7 because phpunit version mismatch right now.

gábor hojtsy’s picture

Branch tests are now green, sent for a retest.

nickonom’s picture

On a fresh Drupal 8.7.6 setup with Drush 9.7.1 on CLI, I performed:

composer require drupal/drupalmoduleupgrader
No composer.json in current directory, do you want to use the one at /var/www? [Y,n]? y
    1/1:	https://packages.drupal.org/8/drupal/provider-2019-3$390c97d02e96fdb2ad1d1425127e7ea9ddf6062b535765da93d61b31d0f0473f.json
    Finished: success: 1, skipped: 0, failure: 0, total: 1
    1/4:	http://repo.packagist.org/p/provider-latest$29042a9ca4c18bf5b832d57bddee89c3d6c0bf5e3c2f7992137169d7299775a4.json
    2/4:	http://repo.packagist.org/p/provider-2019-01$c6f73b02b2761c969b55c2a1db6444d32e4138d644fcb00c17ca80dfc0b56649.json
    3/4:	http://repo.packagist.org/p/provider-2019-04$34486c61e9fa96ac6860b664b26e362abc2493bf8ea4b0ea11f2bdb7337c2a87.json
    4/4:	http://repo.packagist.org/p/provider-2019-07$b8e35aaf56774a2f2c73394c97450a5b324543164999e5a487096ce8cb448936.json
    Finished: success: 4, skipped: 0, failure: 0, total: 4
Using version ^1.4 for drupal/drupalmoduleupgrader
./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing drupal/drupalmoduleupgrader (1.4.0): Loading from cache
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
> DrupalProject\composer\ScriptHandler::createRequiredFiles

then:

cd drupalmoduleupgrader/
wget https://www.drupal.org/files/issues/2019-07-27/2949601-61.patch
git apply -v 2949601-61.patch

to only get:

Skipped patch 'composer.json'.
Skipped patch 'drupalmoduleupgrader.drush.inc'.
Skipped patch 'drush.services.yml'.
Skipped patch 'src/Commands/DrupalmoduleupgraderCommands.php'.

So it does not work with Composer installed version. Then I removed the module, cloned it with git and tried the same patch file:

git clone --branch 8.x-1.x https://git.drupalcode.org/project/drupalmoduleupgrader.git
cd drupalmoduleupgrader
wget https://www.drupal.org/files/issues/2019-07-27/2949601-61.patch
git apply -v 2949601-61.patch

to get:

Checking patch composer.json...
Hunk #2 succeeded at 29 (offset -1 lines).
Checking patch drupalmoduleupgrader.drush.inc...
Checking patch drush.services.yml...
Checking patch src/Commands/DrupalmoduleupgraderCommands.php...
Applied patch composer.json cleanly.
Applied patch drupalmoduleupgrader.drush.inc cleanly.
Applied patch drush.services.yml cleanly.
Applied patch src/Commands/DrupalmoduleupgraderCommands.php cleanly.

I am not sure if the further steps failed because of the above hunk, but it gave:

drush en drupalmoduleupgrader
drush dmu-analyze block_anonymous_strings

In Target.php line 69:
                      
  Invalid base path:  
                      

dmu:analyze [--only [ONLY]] [--skip [SKIP]] [--path [PATH]] [--output [OUTPUT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--notify [NOTIFY]] [--druplicon] [--xh-link XH-LINK] [--] <command> <module>
nickonom’s picture

Indicating the full path with --path= it works fine.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/composer.json
    @@ -11,7 +11,8 @@
    +    "php": ">=5.6.0"
    

    Hum, this should be a minimum of 7.0 (as per policy for new Drupal 8.7 installs already, see release notes for Drupal 8.7.0), but more like 7.1, which is the base version we are running automated tests with anyway (and Drupal 8.7.0 suggests to use as minimal version if at all possible).

  2. +++ b/drupalmoduleupgrader.drush.inc
    @@ -128,7 +128,9 @@ function _dmu_plugin_list($plugin_type) {
     function _dmu_ensure_autoload() {
    +  $path = \Drupal::service('module_handler')->getModule('drupalmoduleupgrader')->getPath();
       $locations = [
    +    $path . '/vendor/autoload.php',
    

    How does a vendor directory appear within the module? Why?

  3. +++ b/src/Commands/DrupalmoduleupgraderCommands.php
    @@ -0,0 +1,238 @@
    +   * Upgrades a Drupal 7 module to Drupal 8.
    

    or Drupal 9

  4. +++ b/src/Commands/DrupalmoduleupgraderCommands.php
    @@ -0,0 +1,238 @@
    +  protected function dmuGetDirectory(string $module) {
    +    $search_directories = [
    +      DRUPAL_ROOT . '/modules/' . $module,
    +      DRUPAL_ROOT . '/modules/custom/' . $module,
    +      __DIR__ . '/'. $module,
    +    ];
    

    Is this list sufficient? People above reported that it did not work without the --path option and that is not intended, right? It should find the extension without that.

    What about modules in the sites/*/ directories? @nickonom, in your case, where was the extension that was not automatically found?

    Also, related: instead of "Invalid base path" down the chain, this should fail much more gracefully when the path cannot be identified even before it attempts to do anything with the extension.

gábor hojtsy’s picture

Also, tests rerun still failed with "phpdocumentor/reflection-docblock" ancillary failure. This is due to needing to modify the composer.json and testbot bugs. Once we figure out what is the exact change needed for the composer file, we can commit that first and then run the tests on the rest to ensure nothing else broke (such as with the autoloading change if we need that for some reason).

joshi.rohit100’s picture

Status: Needs work » Postponed

Created issue for the composer fix - #3081087: Require PHP 7.1 for DMU

Marking this postponed till above fixes.

altagrade’s picture

Status: Postponed » Needs work

Mistakenly used our team account. Will post another one...

nickonom’s picture

@nickonom, in your case, where was the extension that was not automatically found?

Gabor, the module was located in the /var/www/web/modules/contrib directory.

And since #3081087: Require PHP 7.1 for DMU has already been marked as fixed, I've changed the status for this issue accordingly.

joshi.rohit100’s picture

Status: Needs work » Needs review
StatusFileSize
new9.7 KB

No interdiff as earlier patch was failed to apply due to recent composer changes and thus created this again.

Patch iterates in /module and /sites directory recursively.

andypost’s picture

Status: Needs review » Needs work
joshi.rohit100’s picture

Status: Needs work » Needs review

For drush9, extra section is not required and will use the default drush.service.yml

In Drush 9, the default services file, drush.services.yml, will be used in instances where there is no services section in the Drush extras of the project's composer.json file.

nickonom’s picture

Does this mean Drush 9 should be a requirement? Shouldn't the module cover the cases when Drush versions other than 9 are used?

For drush9, extra section is not required and will use the default drush.service.yml

In Drush 9, the default services file, drush.services.yml, will be used in instances where there is no services section in the Drush extras of the project's composer.json file.

joshi.rohit100’s picture

@nickonom patch here just adds the support for drush9 as drush9 implementation is different than drush8 or 7.

Support for other drush versions like 8/7 will be working as its working currently as there is no change in that.

andypost’s picture

Actually it's time to make it right because drush 10 is mostly ready and both 9 and 10 should be supported

  • Gábor Hojtsy committed 2ae3595 on 8.x-1.x
    Issue #2949601 by HongPong, joshi.rohit100, joseph.olstad,...
gábor hojtsy’s picture

Status: Needs review » Fixed

Thanks all! Thanks to everyone who helped test, you are amazing!

joseph.olstad’s picture

Note: I imagine that this breaks drush 8 support as it did when I tested previous versions of this solution. We could open a new support issue and provide a backwards compat patch for drush 8 that basically reverts this.

I still use drush 8 because it works with both D8 and D7 sites. However it is pretty easy to switch drush versions.

gábor hojtsy’s picture

@joseph.olstad: hm, people above said it would stand alongside Drush 8 support? How does it break that?

andypost’s picture

It require follow up for 74,78 and 8 vs 9 should not have collisions

There were great article about how to maintain compatibility with both versions, but I can find only refs like https://mzlizz.mit.edu/nuvole-how-maintain-drush-commands-drush-8-and-9-...

joseph.olstad’s picture

I will test this with drush 8 sometime this week.

andypost’s picture

joseph.olstad’s picture

comment #83 has a link to a project that properly allows backwards compatibility with Drush 8 /Drush 9 forward compatible.

the code and effort involved is moderate however I do not have time right now to do this. see link :
https://mzlizz.mit.edu/nuvole-how-maintain-drush-commands-drush-8-and-9-...

here is the git repo: https://github.com/nuvoleweb/config_split

basically the idea is this:

for drush 9:
create a CliService class

pass it into the construct , call the functions through this CliService class that has the functions
one of the parameters is /** DrushCommands->io() **/ "this->io()

in the drush 8 change the function call to use the CliService class but instead of this->io() use a new Drush8Io() class which stands in for \Symfony\Component\Console\Style\StyleInterface with drush 8 so that we don't need to depend on symfony components for drush 8 compatibility,

in the

class SomeDrush9CompatibleClass extends DrushCommands {
  public function ioConverterClassExample($param1 = NULL) {
    $this->cliService->ioConverterClassExample($param1, $this->io(), 'dmu-analyse');
  }
}

so in the drush 8 drupalmoduleupgrader.drush.inc
something like this in drush.inc:

\Drupal::service('plugin.manager.drupalmoduleupgrader.converter')->ioConverterClassExample($param1, new BackCompatDrush8Io(), 'dmu-analyse');

here is the class:

/**
 * Class BackCompatDrush8Io.
 *
 * This is a stand in for \Symfony\Component\Console\Style\StyleInterface with
 * drush 8 so that we don't need to depend on symfony components.
 */
class BackCompatDrush8Io {

  public function confirm($text) {
    return drush_confirm($text);
  }

  public function success($text) {
    drush_log($text, LogLevel::SUCCESS);
  }

  public function error($text) {
    drush_log($text, LogLevel::ERROR);
  }

  public function text($text) {
    drush_log($text, LogLevel::NOTICE);
  }
}

refer to link:
https://mzlizz.mit.edu/nuvole-how-maintain-drush-commands-drush-8-and-9-...

and see how they did it in the git repo: https://github.com/nuvoleweb/config_split

gábor hojtsy’s picture

@joseph.olstad: When you tested Drush 8 support in #33, the patch at the time actively removed the Drush 8 compatibility code. That was not in any of the recent patches, only Drush 9 *additions* were added. So I fail to see how the current state of the module changed anything about Drush 8 compatibility compared to before the patch? Drush 9 defines commands as tagged services while Drush 8 deals with *.drush.inc defined commands. There was no change to the Drush 8 integration code, so it should work as before. It has no new requirements that I can see based on this patch.

That said, a refactoring issue may be in order to refactor the existing Drush 8 support to use common code with the Drush 9 integration.

joseph.olstad’s picture

I tested the dev branch release yesterday with drupal core 8.8.x dev and it no longer works with drush 8
Have you tried it yourself?

andypost’s picture

@joseph.olstad it works for me, did you run composer inside module's dir?
Let's continue it in new issue

/var/www/html/web $ drush version && drush help dmu-list
 Drush Version   :  8.3.0 

Lists available plugins.

Arguments:
 plugin_type                               The plugin type to query. Can be one of: indexer, analyzer, converter, cleaner.
joseph.olstad’s picture

ok ya I had to run composer up...
here is a helpful patch for providing a useful exception message.

gábor hojtsy’s picture

@joseph.olstad: please, open a new issue :)

Status: Fixed » Closed (fixed)

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