Skip to content

Commit

Permalink
GH-5890: fix UpdateRegistry constructor (#5891)
Browse files Browse the repository at this point in the history
  • Loading branch information
bircher authored Mar 8, 2024
1 parent 35840da commit f9186d6
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/Commands/core/DeployHookCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Consolidation\OutputFormatters\StructuredData\UnstructuredListData;
use Consolidation\SiteAlias\SiteAliasManagerInterface;
use Drupal\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
use Drupal\Core\Update\UpdateRegistry;
use Drupal\Core\Utility\Error;
use Drush\Attributes as CLI;
Expand Down Expand Up @@ -49,15 +51,26 @@ public static function getRegistry(): UpdateRegistry
$registry = new class (
\Drupal::getContainer()->getParameter('app.root'),
\Drupal::getContainer()->getParameter('site.path'),
array_keys(\Drupal::service('module_handler')->getModuleList()),
\Drupal::service('keyvalue')->get('deploy_hook')
\Drupal::service('module_handler')->getModuleList(),
\Drupal::service('keyvalue'),
\Drupal::service('theme_handler'),
) extends UpdateRegistry {
public function setUpdateType(string $type): void
{
$this->updateType = $type;
public function __construct(
$root,
$site_path,
$module_list,
KeyValueFactoryInterface $key_value_factory,
ThemeHandlerInterface $theme_handler,
) {
// Do not call the parent constructor, we set the properties directly.
// We need a different key value store and set the update type.
$this->root = $root;
$this->sitePath = $site_path;
$this->enabledExtensions = array_merge(array_keys($module_list), array_keys($theme_handler->listInfo()));
$this->keyValue = $key_value_factory->get('post_update');
$this->updateType = 'deploy';
}
};
$registry->setUpdateType('deploy');

return $registry;
}
Expand Down

0 comments on commit f9186d6

Please sign in to comment.