mirror of
https://github.com/vrana/adminer.git
synced 2025-08-13 10:04:07 +02:00
Log to "$database.sql" by default
This commit is contained in:
@@ -8,6 +8,14 @@ function connection() {
|
||||
return $connection;
|
||||
}
|
||||
|
||||
/** Get Adminer object
|
||||
* @return Adminer
|
||||
*/
|
||||
function adminer() {
|
||||
global $adminer;
|
||||
return $adminer;
|
||||
}
|
||||
|
||||
/** Unescape database identifier
|
||||
* @param string text inside ``
|
||||
* @return string
|
||||
|
@@ -10,13 +10,17 @@ class AdminerSqlLog {
|
||||
var $filename;
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param string defaults to "$database.sql"
|
||||
*/
|
||||
function AdminerSqlLog($filename = "adminer.sql") {
|
||||
function AdminerSqlLog($filename = "") {
|
||||
$this->filename = $filename;
|
||||
}
|
||||
|
||||
function messageQuery($query) {
|
||||
if ($this->filename == "") {
|
||||
$adminer = adminer();
|
||||
$this->filename = $adminer->database() . ".sql"; // no database goes to ".sql" to avoid collisions
|
||||
}
|
||||
$fp = fopen($this->filename, "a");
|
||||
flock($fp, LOCK_EX);
|
||||
fwrite($fp, $query);
|
||||
|
Reference in New Issue
Block a user