function taxonomy_update_8003

Generate a UUID for all terms.

File

drupal/core/modules/taxonomy/taxonomy.install, line 340
Install, update and uninstall functions for the taxonomy module.

Code

function taxonomy_update_8003(&$sandbox) {
  if (!isset($sandbox['progress'])) {
    $sandbox['progress'] = 0;
    $sandbox['last'] = 0;
    $sandbox['max'] = db_query('SELECT COUNT(tid) FROM {taxonomy_term_data} WHERE uuid IS NULL')
      ->fetchField();
  }
  $tids = db_query_range('SELECT tid FROM {taxonomy_term_data} WHERE tid > :tid AND uuid IS NULL ORDER BY tid ASC', 0, 10, array(
    ':tid' => $sandbox['last'],
  ))
    ->fetchCol();
  update_add_uuids($sandbox, 'taxonomy_term_data', 'tid', $tids);
  $sandbox['#finished'] = empty($sandbox['max']) ? 1 : $sandbox['progress'] / $sandbox['max'];
}