]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-18293 removing unused error strings (now replaced by exceptions)
authorskodak <skodak>
Tue, 17 Feb 2009 16:33:32 +0000 (16:33 +0000)
committerskodak <skodak>
Tue, 17 Feb 2009 16:33:32 +0000 (16:33 +0000)
course/editcategory.php
course/index.php
course/lib.php
course/mod.php
course/modedit.php
lang/en_utf8/error.php
mod/glossary/comment.php
mod/glossary/editcategories.php
mod/hotpot/lib.php
user/profile/definelib.php

index 4759f540367428bfcaa6766ebcdb5124c8ab015d..1b03cf1c5653f3d142d26c86e5d8a8c3e7c25c48 100644 (file)
@@ -64,9 +64,7 @@ if ($mform->is_cancelled()) {
             $parent_cat = $DB->get_record('course_categories', array('id' => $newcategory->parent));
             move_category($newcategory, $parent_cat);
         }
-        if (!$DB->update_record('course_categories', $newcategory)) {
-            print_error( "cannotupdatecategory", '', '', $newcategory->name);
-        }
+        $DB->update_record('course_categories', $newcategory);
         fix_course_sortorder();
 
     } else {
index e01fe6408c0a504ef5bab6f6de415f45335f8bd9..a1c1427aba77ae1c278a0f0503db4785e6579c6e 100644 (file)
             if ($cattomove->parent != $moveto) {
                 $newparent = $DB->get_record('course_categories', array('id'=>$moveto));
                 require_capability('moodle/category:manage', get_category_or_system_context($moveto));
-                if (!move_category($cattomove, $newparent)) {
-                    print_error('cannotupdatecategory', '', '', format_string($cattomove->name));
-                }
+                move_category($cattomove, $newparent);
             }
         }
     }
         }
         require_capability('moodle/category:manage', get_category_or_system_context($tempcat->parent));
         if ($tempcat) {
-            if (!$DB->set_field('course_categories', 'visible', $visible, array('id'=>$tempcat->id))) {
-                print_error('cannotupdatecategory', '', '', format_string($tempcat->name));
-            }
-            if (!$DB->set_field('course', 'visible', $visible, array('category' => $tempcat->id))) {
-                print_error('cannotshowhidecoursesincategory', '', '', format_string($tempcat->name));
-            }
+            $DB->set_field('course_categories', 'visible', $visible, array('id'=>$tempcat->id));
+            $DB->set_field('course', 'visible', $visible, array('category' => $tempcat->id));
         }
     }
 
index ac095180175e8e0e93ffbc58334658593427f7ef..af130914242bd672d16ca4073db85f649e5aaeb1 100644 (file)
@@ -3281,10 +3281,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
 
     if ($children = $DB->get_records('course_categories', array('parent'=>$category->id), 'sortorder ASC')) {
         foreach ($children as $childcat) {
-            if (!move_category($childcat, $newparentcat)) {
-                notify("Error moving category $childcat->name");
-                return false;
-            }
+            move_category($childcat, $newparentcat);
         }
     }
 
@@ -3352,22 +3349,18 @@ function move_courses($courseids, $categoryid) {
  * Efficiently moves a category - NOTE that this can have
  * a huge impact access-control-wise...
  */
-function move_category ($category, $newparentcat) {
+function move_category($category, $newparentcat) {
     global $CFG, $DB;
 
     $context = get_context_instance(CONTEXT_COURSECAT, $category->id);
 
     if (empty($newparentcat->id)) {
-        if (!$DB->set_field('course_categories', 'parent', 0, array('id'=>$category->id))) {
-            return false;
-        }
+        $DB->set_field('course_categories', 'parent', 0, array('id'=>$category->id));
 
         $newparent = get_context_instance(CONTEXT_SYSTEM);
 
     } else {
-        if (!$DB->set_field('course_categories', 'parent', $newparentcat->id, array('id'=>$category->id))) {
-            return false;
-        }
+        $DB->set_field('course_categories', 'parent', $newparentcat->id, array('id'=>$category->id));
         $newparent = get_context_instance(CONTEXT_COURSECAT, $newparentcat->id);
     }
 
@@ -3378,8 +3371,6 @@ function move_category ($category, $newparentcat) {
 
     // and fix the sortorders
     fix_course_sortorder();
-
-    return true;
 }
 
 /**
index 77044a02de050492d8cb93e1dc222e7e01f624e2..a01b065eaf550cb2581a8d1872eb10bc11d638d3 100644 (file)
             $cm->indent = 0;
         }
 
-        if (!$DB->set_field('course_modules', 'indent', $cm->indent, array('id'=>$cm->id))) {
-            print_error('cannotupdatelevel');
-        }
+        $DB->set_field('course_modules', 'indent', $cm->indent, array('id'=>$cm->id));
 
         rebuild_course_cache($cm->course);
 
index eea05a9fa48e214fb09816cf98f522a7d7db2961..e12e7d639a0192c373453e1c7314c216ee37011c 100644 (file)
                 condition_info::update_cm_from_form($cm,$fromform,true);
             }
 
-            if (!$DB->update_record('course_modules', $cm)) {
-                print_error('cannotupdatecoursemodule');
-            }
+            $DB->update_record('course_modules', $cm);
 
             if (!$updateinstancefunction($fromform, $mform)) {
                 print_error('cannotupdatemod', '', 'view.php?id=$course->id', $fromform->modulename);
index c2e8dcb261a741147f6c33a550d12cbd34a3dfc5..f4625b2d979fc3928c46c1f3b2efaca0058a5bcd 100644 (file)
@@ -129,14 +129,7 @@ $string['cannotsetupcapforplugin'] = 'Could not set up the capabilities for $a';
 $string['cannotsetupcapformod'] = 'Could not set up the capabilities for $a';
 $string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category $a.';
 $string['cannotunzipfile'] = 'Cannot unzip file';
-$string['cannotupgradeblock'] = 'Upgrade of blocks system failed! (Could not update version in config table.)';
-$string['cannotupgradecaps'] = 'Had difficulties upgrading the core capabilities for the Roles system';
-$string['cannotupdatecategory'] = 'Could not update the category ($a)';
-$string['cannotupdatecoursemodule'] = 'Could not update the course module';
-$string['cannotupdatecomment'] = 'Could not update this comment';
 $string['cannotupdatecm'] = 'Could not update the course module with the correct section';
-$string['cannotupdatefield'] = 'Error updating field';
-$string['cannotupdatelevel'] = 'Could not update the indent level on that course module';
 $string['cannotupdategroup'] = 'Error updating group';
 $string['cannotupdaterate'] = 'Could not update an old rating ($a->id = $a->rating)';
 $string['cannotupdaterecord'] = 'Could not update record ID $a';
index 014ae18ea86392f3444aaa56084b773879686382..c6b5dafe171de1acfabd1d0f421bfdf60292ebcd 100644 (file)
@@ -188,11 +188,9 @@ function glossary_comment_edit() {
         $updatedcomment->format       = $data->format;
         $updatedcomment->timemodified = time();
 
-        if (!$DB->update_record('glossary_comments', $updatedcomment)) {
-            print_error('cannotupdatecomment');
-        } else {
-            add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$updatedcomment->id",$cm->id);
-        }
+        $DB->update_record('glossary_comments', $updatedcomment);
+        add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&amp;eid=$entry->id", "$updatedcomment->id",$cm->id);
+
         redirect("comments.php?id=$cm->id&amp;eid=$entry->id");
 
     } else {
index b37e837fa14ebbaed6d188b1604922c9068ab9c7..0213c0a0a5b9351d1a7fa80b21e82e88b5ee0464 100644 (file)
                 $cat->name = $name;
                 $cat->usedynalink = $usedynalink;
 
-                if ( !$DB->update_record("glossary_categories", $cat) ) {
-                    print_error('cannotupdatecategory');
-                    redirect("editcategories.php?id=$cm->id");
-                } else {
-                    add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
-                }
+                $DB->update_record("glossary_categories", $cat);
+                add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
+
             } else {
                 echo "<p style=\"text-align:center\">" . get_string("edit"). " " . get_string("category","glossary") . "<span style=\"font-size:1.5em\">";
 
index f899b3d0f446eb934d957e1cb4a424c3f93dcd0f..44d617a8398d238f65e28ade6058cbde42cc82ea 100644 (file)
@@ -584,9 +584,7 @@ function hotpot_add_chain(&$hotpot) {
                 print_error('cannotaddcoursemoduletosection');
             }
 
-            if (! $DB->set_field('course_modules', 'section', $sectionid, array("id"=>$hotpot->coursemodule))) {
-                print_error('cannotupdatecoursemodule');
-            }
+            $DB->set_field('course_modules', 'section', $sectionid, array("id"=>$hotpot->coursemodule));
 
             add_to_log($hotpot->course, "course", "add mod",
                 "../mod/$hotpot->modulename/view.php?id=$hotpot->coursemodule",
index c0a96ba06d80d6748d94115820fee47cb19d34b7..ae744543d25bf73e51cd89a54254f3da99dcc91b 100644 (file)
@@ -156,13 +156,9 @@ class profile_define_base {
 
         if (empty($data->id)) {
             unset($data->id);
-            if (!$data->id = $DB->insert_record('user_info_field', $data)) {
-                print_error('cannotcreatefield');
-            }
+            $data->id = $DB->insert_record('user_info_field', $data);
         } else {
-            if (!$DB->update_record('user_info_field', $data)) {
-                print_error('cannotupdatefield');
-            }
+            $DB->update_record('user_info_field', $data);
         }
     }
 
@@ -427,13 +423,9 @@ function profile_edit_category($id, $redirect) {
             if (empty($data->id)) {
                 unset($data->id);
                 $data->sortorder = $DB->count_records('user_info_category') + 1;
-                if (!$DB->insert_record('user_info_category', $data, false)) {
-                    print_error('cannotinsertcategory');
-                }
+                $DB->insert_record('user_info_category', $data, false);
             } else {
-                if (!$DB->update_record('user_info_category', $data)) {
-                    print_error('cannotupdatecategory');
-                }
+                $DB->update_record('user_info_category', $data);
             }
             profile_reorder_categories();
             redirect($redirect);