Skip to content

Commit

Permalink
Add plumbing for equivalent updates in updatedb (#6056)
Browse files Browse the repository at this point in the history
* Add plumbing for skipped updates

* Update PR for latest changes to core MR

* Run PHPCBF

---------

Co-authored-by: Moshe Weitzman <weitzman@tejasa.com>
  • Loading branch information
alexpott and weitzman authored Jul 23, 2024
1 parent 5e5607a commit dde56a8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Commands/core/UpdateDBCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Consolidation\OutputFormatters\StructuredData\UnstructuredListData;
use Consolidation\SiteAlias\SiteAliasManagerInterface;
use Drupal\Core\Database\Database;
use Drupal\Core\Update\EquivalentUpdate;
use Drupal\Core\Update\UpdateRegistry;
use Drupal\Core\Utility\Error;
use Drush\Attributes as CLI;
Expand Down Expand Up @@ -187,7 +188,16 @@ public static function updateDoOne(string $module, int $number, array $dependenc
\Drupal::moduleHandler()->loadInclude($module, 'install');

$ret = [];
if (function_exists($function)) {
$update_hook_registry = \Drupal::service('update.update_hook_registry');
$equivalent_update = null;
if (method_exists($update_hook_registry, 'getEquivalentUpdate')) {
$equivalent_update = \Drupal::service('update.update_hook_registry')->getEquivalentUpdate($module, $number);
}
if ($equivalent_update && $equivalent_update instanceof EquivalentUpdate) {
$ret['results']['query'] = $equivalent_update->toSkipMessage();
$ret['results']['success'] = true;
$context['sandbox']['#finished'] = true;
} elseif (function_exists($function)) {
try {
if ($context['log']) {
Database::startLog($function);
Expand Down

0 comments on commit dde56a8

Please sign in to comment.