You are here

function search_api_et_update_7200 in Search API Entity Translation 7.2

Clean {search_api_et_item} table from outdated items.

File

./search_api_et.install, line 147
Install, update and uninstall functions for the Search API ET module.

Code

function search_api_et_update_7200(&$sandbox) {
  $indexes = db_select('search_api_index', 'sai')
    ->fields('sai', array(
    'id',
  ))
    ->distinct('distinct index.id')
    ->execute()
    ->fetchAllAssoc('id');
  $index_ids = array_keys($indexes);
  $res = db_delete('search_api_et_item')
    ->condition('index_id', $index_ids, 'NOT IN')
    ->execute();
}