Problem/Motivation

I needed to install devel_entity_updates on my core/contrib environment because the new drupal core path_alias module didn't update the PathAlias correctly when i updated 9.0.x branch. However with drush/drush:^10, entup fails with the following error:

[error]  Error: Call to undefined function Drupal\devel_entity_updates\Commands\drush_drupal_cache_clear_all() in Drupal\devel_entity_updates
\Commands\DevelEntityUpdatesCommands->entityUpdates() (line 66 of /var/www/html/modules/devel_entity_updates/src/Commands/DevelEntityUpdatesCo
mmands.php)

Proposed resolution

Remaining tasks

API changes

Probably

Comments

mradcliffe created an issue. See original summary.

mradcliffe’s picture

Note, the functionality still works, but the command fails afterward.

plach’s picture

Could you please provide also the steps to reproduce the original error with path_alias? It might be something worth fixing in core rather than relying on drush entup.

Of course we also need to take care of the error reported in the IS.

mradcliffe’s picture

I don't think there is an issue with a releasable version of core.

I was on 9.0.x from probably last weekend, installed Drupal minimal, did some things, realized I was out-of-date, updated, ran database updates, then status was reporting the entity definitions needed to be updated.

I'm not sure on the exact commit I was on in 9.0.x, but I think it was before path_alias module. I'm not too worried about it being a core issue.

plach’s picture

Ok, thanks for the info.

arkener’s picture

Status: Active » Needs review
StatusFileSize
new1.28 KB

drush_drupal_cache_clear_all() has been removed from Drush 10. The attached patch which will fix the cache clear functionality on both Drush9 and Drush10.

plach’s picture

Status: Needs review » Needs work

This will make the new release require Drush 9.6.0 and above. We need to add a composer.json file making this requirement explicit.

plach’s picture

@Arkener:

Thanks for the patch, btw! Much appreciated :)

arkener’s picture

Status: Needs work » Needs review
StatusFileSize
new2.34 KB

Good catch! I've added a composer.json file with a dependency on 9.6, when using Drush 9.

mortona2k’s picture

+1 for #9.

The patch applies to 8.8.0 and works without error.
The code looks good - it creates composer.json and uses SiteAlias to call the drush clear cache command instead of drush_drupal_cache_clear_all() as per the change record mentioned in #6.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Seemed to fix the drush integration and is straight forward

plach’s picture

The patch looks great, but I was wondering on a second thought whether it would make sense to just check whether the drush_drupal_cache_clear_all() function exists and only use the new logic if it doesn't, this way we can keep BC with older Drush versions. The composer.json looks great and could stay, we would only need to strip out the conflict section.

arkener’s picture

The issue with checking if the drush_drupal_cache_clear_all() function exists is the fact that the Consolidation based SiteAliasManagerAware implementations aren't available until Drush 9.4. This means that we'd have to implement Drush::aliasManager()->getSelf(); to retrieve the current site alias. This implementation has been deprecated on Drush 9.6, which most likely means that this issue will return when Drush::aliasManager()->getSelf(); is removed.

joelpittet’s picture

@plach what about cutting a 2.x version for this and avoid the BC "standing on your head" workarounds?

  • plach committed 70aca7c on 8.x-2.x authored by Arkener
    Issue #3093421 by Arkener, plach, mradcliffe, joelpittet, mortona2k:...
plach’s picture

Status: Reviewed & tested by the community » Fixed

@joelpittet:

Good call! Committed and pushed to 8.x-2.x, thanks!

plach’s picture

Version: 8.x-1.x-dev » 8.x-2.0-rc1
joelpittet’s picture

Sweet, thanks @plach and @Arkener!

Status: Fixed » Closed (fixed)

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