You are here

function lingotek_update_7608 in Lingotek Translation 7.7

Set all entities using a custom (one-off) profile to be disabled, as custom profiles are no longer supported.

File

./lingotek.install, line 1050

Code

function lingotek_update_7608(&$sandbox) {

  // change profile from CUSTOM to DISABLED
  db_update('lingotek_entity_metadata')
    ->fields(array(
    'value' => LingotekSync::PROFILE_DISABLED,
  ))
    ->condition('entity_key', 'profile')
    ->condition('value', LingotekSync::PROFILE_CUSTOM)
    ->execute();

  // remove any custom profile settings (no longer relevant)
  $deprecated_keys = array(
    'allow_community_translation',
    'auto_download',
    'auto_upload',
    'lingotek_nodes_translation_method',
    'url_alias_translation',
  );
  foreach ($deprecated_keys as $key) {
    db_delete('lingotek_entity_metadata')
      ->condition('entity_key', $key)
      ->execute();
  }

  // remove the custom profile option from the variable if profiles exist.
  $profiles = variable_get('lingotek_profiles', FALSE);
  if ($profiles !== FALSE) {
    if (isset($profiles['CUSTOM'])) {
      unset($profiles['CUSTOM']);
    }
    variable_set('lingotek_profiles', $profiles);
    return t('Converted all nodes previously assigned to custom profiles to be disabled, and removed related rows that are no longer used.');
  }
}