}
/// Check if the guest user exists. If not, create one.
- if (! record_exists("user", "username", "guest")) {
+ if (!$DB->record_exists("user", array("username"=>"guest"))) {
if (! $guest = create_guest_record()) {
notify("Could not create guest user record !!!");
}
$user->id = $old_user->id;
$DB->set_field('user', 'deleted', 0, array('username'=>$user->username));
echo "\t"; print_string('auth_dbreviveuser', 'auth', array($user->username, $user->id)); echo "\n";
- } elseif ($id = insert_record ('user',$user)) { // it is truly a new user
+ } elseif ($id = $DB->insert_record ('user',$user)) { // it is truly a new user
echo "\t"; print_string('auth_dbinsertuser','auth',array($user->username, $id)); echo "\n";
// if relevant, tag for password generation
if ($this->config->passtype === 'internal') {
/// Process letters
$context = get_context_instance(CONTEXT_COURSE, $restore->course_id);
// respect current grade letters if defined
- if ($status and $restoreall and !record_exists('grade_letters', 'contextid', $context->id)) {
+ if ($status and $restoreall and !$DB->record_exists('grade_letters', array('contextid'=>$context->id))) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradeletters','grades').'</li>';
}
return false;
}
- if ($userid && !record_exists('user', 'id', $userid)) {
+ if ($userid && !$DB->record_exists('user', array('id'=>$userid))) {
debugging('User ID '.intval($userid).' does not exist!');
return false;
}
$data = $this->get_record_data();
- if (delete_records($this->table, 'id', $this->id)) {
+ if ($DB->delete_records($this->table, array('id'=>$this->id))) {
if (empty($CFG->disablegradehistory)) {
unset($data->id);
unset($data->timecreated);
}
/// Check if the guest user exists. If not, create one.
- if (! record_exists('user', 'username', 'guest', 'mnethostid', $CFG->mnet_localhost_id)) {
+ if (!$DB->record_exists('user', array('username'=>'guest', 'mnethostid'=>$CFG->mnet_localhost_id))) {
if (! $guest = create_guest_record()) {
notify('Could not create guest user record !!!');
}