function Module::getSchemaUpdates

Same name in other branches
  1. 9 core/lib/Drupal/Core/Updater/Module.php \Drupal\Core\Updater\Module::getSchemaUpdates()
  2. 8.9.x core/lib/Drupal/Core/Updater/Module.php \Drupal\Core\Updater\Module::getSchemaUpdates()

Returns available database schema updates once a new version is installed.

Return value

array

Deprecated

in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::getAvailableUpdates() instead.

See also

https://www.drupal.org/node/3359445

File

core/lib/Drupal/Core/Updater/Module.php, line 89

Class

Module
Defines a class for updating modules.

Namespace

Drupal\Core\Updater

Code

public function getSchemaUpdates() {
    @trigger_error(__METHOD__ . "() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \\Drupal\\Core\\Update\\UpdateHookRegistry::getAvailableUpdates() instead. See https://www.drupal.org/node/3359445", E_USER_DEPRECATED);
    require_once DRUPAL_ROOT . '/core/includes/install.inc';
    require_once DRUPAL_ROOT . '/core/includes/update.inc';
    if (!self::canUpdate($this->name)) {
        return [];
    }
    \Drupal::moduleHandler()->loadInclude($this->name, 'install');
    if (!\Drupal::service('update.update_hook_registry')->getAvailableUpdates($this->name)) {
        return [];
    }
    $modules_with_updates = update_get_update_list();
    if ($updates = $modules_with_updates[$this->name]) {
        if ($updates['start']) {
            return $updates['pending'];
        }
    }
    return [];
}

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