$localuser->mnethostid = $remotepeer->id;
- $bool = $DB->update_record('user', $localuser);
- if (!$bool) {
- // TODO: Jonathan to clean up mess
- // Actually, this should never happen (modulo race conditions) - ML
- print_error("cannotupdateuser");
- }
+ $DB->update_record('user', $localuser);
// set up the session
$mnet_session = $DB->get_record('mnet_session',
$string['cannotunzipfile'] = 'Cannot unzip file';
$string['cannotupdaterecord'] = 'Could not update record ID $a';
$string['cannotupdatemod'] = 'Could not update $a';
-$string['cannotupdateuser'] = 'Updating user failed';
$string['cannotupdateusermsgpref'] = 'Cannot update user message preferences';
$string['cannotupdateuseronexauth'] = 'Failed to update user data on external auth: $a. See the server logs for more details.';
$string['cannotupdatepasswordonextauth'] = 'Failed to update password on external auth: $a. See the server logs for more details.';
$string['cannotupdateprofile'] = 'Error updating user record';
$string['cannotupdaterss'] = 'Cannot update RSS';
-$string['cannotupdatesecret'] = 'Error resetting user secret string';
$string['cannotupdatesubcourse'] = 'Could not update a child course!';
$string['cannotuploadfile'] = 'Error processing upload file';
$string['cannotunassignrolefrom'] = 'Cannot unassign this user from role id: $a';
$string['cannotsubscribe'] = 'Sorry, but you must be a group member to subscribe.';
$string['cannotsplit'] = 'Discussions from this forum cannot be split';
$string['cannotunsubscribe'] = 'Could not unsubscribe you from that forum';
-$string['cannotupdatecoursemoudle'] = 'Could not update course module with section id';
$string['cannotupdatepost'] = 'You can not update this post';
$string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
$string['cannotreply'] = 'You cannot reply to this post';
$string['cannotaddstrrecord'] = 'Could not add string record';
$string['cannotfindmethod'] = 'Template block expand method not found: ($a)';
$stirng['cannotinsertattempt'] = 'Could not insert attempt record: $a';
-$string['cannotupdateattempt'] = 'Could not update attempt record: $a';
$string['checks'] = 'Checks';
$string['clickreporting'] = 'Enable click reporting';
$string['clues'] = 'Clues';
$string['cannotfindanswer'] = 'Cannot find answer';
$string['cannotfindattempt'] = 'Error: could not find attempt';
$string['cannotfindessay'] = 'Error: could not find essay';
-$string['cannotupdateessayscore'] = 'Could not update essay score';
$string['cannotfindfirstpage'] = 'Could not find first page';
$string['cannotfindfirstgrade'] = 'Error: could not find grades';
$string['cannotfindgrade'] = 'Could not find Grade Records';
$string['back'] = 'Back';
$string['blockdeletingfile'] = 'Block deleting of referenced files';
$string['browserepository'] = 'Browse repository';
-$string['cannotupdate'] = 'Cannot update resource.';
$string['choose'] = 'Choose';
$string['chooseafile'] = 'Choose or upload a file';
$string['chooseparameter'] = 'Choose parameter';
// Clear secret so that it can not be used again
$user->secret = '';
- if (!$DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id))) {
- print_error('cannotupdatesecret');
- }
+ $DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id));
reset_login_count();
// set 'secret' string
$user->secret = random_string(15);
- if (!$DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id))) {
- print_error('cannotupdatesecret');
- }
+ $DB->set_field('user', 'secret', $user->secret, array('id'=>$user->id));
if (!send_password_change_confirmation_email($user)) {
print_error('cannotmailconfirm');
if (($chatuser->course != $course->id) or ($chatuser->userid != $USER->id)) {
return false;
}
- if (!$DB->update_record('chat_users', $chatuser)) {
- return false;
- }
+ $DB->update_record('chat_users', $chatuser);
+
} else {
$chatuser = new object();
$chatuser->chatid = $chatid;
}
- if (!$DB->insert_record('chat_users', $chatuser)) {
- return false;
- }
+ $DB->insert_record('chat_users', $chatuser);
if ($version == 'sockets') {
// do not send 'enter' message, chatd will do it
}
$oldcontent = $DB->get_record('data_content', array('fieldid'=>$field->id, 'recordid'=>$recordid));
$content->id = $oldcontent->id;
- if (! $DB->update_record('data_content', $content)) {
- print_error('cannotupdaterecord', '', '', $recordid);
- }
+ $DB->update_record('data_content', $content);
}
$recordsadded++;
print get_string('added', 'moodle', $recordsadded) . ". " . get_string('entry', 'data') . " (ID $recordid)<br />\n";
if (!$sectionid = add_mod_to_section($mod)) {
print_error('cannotaddteacherforumto', 'forum');
} else {
- if (!$DB->set_field('course_modules', 'section', $sectionid, array('id' => $cmid))) {
- print_error('cannotupdatecoursemoudle', 'forum');
- }
+ $DB->set_field('course_modules', 'section', $sectionid, array('id' => $cmid));
}
}
//We get the section's visible field status
$visible = $DB->get_field("course_sections", "visible", array("id"=>$sectionid));
- if (! $DB->set_field("course_modules", "visible", $visible, array("id"=>$mod->coursemodule))) {
- print_error('cannotupdatemod', '', '', $mod->coursemodule);
- }
+ $DB->set_field("course_modules", "visible", $visible, array("id"=>$mod->coursemodule));
+ $DB->set_field("course_modules", "section", $sectionid, array("id"=>$mod->coursemodule));
- if (! $DB->set_field("course_modules", "section", $sectionid, array("id"=>$mod->coursemodule))) {
- print_error('cannotupdatemod', '', '', $mod->coursemodule);
- }
add_to_log($course->id, "course", "add mod",
"../mod/$mod->modulename/view.php?id=$mod->coursemodule",
"$mod->modulename $mod->instance");
$attempt->details = $attempt->details;
// update the attempt record
- if (! $DB->update_record("hotpot_attempts", $attempt)) {
- print_error('cannotupdateattempt', 'hotpot', $next_url, $DB->get_last_error());
- }
+ $DB->update_record("hotpot_attempts", $attempt);
// update grades for this user
hotpot_update_grades($hotpot, $attempt->userid);
$attempt->details = $DB->get_field('hotpot_details', 'details', array('attempt'=>$attempt->id));
if ($attempt->details) {
hotpot_add_attempt_details($attempt);
- if (! $DB->update_record('hotpot_attempts', $attempt)) {
- print_error('cannotupdateattempt', 'hotpot', $next_url, $DB->get_last_error());
- }
+ $DB->update_record('hotpot_attempts', $attempt);
}
$attemptcount++;
}
}
// update $thishotpot, if required
- if ($require_update && !$DB->update_record("hotpot", $thishotpot)) {
- print_error('cannotupdatemod', '',
- 'view.php?id='.$hotpot->course, $hotpot->modulename);
+ if ($require_update) {
+ $DB->update_record("hotpot", $thishotpot);
}
}
} // end foreach $ids
}
$timer->lessontime = time();
- if (!$DB->update_record("lesson_timer", $timer)) {
- print_error("Error: could not update lesson_timer table");
- }
+ $DB->update_record("lesson_timer", $timer);
}
// record answer (if necessary) and show response (if none say if answer is correct or not)
$attempt->useranswer = serialize($essayinfo);
- if (!$DB->update_record('lesson_attempts', $attempt)) {
- print_error('cannotupdateessayscore', 'lesson');
- }
+ $DB->update_record('lesson_attempts', $attempt);
// Get grade information
$grade = current($grades);
// Set and update
$updategrade->id = $grade->id;
$updategrade->grade = $gradeinfo->grade;
- if($DB->update_record('lesson_grades', $updategrade)) {
- // Log it
- add_to_log($course->id, 'lesson', 'update grade', "essay.php?id=$cm->id", $lesson->name, $cm->id);
-
- lesson_set_message(get_string('changessaved'), 'notifysuccess');
- } else {
- lesson_set_message(get_string('updatefailed', 'lesson'));
- }
+ $DB->update_record('lesson_grades', $updategrade);
+ // Log it
+ add_to_log($course->id, 'lesson', 'update grade', "essay.php?id=$cm->id", $lesson->name, $cm->id);
+
+ lesson_set_message(get_string('changessaved'), 'notifysuccess');
// update central gradebook
lesson_update_grades($lesson, $grade->userid);
$options->choose = $question->choose;
if ($existing = $DB->get_record("quiz_randomsamatch", array("question" => $options->question))) {
$options->id = $existing->id;
- if (!$DB->update_record("quiz_randomsamatch", $options)) {
- $result->error = "Could not update quiz randomsamatch options!";
- return $result;
- }
+ $DB->update_record("quiz_randomsamatch", $options);
} else {
- if (!$DB->insert_record("quiz_randomsamatch", $options)) {
- $result->error = "Could not insert quiz randomsamatch options!";
- return $result;
- }
+ $DB->insert_record("quiz_randomsamatch", $options);
}
break;
$result->error = "Could not update multianswer alternatives! (id=$multianswer->id)";
return $result;
}
- if (!$DB->update_record("quiz_multianswers", $multianswer)) {
- $result->error = "Could not update quiz multianswer! (id=$multianswer->id)";
- return $result;
- }
+ $DB->update_record("quiz_multianswers", $multianswer);
} else { // This is a completely new answer
$multianswer = new stdClass;
$multianswer->question = $question->id;
$result->error = "Could not insert multianswer alternatives! (questionid=$question->id)";
return $result;
}
- if (!$DB->insert_record("quiz_multianswers", $multianswer)) {
- $result->error = "Could not insert quiz multianswer!";
- return $result;
- }
+ $DB->insert_record("quiz_multianswers", $multianswer);
}
}
break;
if ($grade = $DB->get_record('quiz_grades', array('quiz' => $quiz->id, 'userid' => $userid))) {
$grade->grade = $bestgrade;
$grade->timemodified = time();
- if (!$DB->update_record('quiz_grades', $grade)) {
- notify('Could not update best grade');
- return false;
- }
+ $DB->update_record('quiz_grades', $grade);
} else {
$grade->quiz = $quiz->id;
$grade->userid = $userid;
$grade->grade = $bestgrade;
$grade->timemodified = time();
- if (!$DB->insert_record('quiz_grades', $grade)) {
- notify('Could not insert new best grade');
- return false;
- }
+ $DB->insert_record('quiz_grades', $grade);
}
quiz_update_grades($quiz, $userid);
/// save the attempt and redirect to the next page.
if (!$finishattempt) {
$attempt->timemodified = $timenow;
- if (!$DB->update_record('quiz_attempts', $attempt)) {
- quiz_error($attemptobj->get_quiz(), 'saveattemptfailed');
- }
+ $DB->update_record('quiz_attempts', $attempt);
redirect($nexturl);
}
/// Update the quiz attempt record.
$attempt->timemodified = $timenow;
$attempt->timefinish = $timenow;
-if (!$DB->update_record('quiz_attempts', $attempt)) {
- quiz_error($attemptobj->get_quiz(), 'saveattemptfailed');
-}
+$DB->update_record('quiz_attempts', $attempt);
if (!$attempt->preview) {
/// Record this user's best grade (if this is not a preview).
$updates = true;
$status .= "<li><a href=\"$CFG->wwwroot/mod/resource/view.php?id=$resource->cmid\" target=\"_blank\">$resource->name</a>: $resource->reference ==> $r->reference</li>";
if (!empty($CFG->resource_autofilerename)) {
- if (!$DB->update_record('resource', $r)) {
- print_error('cannotupdate', 'resource');
- }
+ $DB->update_record('resource', $r);
}
}
}
}
$scorm->grademethod = ($scorm->whatgrade * 10) + $scorm->grademethod;
- if (!$DB->update_record('scorm', $scorm)) {
- return false;
- }
+ $DB->update_record('scorm', $scorm);
$scorm = $DB->get_record('scorm', array('id'=>$scorm->id));