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()

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;
  }
}