Log database queries into database.log when enabled

Instead of showing in page sources (it was impractical)
This commit is contained in:
slawkens 2020-02-15 23:18:10 +01:00
parent f3ddf631c1
commit e11d70de46
2 changed files with 4 additions and 4 deletions

View File

@ -386,10 +386,6 @@ if(superAdmin()) {
if(function_exists('memory_get_peak_usage')) {
echo PHP_EOL . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
}
if($config['database_log']) {
echo PHP_EOL . '<!-- List of MySQL queries done:' . PHP_EOL . $db->getLog() . '-->';
}
}
$hooks->trigger(HOOK_FINISH);

View File

@ -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());
}
}
/**