]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18293 removed obsoleted checking of return values from insert and update_record...
authorskodak <skodak>
Sat, 13 Jun 2009 17:35:10 +0000 (17:35 +0000)
committerskodak <skodak>
Sat, 13 Jun 2009 17:35:10 +0000 (17:35 +0000)
15 files changed:
blocks/rss_client/block_rss_client_action.php
lang/en_utf8/data.php
lang/en_utf8/error.php
lang/en_utf8/forum.php
lang/en_utf8/glossary.php
mod/assignment/lib.php
mod/assignment/type/online/assignment.class.php
mod/data/field.php
mod/data/field/picture/field.class.php
mod/data/lib.php
mod/feedback/lib.php
mod/forum/lib.php
mod/forum/post.php
mod/glossary/exportentry.php
mod/glossary/import.php

index c37e71b86f2df068a240393a45bf8d1bc09ed849..3f727dc8f5608cdd37ef8e6857f75834001009bb 100644 (file)
@@ -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
index 24d578a52e8a6135db0dc4a813ee7a19bbd33b17..d9fac63da227d1b752bee06bb1621d7c2ec1fc06 100644 (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';
index abcb5c0486a1403a0abd81843321834a0aa9a5f1..af0f09d9ad10855679b6b8525d7ae7805173da69 100644 (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';
index e1c4875396acd5459ee7446fc764f739ab10ddf1..93869e4ec53a57c7af87734137889f72a8e367ec 100644 (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!';
index c426781ce6028f3b984e0c87306235fae970a642..5ff52caf21530295faa58e36a13b48d32a4c5ccf 100644 (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';
index c729ddec61b7940834844d0caa6267289a55759d..6b7a70d1978536a9aeb0c0320e3d4ab8950833bb 100644 (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
index b0685d9537216791daa6a244173dcde0a47be959..58c1a8e42d31b9e2fc4a279b4736ce8281b99792 100644 (file)
@@ -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);
index 3f64edf8f747b4d5dfb6069df56de34ab9770726..c6d67941e32e64ca88318324df60ef3add993c6b 100755 (executable)
                             $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',
                 $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;
index 962230f5b8813742388914cf94a47f99773e1ba2..6d9b3ac649852014ff9c5d9b7efa81ba29342a10 100755 (executable)
@@ -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)) {
index c427dba8b195c2a5cd485fdfb33402e3ad14a21c..47085a817f9f1082de126606f99d53fc8f7070f4 100755 (executable)
@@ -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;
index 7013e093efa4f9423ce9ef13b4850068cb4409bb..776e189b01ffc1624d9a3e7de6e1e6fc02c927ba 100644 (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);
index b0de7c6d302b141890a42170c713d4af1e750955..ae707a68a31e5e483e9ba7355a303d64b8e6b6e9 100644 (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);
 
index 6118a3fcead06543d9d1444bf637cfb9d833cf06..e58c900a436529fec88c1c42b050021aea351863 100644 (file)
             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;
index 2302d10c2a5916a08390d7eefe554ef3b30f644b..23cb0aec15ca13bce5ce1eebf94f79f051b71fcb 100644 (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();
index cf370af47a6ad1ad8ed930948c7d1e3405f4f13b..e47d60bf4c54e007a08353b714683373e9f31c8a 100644 (file)
                                 $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);
                             }
                         }
                     }