Problem/Motivation
There is an error in the drush command file, once you try to clean the cache this message is shown:
[error] Drush command terminated abnormally due to an unrecoverable error.
Error: Uncaught Error: Class 'Drupal\node_revision_delete\Utility\Time' not found in /Users/adriancid/Sites/drupal84-test/modules/drupal.org/node_revision_delete/node_revision_delete.drush.inc:34
Stack trace:
#0 /Users/adriancid/drush/includes/command.inc(1037): node_revision_delete_drush_command()
#1 /Users/adriancid/drush/commands/core/topic.drush.inc(38): drush_get_commands()
#2 /Users/adriancid/drush/includes/command.inc(1437): topic_drush_help_alter(Array)
#3 /Users/adriancid/drush/includes/command.inc(652): drush_command_invoke_all_ref('drush_help_alte...', Array)
#4 /Users/adriancid/drush/includes/command.inc(545): _drush_get_command_options(Array)
#5 /Users/adriancid/drush/includes/command.inc(168): _drush_verify_cli_options(Array)
#6 /Users/adriancid/drush/lib/Drush/Boot/BaseBoot.php(73): drush_dispatch(Array)
#7 /Users/adriancid/drush/includes/preflight.inc(89): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /Users/adriancid/drush/drush.php(11): drush_main()
#9 {main}
thrown in /Users/adriancid/Sites/drupal84-test/modules/drupal.org/node_revision_delete/node_revision_delete.drush.inc, line 34
Proposed resolution
Hardcode the values as it seems that Drupal is not fully bootstraped when hook_drush_command() is called and is not possible to call modules functions or services.
More info at Class not found in drush command definition
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
adriancidHi @Christopher Riley I know about the error and is very weird because if you clean the cache from the user interface all will works fine. And if you go to see the code in the drush commands file you will see this line:
use Drupal\node_revision_delete\Utility\Time;The
Time::convertWordToTime()method is used many times in the file and the error only is trigered in thenode_revision_delete_drush_command()function, very weird to me because I tried to use other functions inside thenode_revision_delete_drush_command()and they works fine.Can you take a look to this?
Comment #3
Christopher Riley commentedStill getting the same issue the site works fine as near as I can tell but I can no longer run Drush 8 commands. I am going to disable the module and will investigate it further when I have time since no one else is reporting this issue.
Comment #4
adriancidComment #7
adriancid