mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup
This commit is contained in:
parent
a8f3a651c0
commit
fc29e51b2d
@ -366,9 +366,7 @@
|
||||
$rec->new_id = ($new_id === null? 0 : $new_id);
|
||||
$rec->info = $info_to_save;
|
||||
|
||||
if (!$DB->insert_record('backup_ids', $rec, false)) {
|
||||
$status = false;
|
||||
}
|
||||
$DB->insert_record('backup_ids', $rec, false);
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
@ -1265,13 +1265,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
}
|
||||
|
||||
// Add record
|
||||
if(!$DB->insert_record('course_modules_completion',$data)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "<p>Failed to insert completion data record.</p>";
|
||||
}
|
||||
$status=false;
|
||||
continue;
|
||||
}
|
||||
$DB->insert_record('course_modules_completion',$data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1306,13 +1300,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
// Grade id is not converted (convert later)
|
||||
|
||||
// Add record
|
||||
if(!$DB->insert_record('course_modules_availability',$data)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
echo "<p>Failed to insert availability data record.</p>";
|
||||
}
|
||||
$status=false;
|
||||
continue;
|
||||
}
|
||||
$DB->insert_record('course_modules_availability',$data);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -3565,9 +3553,8 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
//The structure is equal to the db, so insert the groups_members
|
||||
if ($DB->record_exists("groups_members", array('groupid'=>$group_member->groupid, 'userid'=>$group_member->userid))) {
|
||||
// user already member
|
||||
} else if (!$DB->insert_record ("groups_members", $group_member)) {
|
||||
$status = false;
|
||||
continue;
|
||||
} else {
|
||||
$DB->insert_record ("groups_members", $group_member);
|
||||
}
|
||||
|
||||
//Do some output
|
||||
@ -3689,9 +3676,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
$gro_member->groupid = $group->new_id;
|
||||
$gro_member->groupingid = $grouping->new_id;
|
||||
if (!$DB->get_record('groupings_groups', array('groupid'=>$gro_member->groupid, 'groupingid'=>$gro_member->groupingid))) {
|
||||
if (!$DB->insert_record('groupings_groups', $gro_member)) {
|
||||
$status = false;
|
||||
}
|
||||
$DB->insert_record('groupings_groups', $gro_member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1155,9 +1155,7 @@ function course_set_display($courseid, $display=0) {
|
||||
$record->userid = $USER->id;
|
||||
$record->course = $courseid;
|
||||
$record->display = $display;
|
||||
if (!$DB->insert_record("course_display", $record)) {
|
||||
notify("Could not save your course display!");
|
||||
}
|
||||
$DB->insert_record("course_display", $record);
|
||||
}
|
||||
|
||||
return $USER->display[$courseid] = $display; // Note: = not ==
|
||||
|
@ -167,9 +167,7 @@
|
||||
|
||||
// ALL CLEAR !
|
||||
|
||||
if (!$DB->insert_record("enrol_paypal", $data)) { // Insert a transaction record
|
||||
message_paypal_error_to_admin("Error while trying to insert valid transaction", $data);
|
||||
}
|
||||
$DB->insert_record("enrol_paypal", $data);
|
||||
|
||||
if (!enrol_into_course($course, $user, 'paypal')) {
|
||||
message_paypal_error_to_admin("Error while trying to enrol ".fullname($user)." in '$course->fullname'", $data);
|
||||
|
@ -447,13 +447,7 @@ if ($formdata = $mform->get_data()) {
|
||||
$newgrade->importcode = $importcode;
|
||||
$newgrade->userid = $studentid;
|
||||
$newgrade->importer = $USER->id;
|
||||
if (!$DB->insert_record('grade_import_values', $newgrade)) {
|
||||
// could not insert into temporary table
|
||||
$status = false;
|
||||
import_cleanup($importcode);
|
||||
notify(get_string('importfailed', 'grades'));
|
||||
break 2;
|
||||
}
|
||||
$DB->insert_record('grade_import_values', $newgrade);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,12 +110,7 @@ function import_xml_grades($text, $course, &$error) {
|
||||
}
|
||||
|
||||
// insert this grade into a temp table
|
||||
if (!$DB->insert_record('grade_import_values', $newgrade)) {
|
||||
$status = false;
|
||||
// could not insert into temp table
|
||||
$error = get_string('importfailed', 'grades');
|
||||
break;
|
||||
}
|
||||
$DB->insert_record('grade_import_values', $newgrade);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -1335,9 +1335,7 @@ function save_question_session($question, $state) {
|
||||
$session->sumpenalty = $state->sumpenalty;
|
||||
$session->manualcomment = $state->manualcomment;
|
||||
$session->flagged = !empty($state->newflaggedstate);
|
||||
if (!$DB->insert_record('question_sessions', $session)) {
|
||||
return false;
|
||||
}
|
||||
$DB->insert_record('question_sessions', $session);
|
||||
} else {
|
||||
$session->newest = $state->id;
|
||||
if (question_state_is_graded($state) or $state->event == QUESTION_EVENTOPEN) {
|
||||
|
@ -6,8 +6,6 @@ function xmldb_message_email_install() {
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'email';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ function email_install(){
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'email';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ function xmldb_message_jabber_install(){
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'jabber';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
@ -42,8 +42,6 @@ function jabber_install(){
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'jabber';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
@ -7,8 +7,6 @@ function xmldb_message_popup_install() {
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'popup';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
@ -42,9 +42,7 @@ function popup_install(){
|
||||
|
||||
$provider = new object();
|
||||
$provider->name = 'popup';
|
||||
if (!$DB->insert_record('message_processors', $provider)) {
|
||||
$return = false;
|
||||
}
|
||||
$DB->insert_record('message_processors', $provider);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,7 @@ class message_output_popup extends message_output{
|
||||
$procmessage->unreadmessageid = $message->id;
|
||||
$procmessage->processorid = $processor->id;
|
||||
|
||||
if ( !$DB->insert_record('message_working', $procmessage) ) {
|
||||
return false;
|
||||
}
|
||||
$DB->insert_record('message_working', $procmessage);
|
||||
|
||||
//should only save this message for later delivery
|
||||
return true;
|
||||
|
@ -248,10 +248,7 @@
|
||||
}
|
||||
$newitem->required = intval($item['@']['REQUIRED']);
|
||||
$newitem->position = $position;
|
||||
if (!$DB->insert_record('feedback_item', $newitem)) {
|
||||
$error->stat = false;
|
||||
$error->msg[] = 'item ('.$newitem->name.') not imported';
|
||||
}
|
||||
$DB->insert_record('feedback_item', $newitem);
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
@ -52,8 +52,8 @@
|
||||
$sql = "SELECT id, feedbackid
|
||||
FROM {feedback_sitecourse_map}
|
||||
WHERE feedbackid = ? AND courseid = ?";
|
||||
if (!$DB->get_records_sql($sql, array($map->feedbackid, $map->courseid)) && !$DB->insert_record('feedback_sitecourse_map', $map)) {
|
||||
print_error('cannotmapfeedback', 'feedback');
|
||||
if (!$DB->get_records_sql($sql, array($map->feedbackid, $map->courseid))) {
|
||||
$DB->insert_record('feedback_sitecourse_map', $map);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -573,9 +573,7 @@ function forum_cron() {
|
||||
$queue->discussionid = $discussion->id;
|
||||
$queue->postid = $post->id;
|
||||
$queue->timemodified = $post->created;
|
||||
if (!$DB->insert_record('forum_queue', $queue)) {
|
||||
mtrace("Error: mod/forum/cron.php: Could not queue for digest mail for id $post->id to user $userto->id ($userto->email) .. not trying again.");
|
||||
}
|
||||
$DB->insert_record('forum_queue', $queue);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -508,9 +508,7 @@
|
||||
$branch->flag = $branchflag;
|
||||
$branch->timeseen = time();
|
||||
|
||||
if (!$DB->insert_record("lesson_branch", $branch)) {
|
||||
print_error("Error: could not insert row into lesson_branch table");
|
||||
}
|
||||
$DB->insert_record("lesson_branch", $branch);
|
||||
|
||||
// this is called when jumping to random from a branch table
|
||||
if($newpageid == LESSON_UNSEENBRANCHPAGE) {
|
||||
|
@ -1058,9 +1058,7 @@ function quiz_after_add_or_update($quiz) {
|
||||
$feedback->feedbacktext = $quiz->feedbacktext[$i];
|
||||
$feedback->mingrade = $quiz->feedbackboundaries[$i];
|
||||
$feedback->maxgrade = $quiz->feedbackboundaries[$i - 1];
|
||||
if (!$DB->insert_record('quiz_feedback', $feedback, false)) {
|
||||
return "Could not save quiz feedback.";
|
||||
}
|
||||
$DB->insert_record('quiz_feedback', $feedback, false);
|
||||
}
|
||||
|
||||
// Update the events relating to this quiz.
|
||||
|
@ -1688,11 +1688,7 @@ class default_questiontype {
|
||||
foreach ($extraquestionfields as $field) {
|
||||
$record->$field = backup_todb($recordinfo['#'][strtoupper($field)]['0']['#']);
|
||||
}
|
||||
if (!$DB->insert_record($questionextensiontable, $record)) {
|
||||
echo "Can't insert record in $questionextensiontable when restoring " .
|
||||
$this->name() . ' question id ' . $question;
|
||||
$status = false;
|
||||
}
|
||||
$DB->insert_record($questionextensiontable, $record);
|
||||
}
|
||||
//TODO restore extra data in answers
|
||||
return $status;
|
||||
|
Loading…
x
Reference in New Issue
Block a user