You are here

protected function StringDatabaseStorage::checkVersion in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/src/StringDatabaseStorage.php \Drupal\locale\StringDatabaseStorage::checkVersion()

Checks whether the string version matches a given version, fix it if not.

Parameters

\Drupal\locale\StringInterface $string: The string object.

string $version: Drupal version to check against.

2 calls to StringDatabaseStorage::checkVersion()
StringDatabaseStorage::findTranslation in core/modules/locale/src/StringDatabaseStorage.php
Loads a string translation object, fast query.
StringDatabaseStorage::updateLocation in core/modules/locale/src/StringDatabaseStorage.php
Update locations for string.

File

core/modules/locale/src/StringDatabaseStorage.php, line 179
Contains \Drupal\locale\StringDatabaseStorage.

Class

StringDatabaseStorage
Defines a class to store localized strings in the database.

Namespace

Drupal\locale

Code

protected function checkVersion($string, $version) {
  if ($string
    ->getId() && $string
    ->getVersion() != $version) {
    $string
      ->setVersion($version);
    $this->connection
      ->update('locales_source', $this->options)
      ->condition('lid', $string
      ->getId())
      ->fields(array(
      'version' => $version,
    ))
      ->execute();
  }
}