mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup
This commit is contained in:
parent
a8c31db2a3
commit
0bcf8b6f0d
10 changed files with 21 additions and 83 deletions
|
@ -323,9 +323,7 @@ class AuthorizeNet
|
||||||
unset($order->paymentmethod);
|
unset($order->paymentmethod);
|
||||||
}
|
}
|
||||||
$order->status = AN_STATUS_VOID;
|
$order->status = AN_STATUS_VOID;
|
||||||
if (! $DB->update_record($tableupdate, $order)) {
|
$DB->update_record($tableupdate, $order);
|
||||||
message_to_admin("Error while trying to update data in table $tableupdate. Please edit manually this record: ID=$order->id.", $order);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1497,9 +1497,7 @@ class assignment_base {
|
||||||
// $submission->timemodified = time();
|
// $submission->timemodified = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $DB->update_record('assignment_submissions', $submission)) {
|
$DB->update_record('assignment_submissions', $submission);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// triger grade event
|
// triger grade event
|
||||||
$this->update_grade($submission);
|
$this->update_grade($submission);
|
||||||
|
|
|
@ -85,9 +85,7 @@ class assignment_offline extends assignment_base {
|
||||||
$submission->timemodified = time();
|
$submission->timemodified = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $DB->update_record('assignment_submissions', $submission)) {
|
$DB->update_record('assignment_submissions', $submission);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// triger grade event
|
// triger grade event
|
||||||
$this->update_grade($submission);
|
$this->update_grade($submission);
|
||||||
|
|
|
@ -873,9 +873,7 @@ function data_update_instance($data) {
|
||||||
$data->notification = 0;
|
$data->notification = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $DB->update_record('data', $data)) {
|
$DB->update_record('data', $data);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
data_grade_item_update($data);
|
data_grade_item_update($data);
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,7 @@
|
||||||
$newrating->userid = $USER->id;
|
$newrating->userid = $USER->id;
|
||||||
$newrating->recordid = $record->id;
|
$newrating->recordid = $record->id;
|
||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
if (! $DB->insert_record('data_ratings', $newrating)) {
|
$DB->insert_record('data_ratings', $newrating);
|
||||||
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
|
|
||||||
}
|
|
||||||
data_update_grades($data, $record->userid);
|
data_update_grades($data, $record->userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,7 @@
|
||||||
$newrating->post = $post->id;
|
$newrating->post = $post->id;
|
||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
|
|
||||||
if (! $DB->insert_record('forum_ratings', $newrating)) {
|
$DB->insert_record('forum_ratings', $newrating);
|
||||||
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$postid, 'rating'=>$rating));
|
|
||||||
}
|
|
||||||
forum_update_grades($forum, $post->userid);
|
forum_update_grades($forum, $post->userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,7 @@
|
||||||
} else if ($rating != $oldrating->rating) {
|
} else if ($rating != $oldrating->rating) {
|
||||||
$oldrating->rating = $rating;
|
$oldrating->rating = $rating;
|
||||||
$oldrating->time = time();
|
$oldrating->time = time();
|
||||||
if (! $DB->update_record("glossary_ratings", $oldrating)) {
|
$DB->update_record("glossary_ratings", $oldrating);
|
||||||
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
|
|
||||||
}
|
|
||||||
glossary_update_grades($glossary, $entry->userid);
|
glossary_update_grades($glossary, $entry->userid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +99,7 @@
|
||||||
$newrating->entryid = $entry->id;
|
$newrating->entryid = $entry->id;
|
||||||
$newrating->rating = $rating;
|
$newrating->rating = $rating;
|
||||||
|
|
||||||
if (! $DB->insert_record("glossary_ratings", $newrating)) {
|
$DB->insert_record("glossary_ratings", $newrating);
|
||||||
print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
|
|
||||||
}
|
|
||||||
glossary_update_grades($glossary, $entry->userid);
|
glossary_update_grades($glossary, $entry->userid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,15 +163,9 @@ class question_calculated_qtype extends default_questiontype {
|
||||||
|
|
||||||
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
||||||
$answer->id = $oldanswer->id;
|
$answer->id = $oldanswer->id;
|
||||||
if (! $DB->update_record("question_answers", $answer)) {
|
$DB->update_record("question_answers", $answer);
|
||||||
$result->error = get_string('errorupdatinganswer','question',$answer->id);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // This is a completely new answer
|
} else { // This is a completely new answer
|
||||||
if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
|
$answer->id = $DB->insert_record("question_answers", $answer);
|
||||||
$result->error = get_string('errorinsertinganswer','question');
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the options object
|
// Set up the options object
|
||||||
|
@ -187,18 +181,9 @@ class question_calculated_qtype extends default_questiontype {
|
||||||
|
|
||||||
// Save options
|
// Save options
|
||||||
if (isset($options->id)) { // reusing existing record
|
if (isset($options->id)) { // reusing existing record
|
||||||
if (! $DB->update_record('question_calculated', $options)) {
|
$DB->update_record('question_calculated', $options);
|
||||||
$mess->name = $this->name();
|
|
||||||
$mess->id = $options->id ;
|
|
||||||
$result->error = get_string('errorupdatingoptions','question',$mess);
|
|
||||||
// $result->error = "Could not update question calculated options! (id=$options->id)";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // new options
|
} else { // new options
|
||||||
if (! $DB->insert_record('question_calculated', $options)) {
|
$DB->insert_record('question_calculated', $options);
|
||||||
$result->error = "Could not insert question calculated options!";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,11 +855,7 @@ class question_calculated_qtype extends default_questiontype {
|
||||||
$options->tolerancetype = trim($fromform->tolerancetype[$key]);
|
$options->tolerancetype = trim($fromform->tolerancetype[$key]);
|
||||||
$options->correctanswerlength = trim($fromform->correctanswerlength[$key]);
|
$options->correctanswerlength = trim($fromform->correctanswerlength[$key]);
|
||||||
$options->correctanswerformat = trim($fromform->correctanswerformat[$key]);
|
$options->correctanswerformat = trim($fromform->correctanswerformat[$key]);
|
||||||
if (! $DB->update_record('question_calculated', $options)) {
|
$DB->update_record('question_calculated', $options);
|
||||||
$mess->name = $this->name();
|
|
||||||
$mess->id = $options->id ;
|
|
||||||
notify ( get_string('errorupdatingoptions','question',$mess));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,15 +61,9 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
|
||||||
|
|
||||||
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
||||||
$answer->id = $oldanswer->id;
|
$answer->id = $oldanswer->id;
|
||||||
if (! $DB->update_record("question_answers", $answer)) {
|
$DB->update_record("question_answers", $answer);
|
||||||
$result->error = get_string('errorupdatinganswer','question',$answer->id);
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // This is a completely new answer
|
} else { // This is a completely new answer
|
||||||
if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
|
$answer->id = $DB->insert_record("question_answers", $answer);
|
||||||
$result->error = get_string('errorinsertinganswer','question');
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the options object
|
// Set up the options object
|
||||||
|
@ -85,18 +79,9 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
|
||||||
|
|
||||||
// Save options
|
// Save options
|
||||||
if (isset($options->id)) { // reusing existing record
|
if (isset($options->id)) { // reusing existing record
|
||||||
if (! $DB->update_record('question_calculated', $options)) {
|
$DB->update_record('question_calculated', $options);
|
||||||
$mess->name = $this->name();
|
|
||||||
$mess->id = $options->id ;
|
|
||||||
$result->error = get_string('errorupdatingoptions','question',$mess);
|
|
||||||
// $result->error = "Could not update question calculated options! (id=$options->id)";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // new options
|
} else { // new options
|
||||||
if (! $DB->insert_record('question_calculated', $options)) {
|
$DB->insert_record('question_calculated', $options);
|
||||||
$result->error = "Could not insert question calculated options!";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,15 +137,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
|
||||||
|
|
||||||
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
||||||
$answer->id = $oldanswer->id;
|
$answer->id = $oldanswer->id;
|
||||||
if (! $DB->update_record("question_answers", $answer)) {
|
$DB->update_record("question_answers", $answer);
|
||||||
$result->error = "Could not update quiz answer! (id=$answer->id)";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // This is a completely new answer
|
} else { // This is a completely new answer
|
||||||
if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
|
$answer->id = $DB->insert_record("question_answers", $answer);
|
||||||
$result->error = "Could not insert quiz answer!";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the options object
|
// Set up the options object
|
||||||
|
@ -165,15 +159,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
|
||||||
|
|
||||||
// Save options
|
// Save options
|
||||||
if (isset($options->id)) { // reusing existing record
|
if (isset($options->id)) { // reusing existing record
|
||||||
if (! $DB->update_record('question_numerical', $options)) {
|
$DB->update_record('question_numerical', $options);
|
||||||
$result->error = "Could not update quiz numerical options! (id=$options->id)";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
} else { // new options
|
} else { // new options
|
||||||
if (! $DB->insert_record('question_numerical', $options)) {
|
$DB->insert_record('question_numerical', $options);
|
||||||
$result->error = "Could not insert quiz numerical options!";
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// delete old answer records
|
// delete old answer records
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue