]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed to use the new debugging function
authormoodler <moodler>
Mon, 18 Sep 2006 09:13:04 +0000 (09:13 +0000)
committermoodler <moodler>
Mon, 18 Sep 2006 09:13:04 +0000 (09:13 +0000)
21 files changed:
mod/assignment/restorelib.php
mod/chat/restorelib.php
mod/choice/restorelib.php
mod/data/rate.php
mod/data/rsslib.php
mod/forum/rate.php
mod/forum/restorelib.php
mod/forum/rsslib.php
mod/glossary/restorelib.php
mod/glossary/rsslib.php
mod/hotpot/db/update_to_v2.php
mod/label/restorelib.php
mod/lesson/edit.php
mod/lesson/restorelib.php
mod/quiz/restorelib.php
mod/resource/restorelib.php
mod/resource/type/ims/deploy.php
mod/resource/type/ims/repository_deploy.php
mod/survey/restorelib.php
mod/wiki/restorelib.php
mod/workshop/restorelib.php

index a60f3249265d42c953ce193ddb80fc0f2d6735eb..21562219e99847407dfdbba4b1f3e6a6a7136dfe 100644 (file)
                     //Update record
                     $assignment->description = addslashes($result);
                     $status = update_record("assignment",$assignment);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index 40669b0a87da28ac3006dfc66d5ba5b997e08def..6e95d28b8b7e51eda11124276e5c5674daa700df 100644 (file)
                     //Update record
                     $chat->intro = addslashes($result);
                     $status = update_record("chat",$chat);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index c9be13e200ea14fe5f0d54977a862fada8638b20..92bd5fa5b776136e944cf7903ec68b2ce773ca56 100644 (file)
@@ -363,7 +363,7 @@ function choice_options_restore_mods($choiceid,$info,$restore) {
                     //Update record
                     $choice->text = addslashes($result);
                     $status = update_record("choice",$choice);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index 306e6431a09d1fae218872d7600ab7376a226243..618ef77c87c37b586302b45b1f9e7596ff0808a6 100755 (executable)
@@ -14,8 +14,6 @@
         error("Guests are not allowed to rate posts.", $_SERVER["HTTP_REFERER"]);
     }
 
-    $CFG->debug = 0;    /// Temporarily
-
     $returntoview = false;
 
     if (($data = data_submitted($CFG->wwwroot.'/mod/data/view.php')) and confirm_sesskey()) {
index 9a94dac74e9a6c29fc2d1061d8bb9e3dda446490..f8d2f174c410fab9c869d039c62e653d24bedbc2 100644 (file)
 
         // Check CFG->enablerssfeeds.
         if (empty($CFG->enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (admin variables)";
-            }
+            debugging("DISABLED (admin variables)");
         }
         // Check CFG->data_enablerssfeeds.
         else if (empty($CFG->data_enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (module configuration)";
-            }
+            debugging("DISABLED (module configuration)");
         }
         // It's working so we start...
         else {
index 1fcf1058c1b074b121348d1fb578115f58a41900..96a93e45690c7111bc0a03cca50cacf0fc902442 100644 (file)
@@ -27,7 +27,6 @@
 
     require_login($course->id);
 
-    $CFG->debug = 0;    /// Temporarily
     $returntoview = false;
 
     if (!$data = data_submitted("$CFG->wwwroot/mod/forum/discuss.php")) {    // form submitted
index c37309c4a9b8b4fbd04273dc4004bbe12dc20a2f..c43b7b9ef92e059aebe12e3d5b01396fc53ce5af 100644 (file)
                     //Update record
                     $post->message = addslashes($result);
                     $status = update_record("forum_posts",$post);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
                     //Update record
                     $forum->intro = addslashes($result);
                     $status = update_record("forum",$forum);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index a4021cb9147ee990d02734e3123014d731aba787..01dd46f443b18b3b474f10ce6350aae4df5664b7 100644 (file)
 
         //Check CFG->enablerssfeeds
         if (empty($CFG->enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (admin variables)";
-            }
+            debugging('DISABLED (admin variables)');
         //Check CFG->forum_enablerssfeeds
         } else if (empty($CFG->forum_enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (module configuration)";
-            }
+            debugging('DISABLED (module configuration)');
         //It's working so we start...
         } else {
             //Iterate over all forums
 
                         mtrace("Updating RSS feed for ".format_string($forum->name,true).", ID: $forum->id");
 
-                        //Some debug...
-                        if ($CFG->debug > 7) {
-                            echo "ID: $forum->id->";
-                        }
                         //Get the XML contents
                         $result = forum_rss_feed($forum);
                         //Save the XML contents to file
                         if (!empty($result)) {
                             $status = rss_save_file("forum",$forum,$result);
                         }
-                        //Some debug...
-                        if ($CFG->debug > 7) {
+                        if (debugging()) {
                             if (empty($result)) {
-                                echo "(empty) ";
+                                echo "ID: $forum->id-> (empty) ";
                             } else {
                                 if (!empty($status)) {
-                                    echo "OK ";
+                                    echo "ID: $forum->id-> OK ";
                                 } else {
-                                    echo "FAIL ";
+                                    echo "ID: $forum->id-> FAIL ";
                                 }
                             }
                         }
 
         //Check CFG->enablerssfeeds
         if (empty($CFG->enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (admin variables)";
-            }
+            debugging("DISABLED (admin variables)");
         //Check CFG->forum_enablerssfeeds
         } else if (empty($CFG->forum_enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (module configuration)";
-            }
+            debugging("DISABLED (module configuration)");
         //It's working so we start...
         } else {
             //Check the forum has rss activated
index d234e5c57a2a312c7704fb8979008320ace8e04c..d6ccd0ab4988b2dc982b8aef3c814b99c8fdb0f3 100644 (file)
                     //Update record
                     $entry->definition = addslashes($result);
                     $status = update_record("glossary_entries",$entry);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
                     //Update record
                     $glossary->intro = addslashes($result);
                     $status = update_record("glossary",$glossary);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index bbef6395565f12f0b2c300d85516397d24d787da..4143db6e598a82f371cd36d09a7aeaa50e3851e9 100644 (file)
 
         //Check CFG->enablerssfeeds
         if (empty($CFG->enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (admin variables)";
-            }
+            debugging("DISABLED (admin variables)");
         //Check CFG->glossary_enablerssfeeds
         } else if (empty($CFG->glossary_enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (module configuration)";
-            }
+            debugging("DISABLED (module configuration)");
         //It's working so we start...
         } else {
             //Iterate over all glossaries
 
                         mtrace("Updating RSS feed for ".format_string($glossary->name,true).", ID: $glossary->id");
 
-                        //Some debug...
-                        if ($CFG->debug > 7) {
-                            echo "ID: $glossary->id->";
-                        }
                         //Get the XML contents
                         $result = glossary_rss_feed($glossary);
                         //Save the XML contents to file
                             $status = rss_save_file("glossary",$glossary,$result);
                         }
                         //Some debug...
-                        if ($CFG->debug > 7) {
+                        if (debugging()) {
                             if (empty($result)) {
-                                echo "(empty) ";
+                                echo "ID: $glossary->id-> (empty) ";
                             } else {
                                 if (!empty($status)) {
-                                    echo "OK ";
+                                    echo "ID: $glossary->id-> OK ";
                                 } else {
-                                    echo "FAIL ";
+                                    echo "ID: $glossary->id-> FAIL ";
                                 }
                             }
                         }
 
         //Check CFG->enablerssfeeds
         if (empty($CFG->enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (admin variables)";
-            }
+            debugging("DISABLED (admin variables)");
         //Check CFG->glossary_enablerssfeeds
         } else if (empty($CFG->glossary_enablerssfeeds)) {
-            //Some debug...
-            if ($CFG->debug > 7) {
-                echo "DISABLED (module configuration)";
-            }
+            debugging("DISABLED (module configuration)");
         //It's working so we start...
         } else {
             //Check the glossary has rss activated
index 5ef0ca32403eaa27637ad97cd6e11b24916d3a47..ad9a283df45b6972958da2d4a2e72bea0bbf654c 100644 (file)
@@ -1076,7 +1076,7 @@ function hotpot_db_object_exists($table, $field='', $feedback=false) {
     // restore SQL message echo setting
     $db->debug = $debug;
     // report error if required
-    if (empty($rs) && isset($CFG->debug) and $CFG->debug > 7) {
+    if (empty($rs) && debugging()) {
         notify($db->ErrorMsg()."<br /><br />$sql");
     }
     return ($rs && $rs->RecordCount()>0);
@@ -1336,9 +1336,7 @@ function hotpot_db_update_record($table, $record, $forcenull=false) {
             $rs = $db->Execute($sql);
             if (empty($rs)) {
                 $ok = false;
-                if (isset($CFG->debug) and $CFG->debug > 7) {
-                    notify($db->ErrorMsg()."<br /><br />$sql");
-                }
+                debugging($db->ErrorMsg()."<br /><br />$sql");
             }
         }
     }
index 9b3aa6f6a43360bf9e0e6b225fb5ed8a246a9379..ab6259955ec62d9cd4c63b623794a36d984cf2a9 100644 (file)
@@ -81,7 +81,7 @@
                     //Update record
                     $label->content = addslashes($result);
                     $status = update_record("label", $label);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index e704f48ed37c4c4fbd8e4da1ca3a115664468c84..eabad28a90926ed80a44806a888b0de00c927e21 100644 (file)
                     if ($page->prevpageid != $prevpageid) {
                         // fix it
                         set_field("lesson_pages", "prevpageid", $prevpageid, "id", $page->id);
-                        if ($CFG->debug) {
-                            echo "<p>***prevpageid of page $page->id set to $prevpageid***";
-                        }
+                        debugging("<p>***prevpageid of page $page->id set to $prevpageid***");
                     }
                     
                     if (count($pages) == 1) {
     } 
 
     print_footer($course);
-?>
\ No newline at end of file
+?>
index c96b5308e90c440fab7225cdd57dfcbe38836416..0b418f843178036bf2cfe7bf0a26e48a366a3667 100644 (file)
                     //Update record
                     $page->contents = addslashes($result);
                     $status = update_record("lesson_pages",$page);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index fb44a866610b978a4947b491d587fca86aae1bce..9a133b938628fedbe94a873bc11642f8f3e72161 100644 (file)
                     //Update record
                     $quiz->intro = addslashes($result);
                     $status = update_record("quiz",$quiz);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
         return implode(',', $questionids);
     }
 
-?>
\ No newline at end of file
+?>
index 2d5cd21d8f6534ab5ec4780c28ba4aff945ea02c..115a449ed5b3c8ed9859db41d8ec3a1fadd7401f 100644 (file)
                     $resource->summary = addslashes($result2);
                     $resource->reference = addslashes($result3);
                     $status = update_record("resource",$resource);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content1).'<br />changed to<br />'.s($result1).'<hr /><br />';
                             echo '<br /><hr />'.s($content2).'<br />changed to<br />'.s($result2).'<hr /><br />';
index f394786509c190683d47784dd71b0d22180aaa47..9371bcaa25f7cb98ae03a97b0d6997f80bac30ed 100644 (file)
 
     /// Get the default organization
         $default_organization = $data['@']['default'];
-        if ($CFG->debug > 7) print_object('default_organization: '.$default_organization);
+        debugging('default_organization: '.$default_organization);
 
     /// Iterate (reverse) over organizations until we find the default one
         if (empty($data['#']['organization'])) {  /// Verify <organization> exists
             return false;
         }
         $count_organizations = count($data['#']['organization']);
-        if ($CFG->debug > 7) print_object('count_organizations: '.$count_organizations);
+        debugging('count_organizations: '.$count_organizations);
 
         $current_organization = $count_organizations - 1;
         while ($current_organization >= 0) {
         }
 
     /// At this point we MUST have the final organization
-        if ($CFG->debug > 7) print_object('final organization: '.$organization['#']['title'][0]['#']);
+        debugging('final organization: '.$organization['#']['title'][0]['#']);
         if (empty($organization)) {
             return false;    //Error, no organization found
         }
 
     /// Iterate over items from start to end
         $count_items = count($items);
-        if ($CFG->debug > 7) print_object('level '.$level.'-count_items: '.$count_items);
+        debugging('level '.$level.'-count_items: '.$count_items);
 
         $current_item = 0;
         while ($current_item < $count_items) {
                 !empty($obj_item->identifier)) {
             /// Add to itemmap
                 $itemmap[$id] = $obj_item;
-                if ($CFG->debug > 7) print_object('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
+                debugging('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
             /// Counters go up
                 $id++;
             /// Check for subitems recursively
             return false;
         }
         $count_resources = count($data);
-        if ($CFG->debug > 7) print_object('count_resources: '.$count_resources);
+        debugging('count_resources: '.$count_resources);
 
         $current_resource = 0;
         while ($current_resource < $count_resources) {
index 56a9d7db961d82d6b36e5c35e97d05b705ad16e0..0e5599c41bb7f586aeb88f19febce63ef5258062 100644 (file)
         
     /// Get the default organization
         $default_organization = $data['@']['default'];
-        if ($CFG->debug > 7) print_object('default_organization: '.$default_organization);
+        debugging('default_organization: '.$default_organization);
 
     /// Iterate (reverse) over organizations until we find the default one
         if (empty($data['#']['organization'])) {  /// Verify <organization> exists
             return false;
         }
         $count_organizations = count($data['#']['organization']);
-        if ($CFG->debug > 7) print_object('count_organizations: '.$count_organizations);
+        debugging('count_organizations: '.$count_organizations);
 
         $current_organization = $count_organizations - 1;
         while ($current_organization >= 0) {
         }
 
     /// At this point we MUST have the final organization
-        if ($CFG->debug > 7) print_object('final organization: '.$organization['#']['title'][0]['#']);
+        debugging('final organization: '.$organization['#']['title'][0]['#']);
         if (empty($organization)) {
             return false;    //Error, no organization found
         }
 
     /// Iterate over items from start to end
         $count_items = count($items);
-        if ($CFG->debug > 7) print_object('level '.$level.'-count_items: '.$count_items);
+        debugging('level '.$level.'-count_items: '.$count_items);
 
         $current_item = 0;
         while ($current_item < $count_items) {
                 !empty($obj_item->identifier)) {
             /// Add to itemmap
                 $itemmap[$id] = $obj_item;
-                if ($CFG->debug > 7) print_object('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
+                debugging('level '.$level.'-id '.$id.'-parent '.$parent.'-'.$obj_item->title);
             /// Counters go up
                 $id++;
             /// Check for subitems recursively
             return false;
         }
         $count_resources = count($data);
-        if ($CFG->debug > 7) print_object('count_resources: '.$count_resources);
+        debugging('count_resources: '.$count_resources);
 
         $current_resource = 0;
         while ($current_resource < $count_resources) {
index 53c658518b7c95b9846e84452f82478438a0e663..90525d53d7a79794eba5e595b8c93a23f840694f 100644 (file)
                     //Update record
                     $survey->intro = addslashes($result);
                     $status = update_record("survey",$survey);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index 3e9c753d7395867826b0683712d3796ed7794736..71224176a14ec216db7548e17dbbae34dcd12d71 100644 (file)
                     //Update record
                     $page->content = addslashes($result);
                     $status = update_record("wiki_pages",$page);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
                     //Update record
                     $wiki->summary = addslashes($result);
                     $status = update_record("wiki",$wiki);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }
index 1258529fb8240913c64d1fcfafa02269bcce59ed..f8670e392e34d681467805247a4a7facf28e8fcb 100644 (file)
                     //Update record
                     $workshop->description = addslashes($result);
                     $status = update_record("workshop",$workshop);
-                    if ($CFG->debug>7) {
+                    if (debugging()) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo '<br /><hr />'.s($content).'<br />changed to<br />'.s($result).'<hr /><br />';
                         }