]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 converted some delete_records
authorskodak <skodak>
Mon, 2 Jun 2008 21:52:27 +0000 (21:52 +0000)
committerskodak <skodak>
Mon, 2 Jun 2008 21:52:27 +0000 (21:52 +0000)
admin/health.php
auth/mnet/auth.php
blog/edit.php
filter/algebra/algebradebug.php
filter/tex/lib.php
filter/tex/texdebug.php
index.php
lib/blocklib.php
lib/moodlelib.php
lib/weblib.php
tag/lib.php

index 14db41b608f62e65327e7bfdc65944c1f8f29ac5..e02e65a3c6108c58eac697823f7a25440da6a908 100644 (file)
@@ -518,10 +518,10 @@ class problem_000011 extends problem_base {
         }
     }
     function solution() {
-        global $CFG;
+        global $CFG, $DB;
         if (optional_param('resetsesserrorcounter', 0, PARAM_BOOL)) {
             if ($DB->get_field('config', 'name', array('name'=>'session_error_counter'))) {
-                delete_records('config', 'name', 'session_error_counter');
+                $DB->delete_records('config', array('name'=>'session_error_counter'));
             }
             return 'Error counter was cleared.';
         } else {
index da71a863f5e0cda3f44b472d33e4d9c5e5b2c47e..8d1e0d89d845baadc541d27fade71b9bac1a53c6 100644 (file)
@@ -475,7 +475,7 @@ class auth_plugin_mnet extends auth_plugin_base {
      *   @return bool
      */
     function update_enrolments($username, $courses) {
-        global $MNET_REMOTE_CLIENT, $CFG;
+        global $MNET_REMOTE_CLIENT, $CFG, $DB;
 
         if (empty($username) || !is_array($courses)) {
             return false;
@@ -490,9 +490,7 @@ class auth_plugin_mnet extends auth_plugin_base {
         }
 
         if (empty($courses)) { // no courses? clear out quickly
-            delete_records('mnet_enrol_assignments',
-                           'hostid', (int)$MNET_REMOTE_CLIENT->id,
-                           'userid', $userid);
+            $DB->delete_records('mnet_enrol_assignments', array('hostid'=>$MNET_REMOTE_CLIENT->id, 'userid'=>$userid));
             return true;
         }
 
index b92ec96da13c2cae23338e1179a9fc6416098aac..a2761100f6f7785fc4bb01352295c144572a2e6e 100755 (executable)
@@ -156,7 +156,7 @@ function do_delete($post) {
     global $returnurl, $DB;
 
     $status = $DB->delete_records('post', array('id'=>$post->id));
-    //$status = delete_records('blog_tag_instance', 'entryid', $post->id) and $status;
+    //$status = $DB->delete_records('blog_tag_instance', array('entryid'=>$post->id)) and $status;
     tag_set('post', $post->id, array());
     
     blog_delete_old_attachments($post);
@@ -215,8 +215,8 @@ function do_edit($post, $blogeditform) {
     if ($DB->update_record('post', $post)) {
         // delete all tags associated with this entry
         
-        //delete_records('blog_tag_instance', 'entryid', $post->id);
-        //delete_records('tag_instance', 'itemid', $post->id, 'itemtype', 'blog');
+        //$DB->delete_records('blog_tag_instance', array('entryid'=>$post->id));
+        //$DB->delete_records('tag_instance', array('itemid'=>$post->id, 'itemtype'=>'blog'));
         //untag_an_item('post', $post->id);
         // add them back
         add_tags_info($post->id);
index 8ae16f6a6a65639c9e64fb023a7390aa820e1389..2000a060c9e9bc4f05193f2dbcf4c7c970044b1a 100644 (file)
@@ -46,7 +46,7 @@
       if (strpos($query,'DeleteDB')) {
         if ($texcache) {
           $output = "Deleting DB cache_filters entry for $algebra\n";
-          $result =  delete_records("cache_filters","id",$texcache->id);
+          $result =  $DB->delete_records("cache_filters", array("id"=>$texcache->id));
           if ($result) {
             $result = 1;
           } else {
index f02fba5252f795f51bb530028579091881bb604e..db6405bcd662a048b68569c5cbab1b751548071b 100644 (file)
@@ -52,7 +52,7 @@ function tex_filter_get_cmd($pathname, $texexp) {
  * Purge all caches when settings changed.
  */
 function filter_tex_updatedcallback($name) {
-    global $CFG;
+    global $CFG, $DB;
     reset_text_filters_cache();
 
     if (file_exists("$CFG->dataroot/filter/tex")) {
@@ -65,8 +65,8 @@ function filter_tex_updatedcallback($name) {
         remove_dir("$CFG->dataroot/temp/latex");
     }
 
-    delete_records('cache_filters', 'filter', 'tex');
-    delete_records('cache_filters', 'filter', 'algebra');
+    $DB->delete_records('cache_filters', array('filter'=>'tex'));
+    $DB->delete_records('cache_filters', array('filter'=>'algebra'));
 }
 
 ?>
index 137659620c4b729646e5afa743fa3b29c92cae80..b83c05a7a41ac61ec15e5195ce3905f53db80b63 100644 (file)
@@ -52,7 +52,7 @@
     if ($action=='DeleteDB') {
         if ($texcache) {
             $output = "Deleting DB cache_filters entry for $texexp\n";
-            $result =  delete_records("cache_filters","id",$texcache->id);
+            $result =  $DB->delete_records("cache_filters", array("id"=>$texcache->id));
             if ($result) {
                 $result = 1;
             } else {
index 3bde1548e0957347226def9504163d3e8a017b92..014d5c292df4d65a810d0e14fd287bc6442d96b0 100644 (file)
--- a/index.php
+++ b/index.php
     if ($SITE->numsections > 0) {
 
         if (!$section = $DB->get_record('course_sections', array('course'=>$SITE->id, 'section'=>1))) {
-            delete_records('course_sections', 'course', $SITE->id, 'section', 1); // Just in case
+            $DB->delete_records('course_sections', array('course'=>$SITE->id, 'section'=>1)); // Just in case
             $section->course = $SITE->id;
             $section->section = 1;
             $section->summary = '';
index 102486536fdd577ec05b9d618f1a234e0cf39955..ea947d912102a36a9e596b1c0fa79ddc7a970fe8 100644 (file)
@@ -1016,7 +1016,7 @@ function blocks_repopulate_page($page) {
     // indexed and the indexes match, so we can work straight away... but CAREFULLY!
 
     // Ready to start creating block instances, but first drop any existing ones
-    delete_records('block_instance', 'pageid', $page->get_id(), 'pagetype', $page->get_type());
+    $DB->delete_records('block_instance', array('pageid'=>$page->get_id(), 'pagetype'=>$page->get_type()));
 
     // Here we slyly count $posblocks and NOT $positions. This can actually make a difference
     // if the textual representation has undefined slots in the end. So we only work with as many
@@ -1420,7 +1420,7 @@ function upgrade_blocks_plugins($continueto) {
         upgrade_log_start();
         $page = page_create_object(PAGE_COURSE_VIEW, SITEID);
         blocks_repopulate_page($page);
-        delete_records('config', 'name', 'siteblocksadded');
+        $DB->delete_records('config', array('name'=>'siteblocksadded'));
     }
 
     upgrade_log_finish();
index d454d7667462dee78202913d68ad289e7ba00b48..12f551258c4bbbc9c1bd01c7a52a50e57d285f4d 100644 (file)
@@ -3700,12 +3700,12 @@ function reset_course_userdata($data) {
     }
 
     if (!empty($data->reset_logs)) {
-        delete_records('log', 'course', $data->courseid);
+        $DB->delete_records('log', array('course'=>$data->courseid));
         $status[] = array('component'=>$componentstr, 'item'=>get_string('deletelogs'), 'error'=>false);
     }
 
     if (!empty($data->reset_events)) {
-        delete_records('event', 'courseid', $data->courseid);
+        $DB->delete_records('event', array('courseid'=>$data->courseid));
         $status[] = array('component'=>$componentstr, 'item'=>get_string('deleteevents', 'calendar'), 'error'=>false);
     }
 
index 7b06ee782a3c25f7f1f321804546a20547adc6a2..af9fe8881212c7821750cfd88df25b4b857ca358 100644 (file)
@@ -1583,9 +1583,9 @@ function text_format_name( $key ) {
  * @return void
  */
 function reset_text_filters_cache() {
-    global $CFG;
+    global $CFG, $DB;
 
-    delete_records('cache_text');
+    $DB->delete_records('cache_text');
     $purifdir = $CFG->dataroot.'/cache/htmlpurifier';
     remove_dir($purifdir, true);
 }
index c1946bd48caf4e8d117945626e21075b1902f033..67aa9a64deaacae79cd342bd5bff50f0b0342b6a 100644 (file)
@@ -519,7 +519,7 @@ function tag_delete($tagids) {
         }
         // only delete the main entry if there were no problems deleting all the 
         // instances - that (and the fact we won't often delete lots of tags) 
-        // is the reason for not using delete_records_select()
+        // is the reason for not using $DB->delete_records_select()
         if ($DB->delete_records('tag_instance', array('tagid'=>$tagid)) ) {
             $success &= (bool) $DB->delete_records('tag', array('id'=>$tagid));
         }