function comment_update_8003

Generate a UUID for all comments.

Related topics

File

drupal/core/modules/comment/comment.install, line 374
Install, update and uninstall functions for the Comment module.

Code

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