Problem/Motivation

drupal-check results on commit hash: ac36a9f8d8a2cc730edf8cc654382715ba849adc

> DrupalProject\composer\ScriptHandler::createRequiredFiles
 27/27 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------- 
  Line   config_update_ui/config_update_ui.drush_testing.inc                            
 ------ ------------------------------------------------------------------------------- 
         Class DrushLogLevel was not found while trying to analyse it - autoloading is  
         probably not configured properly.                                              
 ------ ------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------- 
  Line   config_update_ui/src/Commands/ConfigUpdateUiCommands.php  
 ------ ---------------------------------------------------------- 
  31     Call to deprecated method logger() of class Drush\Drush.  
 ------ ---------------------------------------------------------- 

                                                                                          
 [ERROR] Found 2 errors                                                                   
                                                                                          


Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mcdwayne created an issue. See original summary.

jhodgdon’s picture

Title: Drupal 9 Deprecated Code Report » Refactor to not support Drush 8 when Drupal 7 goes away
Status: Active » Postponed

That first deprecation message is not really valid. Seems to be a problem with the static analysis. It's coming from this code:

if (!class_exists('Drush\Log\LogLevel')) {

  /**
   * Mock class for Drush\Log\LogLevel::SUCCESS and ERROR constants.
   *
   * Used in Drush 8's logger for the Config Update CLI service.
   */
  class DrushLogLevel {
    const SUCCESS = 'success';
    const ERROR = 'error';

  }
  class_alias('DrushLogLevel', 'Drush\Log\LogLevel');

}

So, I think we can ignore this.

The second deprecation message about the Drush logger is somewhat valid.
http://www.drush.org/api/master/Drush/Drush.html#method_logger
says:

deprecated Use injected logger instead. 

So, apparently we should be injecting the logger service into our Drush commands service, apparently... though I am not sure if we can do that easily. I don't know if the Drupal services file will inject Drush services? Probably not. So I am inclined to leave this. We need the logger service for interoperability -- to support both Drush 8 and Drush 9. I think we can afford to leave that deprecated code around until we no longer want to support Drush 8... which is I think around the time that Drupal 7 goes away.

When that happens, our Drush code should be refactored so that it no longer attempts to support Drush 8, and no longer calls Drush::logger().

So, I am retitling this issue and postponing it.

jhodgdon’s picture

Title: Refactor to not support Drush 8 when Drupal 7 goes away » Refactor to not support Drush 8 any more
Status: Postponed » Active

Drush 8 doesn't work with Drupal 8 any more at all. We should just stop supporting it, and move to Drush 9. So, un-postponing this.

samaphp’s picture

Thank you all for the efforts, Can you please help to write some details about what we can do to help in this issue?

Many thanks!

jhodgdon’s picture

Yes, what needs to be done is to remove the code in this module that supports Drush 8, and leave in the code that supports Drush 9.

samaphp’s picture

Perfect, thank you for the clarification.

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new46.93 KB

Here's a patch, which I haven't tested. I am not sure if we can create an automated test for the Drush commands... it might not run in the Drupal testing infrastructure, not sure -- it would need Drush to be present, so I guess we'd need to add that to the composer.json for testing only.

So at least this should be tested manually -- we need to see if all of the Drush 9 commands still work.

jhodgdon’s picture

Issue tags: +Needs manual testing
StatusFileSize
new835 bytes
new47.1 KB

OK, the main tests passed. Minor coding standards fix.

bserem’s picture

I just want to mention that Aegir servers still depend on Drush 8, so it might be a good idea to postpone this.

jhodgdon’s picture

But Drush 8 does not work with Drupal 8, as far as I know... right?

jhodgdon’s picture

See http://docs.drush.org/en/master/install/ for compatibility list. Drush 8 no longer works for Drupal 8.4.x and later. As such, this module should not support Drush 8 any more.

bserem’s picture

Aegir and BOA (also an Aegir stack) do not support Drush 9 yet. I do not know the internals of these systems, but they succesfuly use Drush 8 on Drupal 8 and I can assure you that if drush 9/10 is installed through composer things fall apart.

There is a lengthy discussion here: https://www.drupal.org/project/provision/issues/2953349

If you release a -dev version without drush 8 support I can try it on an Aegir system and see how it goes.

jhodgdon’s picture

That's odd, because the Drush project's web site definitely says Drush 8 does not work for Drupal versions after 8.4. I thought I had experienced that myself... is Aegir using a modified version of Drush 8 that does continue to work for later Drupal versions?

bserem’s picture

BOA uses 8.3.2-dev which is compiled upon installation of the Aegir stack from source.
8.3.2 was released on November 2019.

Version 8 is active on github (I wasn't aware of this either): https://github.com/drush-ops/drush/commits/8.x

I can guarantee you that I am running a lot of cim/cex/updb/uli/migrate*/sapi* commands from drush 8 to drupal 8.8+ on Aegir without issues, while at the same time use drush 10 locally. Config_update and config_devel are no exception.

jhodgdon’s picture

OK, well the Drush maintainers need to update their web site then.

jhodgdon’s picture

Status: Needs review » Postponed

I guess if Drush 8 is still supported and still works with Drupal 8/9, we should also postpone this issue. Thanks for bringing up the objection @bserem!

pasqualle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
StatusFileSize
new46.06 KB

reroll

pasqualle’s picture

Status: Postponed » Needs review

Status: Needs review » Needs work

The last submitted patch, 17: 3042621-17.patch, failed testing. View results

pasqualle’s picture

Status: Needs work » Needs review
StatusFileSize
new47.45 KB

  • Pasqualle committed 2cace84 on 2.0.x
    Issue #3042621 by jhodgdon, Pasqualle, bserem: Refactor to not support...
pasqualle’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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