diff --git a/mod/assignment/restorelib.php b/mod/assignment/restorelib.php
index a60f3249265..21562219e99 100644
--- a/mod/assignment/restorelib.php
+++ b/mod/assignment/restorelib.php
@@ -338,7 +338,7 @@
//Update record
$assignment->description = addslashes($result);
$status = update_record("assignment",$assignment);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/chat/restorelib.php b/mod/chat/restorelib.php
index 40669b0a87d..6e95d28b8b7 100644
--- a/mod/chat/restorelib.php
+++ b/mod/chat/restorelib.php
@@ -231,7 +231,7 @@
//Update record
$chat->intro = addslashes($result);
$status = update_record("chat",$chat);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/choice/restorelib.php b/mod/choice/restorelib.php
index c9be13e200e..92bd5fa5b77 100644
--- a/mod/choice/restorelib.php
+++ b/mod/choice/restorelib.php
@@ -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 '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/data/rate.php b/mod/data/rate.php
index 306e6431a09..618ef77c87c 100755
--- a/mod/data/rate.php
+++ b/mod/data/rate.php
@@ -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()) {
diff --git a/mod/data/rsslib.php b/mod/data/rsslib.php
index 9a94dac74e9..f8d2f174c41 100644
--- a/mod/data/rsslib.php
+++ b/mod/data/rsslib.php
@@ -13,17 +13,11 @@
// 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 {
diff --git a/mod/forum/rate.php b/mod/forum/rate.php
index 1fcf1058c1b..96a93e45690 100644
--- a/mod/forum/rate.php
+++ b/mod/forum/rate.php
@@ -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
diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php
index c37309c4a9b..c43b7b9ef92 100644
--- a/mod/forum/restorelib.php
+++ b/mod/forum/restorelib.php
@@ -1134,7 +1134,7 @@
//Update record
$post->message = addslashes($result);
$status = update_record("forum_posts",$post);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
@@ -1168,7 +1168,7 @@
//Update record
$forum->intro = addslashes($result);
$status = update_record("forum",$forum);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/forum/rsslib.php b/mod/forum/rsslib.php
index a4021cb9147..01dd46f443b 100644
--- a/mod/forum/rsslib.php
+++ b/mod/forum/rsslib.php
@@ -12,16 +12,10 @@
//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
@@ -50,25 +44,20 @@
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 ";
}
}
}
@@ -100,16 +89,10 @@
//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
diff --git a/mod/glossary/restorelib.php b/mod/glossary/restorelib.php
index d234e5c57a2..d6ccd0ab498 100644
--- a/mod/glossary/restorelib.php
+++ b/mod/glossary/restorelib.php
@@ -632,7 +632,7 @@
//Update record
$entry->definition = addslashes($result);
$status = update_record("glossary_entries",$entry);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
@@ -666,7 +666,7 @@
//Update record
$glossary->intro = addslashes($result);
$status = update_record("glossary",$glossary);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/glossary/rsslib.php b/mod/glossary/rsslib.php
index bbef6395565..4143db6e598 100644
--- a/mod/glossary/rsslib.php
+++ b/mod/glossary/rsslib.php
@@ -12,16 +12,10 @@
//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
@@ -50,10 +44,6 @@
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
@@ -61,14 +51,14 @@
$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 ";
}
}
}
@@ -100,16 +90,10 @@
//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
diff --git a/mod/hotpot/db/update_to_v2.php b/mod/hotpot/db/update_to_v2.php
index 5ef0ca32403..ad9a283df45 100644
--- a/mod/hotpot/db/update_to_v2.php
+++ b/mod/hotpot/db/update_to_v2.php
@@ -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()."
$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()."
$sql");
- }
+ debugging($db->ErrorMsg()."
$sql");
}
}
}
diff --git a/mod/label/restorelib.php b/mod/label/restorelib.php
index 9b3aa6f6a43..ab6259955ec 100644
--- a/mod/label/restorelib.php
+++ b/mod/label/restorelib.php
@@ -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 '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/lesson/edit.php b/mod/lesson/edit.php
index e704f48ed37..eabad28a909 100644
--- a/mod/lesson/edit.php
+++ b/mod/lesson/edit.php
@@ -272,9 +272,7 @@
if ($page->prevpageid != $prevpageid) {
// fix it
set_field("lesson_pages", "prevpageid", $prevpageid, "id", $page->id);
- if ($CFG->debug) {
- echo "***prevpageid of page $page->id set to $prevpageid***";
- }
+ debugging("
***prevpageid of page $page->id set to $prevpageid***");
}
if (count($pages) == 1) {
@@ -290,4 +288,4 @@
}
print_footer($course);
-?>
\ No newline at end of file
+?>
diff --git a/mod/lesson/restorelib.php b/mod/lesson/restorelib.php
index c96b5308e90..0b418f84317 100644
--- a/mod/lesson/restorelib.php
+++ b/mod/lesson/restorelib.php
@@ -801,7 +801,7 @@
//Update record
$page->contents = addslashes($result);
$status = update_record("lesson_pages",$page);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php
index fb44a866610..9a133b93862 100644
--- a/mod/quiz/restorelib.php
+++ b/mod/quiz/restorelib.php
@@ -556,7 +556,7 @@
//Update record
$quiz->intro = addslashes($result);
$status = update_record("quiz",$quiz);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
@@ -845,4 +845,4 @@
return implode(',', $questionids);
}
-?>
\ No newline at end of file
+?>
diff --git a/mod/resource/restorelib.php b/mod/resource/restorelib.php
index 2d5cd21d8f6..115a449ed5b 100644
--- a/mod/resource/restorelib.php
+++ b/mod/resource/restorelib.php
@@ -200,7 +200,7 @@
$resource->summary = addslashes($result2);
$resource->reference = addslashes($result3);
$status = update_record("resource",$resource);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content1).'
changed to
'.s($result1).'
';
echo '
'.s($content2).'
changed to
'.s($result2).'
';
diff --git a/mod/resource/type/ims/deploy.php b/mod/resource/type/ims/deploy.php
index f394786509c..9371bcaa25f 100644
--- a/mod/resource/type/ims/deploy.php
+++ b/mod/resource/type/ims/deploy.php
@@ -277,14 +277,14 @@
/// 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 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) {
@@ -297,7 +297,7 @@
}
/// 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
}
@@ -323,7 +323,7 @@
/// 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) {
@@ -341,7 +341,7 @@
!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
@@ -377,7 +377,7 @@
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) {
diff --git a/mod/resource/type/ims/repository_deploy.php b/mod/resource/type/ims/repository_deploy.php
index 56a9d7db961..0e5599c41bb 100644
--- a/mod/resource/type/ims/repository_deploy.php
+++ b/mod/resource/type/ims/repository_deploy.php
@@ -265,14 +265,14 @@
/// 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 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) {
@@ -285,7 +285,7 @@
}
/// 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
}
@@ -311,7 +311,7 @@
/// 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) {
@@ -329,7 +329,7 @@
!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
@@ -365,7 +365,7 @@
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) {
diff --git a/mod/survey/restorelib.php b/mod/survey/restorelib.php
index 53c658518b7..90525d53d7a 100644
--- a/mod/survey/restorelib.php
+++ b/mod/survey/restorelib.php
@@ -286,7 +286,7 @@
//Update record
$survey->intro = addslashes($result);
$status = update_record("survey",$survey);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/wiki/restorelib.php b/mod/wiki/restorelib.php
index 3e9c753d739..71224176a14 100644
--- a/mod/wiki/restorelib.php
+++ b/mod/wiki/restorelib.php
@@ -376,7 +376,7 @@
//Update record
$page->content = addslashes($result);
$status = update_record("wiki_pages",$page);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
@@ -410,7 +410,7 @@
//Update record
$wiki->summary = addslashes($result);
$status = update_record("wiki",$wiki);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}
diff --git a/mod/workshop/restorelib.php b/mod/workshop/restorelib.php
index 1258529fb82..f8670e392e3 100644
--- a/mod/workshop/restorelib.php
+++ b/mod/workshop/restorelib.php
@@ -790,7 +790,7 @@
//Update record
$workshop->description = addslashes($result);
$status = update_record("workshop",$workshop);
- if ($CFG->debug>7) {
+ if (debugging()) {
if (!defined('RESTORE_SILENTLY')) {
echo '
'.s($content).'
changed to
'.s($result).'
';
}