Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Log to "$database.sql" by default

  • Loading branch information...
commit 71e0db4106fb9e33571f01e3c34748d85b2789a4 1 parent db2ac19
@vrana authored
Showing with 14 additions and 2 deletions.
  1. +8 −0 adminer/include/functions.inc.php
  2. +6 −2 plugins/sql-log.php
View
8 adminer/include/functions.inc.php
@@ -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
View
8 plugins/sql-log.php
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.