canUpdate example



  /** * Returns available database schema updates once a new version is installed. * * @return array */
  public function getSchemaUpdates() {
    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'];
      }
Home | Imprint | This part of the site doesn't use cookies.