You are here

function lingotek_post_update_lingotek_metadata_dependencies in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 lingotek.post_update.php \lingotek_post_update_lingotek_metadata_dependencies()

Fix lingotek metadata entities with dependencies on config entities which names were wrongly calculated.

File

./lingotek.post_update.php, line 14

Code

function lingotek_post_update_lingotek_metadata_dependencies() {
  $metadatas = LingotekConfigMetadata::loadMultiple();
  array_walk($metadatas, function (LingotekConfigMetadata $metadata) {
    $old_dependencies = $metadata
      ->getDependencies();
    $new_dependencies = $metadata
      ->calculateDependencies()
      ->getDependencies();
    if ($old_dependencies !== $new_dependencies) {
      $metadata
        ->save();
    }
  });
}