function update_add_uuids

Helper function to update entities with uuid.

Parameters

array $sandbox: A sandbox where conversion happens.

string $table: A table whose data should be updated.

string $primary_key: A $table primary key column.

array $values: A $primary_key values of rows to be updated.

5 calls to update_add_uuids()
comment_update_8003 in drupal/core/modules/comment/comment.install
Generate a UUID for all comments.
node_update_8006 in drupal/core/modules/node/node.install
Generate a UUID for all nodes.
system_update_8024 in drupal/core/modules/system/system.install
Generate a UUID for all files.
taxonomy_update_8003 in drupal/core/modules/taxonomy/taxonomy.install
Generate a UUID for all terms.
user_update_8009 in drupal/core/modules/user/user.install
Generate a UUID for all users.

File

drupal/core/includes/update.inc, line 1489
Drupal database update API.

Code

function update_add_uuids(&$sandbox, $table, $primary_key, $values) {
  $uuid = new Uuid();
  foreach ($values as $value) {
    db_update($table)
      ->fields(array(
      'uuid' => $uuid
        ->generate(),
    ))
      ->condition($primary_key, $value)
      ->isNull('uuid')
      ->execute();
    $sandbox['progress']++;
    $sandbox['last'] = $value;
  }
}