From e11d70de46d3e11f473d1aa8abf32b2314ad61c8 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sat, 15 Feb 2020 23:18:10 +0100 Subject: [PATCH] Log database queries into database.log when enabled Instead of showing in page sources (it was impractical) --- index.php | 4 ---- system/libs/pot/OTS_DB_MySQL.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index a6138fc8..ff1801c4 100644 --- a/index.php +++ b/index.php @@ -386,10 +386,6 @@ if(superAdmin()) { if(function_exists('memory_get_peak_usage')) { echo PHP_EOL . ''; } - - if($config['database_log']) { - echo PHP_EOL . ''; - } } $hooks->trigger(HOOK_FINISH); diff --git a/system/libs/pot/OTS_DB_MySQL.php b/system/libs/pot/OTS_DB_MySQL.php index d5c1ea26..c52d9415 100644 --- a/system/libs/pot/OTS_DB_MySQL.php +++ b/system/libs/pot/OTS_DB_MySQL.php @@ -149,6 +149,10 @@ class OTS_DB_MySQL extends OTS_Base_DB $cache->set('database_columns', serialize($this->has_column_cache)); $cache->set('database_checksum', serialize(sha1($config['database_host'] . '.' . $config['database_name']))); } + + if($this->logged) { + log_append('database.log', PHP_EOL . $this->getLog()); + } } /**