MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup

This commit is contained in:
skodak
2009-06-13 17:35:10 +00:00
parent bb4b6010f3
commit 9d7493399d
15 changed files with 20 additions and 70 deletions
@@ -172,9 +172,6 @@ if ($act == 'updfeed') {
}
$rssid = $DB->insert_record('block_rss_client', $dataobject);
if (!$rssid) {
print_error('updatersserror', 'error', '', $url);
}
// By capturing the output from fetch_rss this way
// error messages do not display and clutter up the moodle interface
-1
View File
@@ -268,7 +268,6 @@ $string['type'] = 'Field type';
$string['undefinedprocessactionmethod'] = 'No action method defined in Data_Preset to handle action \"$a\".';
$string['unsupportedexport'] = '($a->fieldtype) cannot be exported.';
$string['updatefield'] = 'Update an existing field';
$string['updatingerror'] = 'There was an error updating the database';
$string['uploadfile'] = 'Upload file';
$string['uploadrecords'] = 'Upload entries from a file';
$string['url'] = 'Url';
-1
View File
@@ -464,7 +464,6 @@ $string['usernotupdatedadmin'] = 'Cannot update admin accounts';
$string['usernotupdatederror'] = 'User not updated - error';
$string['usernotupdatednotexists'] = 'User not updated - does not exist';
$string['userselectortoomany'] = 'user_selector got more than one selected user, even though multiselect is false.';
$string['updatersserror'] = 'There was an error trying to update RSS feed with id: $a';
$string['upgraderunning'] = 'Site is being upgraded, please retry later.';
$string['younotteacher'] = 'You are not a teacher!';
$string['wrongcall'] = 'This script is called wrongly';
-1
View File
@@ -38,7 +38,6 @@ $string['cannotadddiscussionall'] = 'You do not have permission to add a new dis
$string['cannotaddsubscriber'] = 'Could not add subscriber with id $a to this forum!';
$string['cannotcreateinstanceforteacher'] = 'Could not create new course module instance for the teacher forum';
$string['cannotcreatediscussion'] = 'Could not create new discussion';
$string['cannotconvertteachertogeneral'] = 'Could not change forum from type teacher to type general';
$string['cannotdeleteforummodule'] = 'You can not delete the forum module.';
$string['cannotdeletepost'] = 'You can\'t delete this post!';
$string['cannoteditposts'] = 'You can\'t edit other people\'s posts!';
-1
View File
@@ -23,7 +23,6 @@ $string['attachment'] = 'Attachment';
$string['author'] = 'author';
$string['authorview'] = 'Browse by Author';
$string['back'] = 'Back';
$string['cantexportentry'] = 'Could not export the entry to the main glossary';
$string['cantinsertcat'] = 'Can\'t insert category';
$string['cantinsertrec'] = 'Can\'t insert record';
$string['cantinsertrel'] = 'Can\'t insert relation category-entry';
+3 -9
View File
@@ -498,9 +498,7 @@ class assignment_base {
$assignment->id = $assignment->instance;
$assignment->courseid = $assignment->course;
if (!$DB->update_record('assignment', $assignment)) {
return false;
}
$DB->update_record('assignment', $assignment);
if ($assignment->timedue) {
$event = new object();
@@ -658,14 +656,10 @@ class assignment_base {
if (!isset($submission->submissioncomment)) {
$submission->submissioncomment = '';
}
if (!$sid = $DB->insert_record('assignment_submissions', $submission)) {
return false;
}
$sid = $DB->insert_record('assignment_submissions', $submission);
$submission->id = $sid;
} else {
if (!$DB->update_record('assignment_submissions', $submission)) {
return false;
}
$DB->update_record('assignment_submissions', $submission);
}
// triger grade event
@@ -173,9 +173,7 @@ class assignment_online extends assignment_base {
$update->data2 = $data->format;
$update->timemodified = time();
if (!$DB->update_record('assignment_submissions', $update)) {
return false;
}
$DB->update_record('assignment_submissions', $update);
$submission = $this->get_submission($USER->id);
$this->update_grade($submission);
+3 -8
View File
@@ -168,9 +168,7 @@
$rec->id = $data->id;
$rec->defaultsort = 0;
$rec->defaultsortdir = 0;
if (!$DB->update_record('data', $rec)) {
print_error('updatingerror', 'data');
}
$DB->update_record('data', $rec);
}
add_to_log($course->id, 'data', 'fields delete',
@@ -203,11 +201,8 @@
$rec->defaultsort = $defaultsort;
$rec->defaultsortdir = $defaultsortdir;
if ($DB->update_record('data', $rec)) {
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id, get_string('changessaved'), 2);
} else {
print_error('updatingerror', 'data');
}
$DB->update_record('data', $rec);
redirect($CFG->wwwroot.'/mod/data/field.php?d='.$data->id, get_string('changessaved'), 2);
exit;
}
break;
+1 -4
View File
@@ -140,10 +140,7 @@ class data_field_picture extends data_field_base {
// Get the old field data so that we can check whether the thumbnail dimensions have changed
$oldfield = $DB->get_record('data_fields', array('id'=>$this->field->id));
if (!$DB->update_record('data_fields', $this->field)) {
notify('updating of new field failed!');
return false;
}
$DB->update_record('data_fields', $this->field);
// Have the thumbnail dimensions changed?
if ($oldfield && ($oldfield->param4 != $this->field->param4 || $oldfield->param5 != $this->field->param5)) {
+3 -9
View File
@@ -201,10 +201,7 @@ class data_field_base { // Base class for Database Field Types (see field/*/
function update_field() {
global $DB;
if (!$DB->update_record('data_fields', $this->field)) {
notify('updating of new field failed!');
return false;
}
$DB->update_record('data_fields', $this->field);
return true;
}
@@ -550,11 +547,8 @@ function data_generate_default_template(&$data, $template, $recordid=0, $form=fa
$newdata = new object();
$newdata->id = $data->id;
$newdata->{$template} = $str;
if (!$DB->update_record('data', $newdata)) {
notify('Error updating template');
} else {
$data->{$template} = $str;
}
$DB->update_record('data', $newdata);
$data->{$template} = $str;
}
return $str;
+1 -3
View File
@@ -132,9 +132,7 @@ function feedback_update_instance($feedback) {
}
//save the feedback into the db
if (!$DB->update_record("feedback", $feedback)) {
return false;
}
$DB->update_record("feedback", $feedback);
//create or update the new events
feedback_set_events($feedback);
+3 -9
View File
@@ -4519,9 +4519,7 @@ function forum_update_post($post, $mform, &$message) {
$post->modified = time();
if (!$DB->update_record('forum_posts', $post)) {
return false;
}
$DB->update_record('forum_posts', $post);
$discussion->timemodified = $post->modified; // last modified tracking
$discussion->usermodified = $post->userid; // last modified tracking
@@ -4534,9 +4532,7 @@ function forum_update_post($post, $mform, &$message) {
$post->message = file_save_draft_area_files($post->itemid, $context->id, 'forum_post', $post->id, array('subdirs'=>true), $post->message);
$DB->set_field('forum_posts', 'message', $post->message, array('id'=>$post->id));
if (!$DB->update_record('forum_discussions', $discussion)) {
return false;
}
$DB->update_record('forum_discussions', $discussion);
forum_add_attachment($post, $forum, $cm, $mform, $message);
@@ -7684,9 +7680,7 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(),
// Change the forum type to general.
$forum->type = 'general';
if (!$DB->update_record('forum', $forum)) {
print_error('cannotconvertteachertogeneral', 'forum');
}
$DB->update_record('forum', $forum);
$context = get_context_instance(CONTEXT_MODULE, $cmid);
+1 -3
View File
@@ -576,9 +576,7 @@
if (($forum->type == 'single') && ($updatepost->parent == '0')){ // updating first post of single discussion type -> updating forum intro
$forum->intro = $updatepost->message;
$forum->timemodified = time();
if (!$DB->update_record("forum", $forum)) {
print_error("couldnotupdate", "forum", $errordestination);
}
$DB->update_record("forum", $forum);
}
$timemessage = 2;
+1 -3
View File
@@ -89,9 +89,7 @@
$entry->glossaryid = $mainglossary->id;
$entry->sourceglossaryid = $glossary->id;
if (!$DB->update_record('glossary_entries', $entry)) {
print_error('cantexportentry', 'glossary');
}
$DB->update_record('glossary_entries', $entry);
// move attachments too
$fs = get_file_storage();
+3 -12
View File
@@ -271,24 +271,15 @@
$category = new object();
$category->name = $newcat->name;
$category->glossaryid = $glossary->id;
if ( !$category->id = $DB->insert_record("glossary_categories",$category)) {
// add to exception report (can't insert category)
$rejections .= "<tr><td>&nbsp;<strong>" . get_string("category","glossary") . ":</strong>$newcat->name</td>" .
"<td>" . get_string("cantinsertcat","glossary"). "</td></tr>";
} else {
$importedcats++;
}
$category->id = $DB->insert_record("glossary_categories",$category);
$importedcats++;
}
if ( $category ) {
// inserting the new relation
$entrycat = new opbject();
$entrycat->entryid = $newentry->id;
$entrycat->categoryid = $category->id;
if ( !$DB->insert_record("glossary_entries_categories",$entrycat) ) {
// add to exception report (can't insert relation)
$rejections .= "<tr><td>&nbsp;<strong>" . get_string("category","glossary") . ":</strong>$newcat->name</td>" .
"<td>" . get_string("cantinsertrel","glossary"). "</td></tr>";
}
$DB->insert_record("glossary_entries_categories",$entrycat);
}
}
}