You are here

function quiz_update_6410 in Quiz 6.4

Implementation of hook_update_N(). Creating the variable quiz_def_uid. This artificial uid is used when storing the default quiz preferences.

File

./quiz.install, line 296
Quiz install schema for installing the quiz module

Code

function quiz_update_6410() {
  $results = array();
  db_lock_table('users');
  $sql = 'INSERT INTO {users} (name) VALUES(\'def user\')';
  $results[] = update_sql($sql);
  $def_uid = db_last_insert_id('users', 'uid');
  $results[] = update_sql('DELETE FROM {users} WHERE uid = ' . intval($def_uid));
  db_unlock_tables();
  variable_set('quiz_def_uid', $def_uid);
  return $results;
}