drush node-access-rebuild-progressive does not work with multisite

Created on 7 April 2021, over 3 years ago
Updated 13 October 2023, about 1 year ago

Problem/Motivation

When calling drush node-access-rebuild-progressive on a specific site, drush php-eval is then called on the default site and fails if the default site is not configured:

> Error: Call to undefined function _drush_node_access_rebuild_progressive_process() in /var/www/vendor/drush/drush/src/Commands/core/PhpCommands.php(29) : eval()'d code on line 1 #0 /var/www/vendor/drush/drush/src/Commands/core/PhpCommands.php(29): eval()
> #1 [internal function]: Drush\Commands\core\PhpCommands->evaluate('_drush_node_acc...', Array)
> #2 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
> #3 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #4 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #5 /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #6 /var/www/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #7 /var/www/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #8 /var/www/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #9 /var/www/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #10 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #11 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
> #13 /var/www/vendor/drush/drush/includes/preflight.inc(18): require('/var/www/vendor...')
> #14 phar:///usr/local/bin/drush/bin/drush.php(143): drush_main()
> #15 /usr/local/bin/drush(14): require('phar:///usr/loc...')
> #16 {main}
>  [warning] Drush command terminated abnormally.

It seems to happen because _drush_node_access_rebuild_progressive_rebuild() creates a new SiteAliasManager manually instead of using the site.alias.manager service, so the self alias is not correctly configured.

Steps to reproduce

  1. Configure a site that is not default.
  2. Create a Drush alias for that site.
  3. Call drush @mysite node-access-rebuild-progressive.

Proposed resolution

NodeAccessRebuildProgressiveCommands should use SiteAliasManagerAwareTrait.

Remaining tasks

I will submit a patch.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France prudloff Lille

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024