From 0e1cc9070b00ea259dd0bbd542f5b3bb1cb8c8ff Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 18 Sep 2006 13:24:45 +0000 Subject: [PATCH] Fixed a some debugging statements --- backup/backuplib.php | 14 +++++--------- backup/restorelib.php | 2 +- blocks/rss_client/block_rss_client.php | 4 ++-- blocks/rss_client/block_rss_client_action.php | 6 +++--- blog/rsslib.php | 4 +--- course/format/topics/format.php | 2 +- enrol/database/enrol_database_sync.php | 2 +- enrol/ldap/enrol_ldap_sync.php | 3 ++- filter/algebra/pix.php | 2 +- filter/tex/pix.php | 2 +- iplookup/ipatlas/ip-atlas_prefs.php | 6 ------ iplookup/ipatlas/plot.php | 6 ------ question/type/rqp/lib.php | 2 +- theme/formal_white/footer.html | 2 +- theme/metal/footer.html | 2 +- theme/oceanblue/footer.html | 2 +- theme/standard/footer.html | 2 +- 17 files changed, 23 insertions(+), 40 deletions(-) diff --git a/backup/backuplib.php b/backup/backuplib.php index dbf70b412b4d0..7e100e0bdfd27 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -1385,9 +1385,7 @@ function backup_gradebook_item_info($bf,$preferences,$gradecategoryid) { $grade_item->module_name = $rec_module->name; $inc_grade_items[] = $grade_item; } else { - if ($CFG->debug > 7) { - echo "skipping $grade_item->modid"."-"."$rec_module->name
"; - } + debugging("skipping $grade_item->modid"."-"."$rec_module->name
"); } } } @@ -1443,9 +1441,7 @@ function backup_gradebook_exceptions_info($bf,$preferences,$gradeitemid) { //Add it $inc_grade_exceptions[] = $grade_exception; } else { - if ($CFG->debug > 7) { - echo "skipping $grade_exception->userid"."-user
"; - } + debugging("skipping $grade_exception->userid"."-user
"); } } } @@ -1729,9 +1725,9 @@ function backup_encode_absolute_links($content) { } } - if ($result != $content && $CFG->debug>7) { //Debug - echo '

'.s($content).'
changed to
'.s($result).'

'; //Debug - } //Debug + if ($result != $content) { + debugging('

'.s($content).'
changed to
'.s($result).'

'); + } return $result; } diff --git a/backup/restorelib.php b/backup/restorelib.php index 7f4654f52efc0..ca3e345bf9fe3 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -2287,7 +2287,7 @@ function restore_decode_absolute_links($content) { $result = str_replace($search,$replace,$content); - if ($result != $content && $CFG->debug>7) { //Debug + if ($result != $content && debugging()) { //Debug if (!defined('RESTORE_SILENTLY')) { echo '

'.s($content).'
changed to
'.s($result).'

'; //Debug } diff --git a/blocks/rss_client/block_rss_client.php b/blocks/rss_client/block_rss_client.php index 565a14a3c7939..96bfb035f25c4 100644 --- a/blocks/rss_client/block_rss_client.php +++ b/blocks/rss_client/block_rss_client.php @@ -180,7 +180,7 @@ function get_rss_by_id($rssid, $display_description, $shownumentries, $showtitle ob_end_clean(); if ($rss === false) { - if ($CFG->debug && !empty($rsserror)) { + if (debugging() && !empty($rsserror)) { // There was a failure in loading the rss feed, print link to full error text return 'Error loading a feed.
'; //Daryl Hawes note: localize this line } @@ -274,4 +274,4 @@ function format_title($title,$max=64) { } } } -?> \ No newline at end of file +?> diff --git a/blocks/rss_client/block_rss_client_action.php b/blocks/rss_client/block_rss_client_action.php index 59de052959617..19d30380e655b 100644 --- a/blocks/rss_client/block_rss_client_action.php +++ b/blocks/rss_client/block_rss_client_action.php @@ -114,7 +114,7 @@ $message = ''; ob_start(); $rss = fetch_rss($url); - if ($CFG->debug) { + if (debugging()) { $message .= ob_get_contents(); } ob_end_clean(); @@ -181,7 +181,7 @@ $message = ''; ob_start(); $rss = fetch_rss($url); - if ($CFG->debug) { + if (debugging()) { $message .= ob_get_contents(); } ob_end_clean(); @@ -288,4 +288,4 @@ rss_print_form($act, $url, $rssid, $preferredtitle, $shared, $id, $context); } print_footer(); -?> \ No newline at end of file +?> diff --git a/blog/rsslib.php b/blog/rsslib.php index 7fbb95a94eef5..0d2688895aafd 100755 --- a/blog/rsslib.php +++ b/blog/rsslib.php @@ -53,9 +53,7 @@ function blog_generate_rss_feed($type, $id, $tagid=0) { global $CFG, $SITE; if (empty($CFG->enablerssfeeds)) { - if ($CFG->debug > 7) { - notify('Sorry, RSS feeds are disabled on this site'); - } + debugging('Sorry, RSS feeds are disabled on this site'); return ''; } diff --git a/course/format/topics/format.php b/course/format/topics/format.php index c2b63c1ad73ac..7ad4215f9d9e1 100644 --- a/course/format/topics/format.php +++ b/course/format/topics/format.php @@ -73,7 +73,7 @@ 'ajaxcourse_blocks','ajaxcourse_sections','ajaxcourse_topic')); //javascript logging facilities - if ($CFG->debug > 7) { + if (debugging()) { print_require_js(Array('yui_logger')); } } diff --git a/enrol/database/enrol_database_sync.php b/enrol/database/enrol_database_sync.php index 3a6f24a359151..a3dc7b2af239d 100644 --- a/enrol/database/enrol_database_sync.php +++ b/enrol/database/enrol_database_sync.php @@ -14,7 +14,7 @@ require_once($CFG->dirroot . "/enrol/" . $CFG->enrol . "/enrol.php"); // ensure errors are well explained - $CFG->debug=10; + $CFG->debug=E_ALL; // update enrolments -- these handlers should autocreate courses if required $enrol = new enrolment_plugin(); $enrol->sync_enrolments('student', true); diff --git a/enrol/ldap/enrol_ldap_sync.php b/enrol/ldap/enrol_ldap_sync.php index a8a5621e39a96..4b68941585981 100755 --- a/enrol/ldap/enrol_ldap_sync.php +++ b/enrol/ldap/enrol_ldap_sync.php @@ -14,7 +14,8 @@ require_once($CFG->dirroot . "/enrol/ldap/enrol.php"); // ensure errors are well explained - $CFG->debug=10; + $CFG->debug = E_NOTICE; + // update enrolments -- these handlers should autocreate courses if required $enrol = new enrolment_plugin_ldap(); $enrol->enrol_ldap_connect(); diff --git a/filter/algebra/pix.php b/filter/algebra/pix.php index 8fd51bff894e5..53a00746bcbe8 100644 --- a/filter/algebra/pix.php +++ b/filter/algebra/pix.php @@ -73,7 +73,7 @@ break; default: /// Nothing was found, so tell them how to fix it. - if ($CFG->debug > 7) { + if (debugging()) { echo "Make sure you have an appropriate MimeTeX binary here:\n\n"; echo " $CFG->dirroot/$CFG->texfilterdir/mimetex\n\n"; echo "and that it has the right permissions set on it as executable program.\n\n"; diff --git a/filter/tex/pix.php b/filter/tex/pix.php index 1977c8eb88763..084c4812049b1 100644 --- a/filter/tex/pix.php +++ b/filter/tex/pix.php @@ -91,7 +91,7 @@ break; default: /// Nothing was found, so tell them how to fix it. - if ($CFG->debug > 7) { + if (debugging()) { echo "Make sure you have an appropriate MimeTeX binary here:\n\n"; echo " $CFG->dirroot/$CFG->texfilterdir/mimetex\n\n"; echo "and that it has the right permissions set on it as executable program.\n\n"; diff --git a/iplookup/ipatlas/ip-atlas_prefs.php b/iplookup/ipatlas/ip-atlas_prefs.php index 8c752ae0aa725..dde0f0005afa3 100644 --- a/iplookup/ipatlas/ip-atlas_prefs.php +++ b/iplookup/ipatlas/ip-atlas_prefs.php @@ -3,12 +3,6 @@ include("plotconf.inc"); include("plot.inc"); -if($CFG->debug > 1) { - error_reporting(E_ALL); -} else { - error_reporting(E_ERROR); -} - if (isset($HTTP_GET_VARS["lastquery"])){ $HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST); } diff --git a/iplookup/ipatlas/plot.php b/iplookup/ipatlas/plot.php index 721d88aa49819..878001d9d9859 100644 --- a/iplookup/ipatlas/plot.php +++ b/iplookup/ipatlas/plot.php @@ -11,12 +11,6 @@ $username = ""; } -if ($CFG->debug > 1) { -error_reporting(E_ALL); -} else { -error_reporting(E_ERROR); -} - // cleanup if (isset($HTTP_GET_VARS["lastquery"])) { $HTTP_GET_VARS["lastquery"] = clean_param($HTTP_GET_VARS["lastquery"], PARAM_HOST); diff --git a/question/type/rqp/lib.php b/question/type/rqp/lib.php index c03153171bd23..0083a3f837567 100644 --- a/question/type/rqp/lib.php +++ b/question/type/rqp/lib.php @@ -119,7 +119,7 @@ function question_rqp_print_serverinfo($serverinfo) { function question_rqp_debug_soap($item) { global $CFG; - if ($CFG->debug) { + if (debugging()) { echo 'Here is the dump of the soap fault:
';
         var_dump($item);
         echo '
';
diff --git a/theme/formal_white/footer.html b/theme/formal_white/footer.html
index a850dcf31a8dc..dda49f3efbeb1 100644
--- a/theme/formal_white/footer.html
+++ b/theme/formal_white/footer.html
@@ -25,7 +25,7 @@
           echo $performanceinfo;
 } ?>
 
-debug > 7) {
+
           

diff --git a/theme/metal/footer.html b/theme/metal/footer.html index cd3bd9c3c5df6..7e816eba83f08 100644 --- a/theme/metal/footer.html +++ b/theme/metal/footer.html @@ -13,7 +13,7 @@ echo '

'; ?> -debug > 7) { +
diff --git a/theme/oceanblue/footer.html b/theme/oceanblue/footer.html index 887c2c50a2452..0388dc4e52e41 100644 --- a/theme/oceanblue/footer.html +++ b/theme/oceanblue/footer.html @@ -25,7 +25,7 @@ echo $performanceinfo; } ?> -debug > 7) { +

diff --git a/theme/standard/footer.html b/theme/standard/footer.html index ece17ef8c2007..46c31eb82c244 100644 --- a/theme/standard/footer.html +++ b/theme/standard/footer.html @@ -23,7 +23,7 @@ echo $performanceinfo; } ?> -debug > 7) { +