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

Christopher Riley created an issue. See original summary.

adriancid’s picture

Hi @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 the node_revision_delete_drush_command() function, very weird to me because I tried to use other functions inside the node_revision_delete_drush_command() and they works fine.

Can you take a look to this?

Christopher Riley’s picture

Still 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.

adriancid’s picture

Title: Just updated to latest dev version » Class 'Drupal\node_revision_delete\Utility\Time' not found
Issue summary: View changes

  • adriancid committed 83f44e1 on 8.x-1.x
    Issue #2986433 by Christopher Riley, adriancid, Berdir: Class 'Drupal\...

adriancid credited Berdir.

adriancid’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

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