From 7900a54c3040a7caff0c0811ff0a0fbb0e1334c9 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 13 Jun 2009 09:16:30 +0000 Subject: [PATCH] MDL-14679 fixing old TODOs and adding more CLI support --- lib/dml/moodle_database.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 3f4f2c3514..000a9d49a7 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -372,13 +372,21 @@ abstract class moodle_database { if (!$this->get_debug()) { return; } - //TODO: detect CLI mode and skip s() ;-) - echo "
\n"; - echo s($sql)."\n"; - if (!is_null($params)) { - echo "[".s(var_export($params, true))."]\n"; + if (CLI_SCRIPT) { + echo "--------------------------------\n"; + echo $sql."\n"; + if (!is_null($params)) { + echo "[".var_export($params, true)."]\n"; + } + echo "--------------------------------\n"; + } else { + echo "
\n"; + echo s($sql)."\n"; + if (!is_null($params)) { + echo "[".s(var_export($params, true))."]\n"; + } + echo "
\n"; } - echo "
\n"; } /** @@ -735,7 +743,7 @@ abstract class moodle_database { * @param bool $state */ public function set_logging($state) { - // TODO: adodb sql logging shares one table without prefix per db - this is no longer acceptable :-( + // adodb sql logging shares one table without prefix per db - this is no longer acceptable :-( // we must create one table shared by all drivers } -- 2.39.5