function UpdateHookRegistry::getEquivalentUpdate

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Update/UpdateHookRegistry.php \Drupal\Core\Update\UpdateHookRegistry::getEquivalentUpdate()

Gets the EquivalentUpdate object for an update.

Parameters

string|null $module: The module providing the update. If this is NULL the update to check will be determined from the backtrace.

int|null $version: The update to check. If this is NULL the update to check will be determined from the backtrace.

Return value

\Drupal\Core\Update\EquivalentUpdate|null A value object with the equivalent update information or NULL if the update does not have an equivalent update.

File

core/lib/Drupal/Core/Update/UpdateHookRegistry.php, line 249

Class

UpdateHookRegistry
Provides module updates versions handling.

Namespace

Drupal\Core\Update

Code

public function getEquivalentUpdate(?string $module = NULL, ?int $version = NULL) : ?EquivalentUpdate {
    if ($module === NULL || $version === NULL) {
        [
            $module,
            $version,
        ] = $this->determineModuleAndVersion();
    }
    $data = $this->equivalentUpdates
        ->get($module, []);
    if (isset($data[$version]['ran_update'])) {
        return new EquivalentUpdate($module, $version, $data[$version]['ran_update'], $data[$version]['future_version_string']);
    }
    return NULL;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.