You are here

function entity_translation_upgrade_complete in Entity Translation 7

Removes the translation sets for all the upgraded nodes.

2 string references to 'entity_translation_upgrade_complete'
drush_entity_translation_upgrade in entity_translation_upgrade/entity_translation_upgrade.drush.inc
Implements drush_hook_COMMAND().
entity_translation_upgrade_start in entity_translation_upgrade/entity_translation_upgrade.admin.inc
Starts the batch process to perform the upgrade.

File

entity_translation_upgrade/entity_translation_upgrade.admin.inc, line 200
Converts node translations into field-based translations.

Code

function entity_translation_upgrade_complete(&$context) {
  if ($nids = db_query('SELECT DISTINCT etuh.tnid FROM {entity_translation_upgrade_history} etuh WHERE etuh.complete = 0')
    ->fetchCol()) {

    // Remove translation sets for migrated nodes.
    db_query('UPDATE {node} SET tnid = 0 WHERE nid IN (:nids)', array(
      ':nids' => $nids,
    ));
    entity_get_controller('node')
      ->resetCache($nids);

    // Mark nodes as migrated.
    db_query('UPDATE {entity_translation_upgrade_history} SET complete = 1 WHERE complete = 0');
  }
}