MDL-21251 set up correct debugging in ABORT_AFTER_CONFIG scripts
authorPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 20:31:42 +0000 (20:31 +0000)
committerPetr Skoda <skodak@moodle.org>
Tue, 5 Jan 2010 20:31:42 +0000 (20:31 +0000)
lib/setup.php

index 254497cd53ae2d8cb7c80c66c2678afd96527dd7..a7fc4e717e50cf731a502ade59a53e81a4698db4 100644 (file)
@@ -50,6 +50,18 @@ $CFG->yui3version = '3.0.0';
 // special support for highly optimised scripts that do not need libraries and DB connection
 if (defined('ABORT_AFTER_CONFIG')) {
     if (!defined('ABORT_AFTER_CONFIG_CANCEL')) {
+        // hide debugging if not enabled in config.php - we do not want to disclose sensitive info
+        if (isset($CFG->debug)) {
+            error_reporting($CFG->debug);
+        } else {
+            error_reporting(0);
+        }
+        if (empty($CFG->debugdisplay)) {
+            @ini_set('display_errors', '0');
+            @ini_set('log_errors', '1');
+        } else {
+            @ini_set('display_errors', '1');
+        }
         require_once("$CFG->dirroot/lib/configonlylib.php");
         return;
     }