Permalink
Browse files

New plugin: SQL log

  • Loading branch information...
1 parent e011b87 commit b96facf0af8257345bd88bba428fa6087dedd1a2 @vrana committed Aug 8, 2011
Showing with 29 additions and 0 deletions.
  1. +1 −0 adminer/plugin.php
  2. +28 −0 plugins/sql-log.php
View
@@ -12,6 +12,7 @@ function adminer_object() {
// specify enabled plugins here
new AdminerDumpZip,
new AdminerDumpXml,
+ //~ new AdminerSqlLog("past-" . rtrim(`git describe --tags --abbrev=0`) . ".sql"),
//~ new AdminerEditCalendar("<script type='text/javascript' src='../externals/jquery-ui/jquery-1.4.4.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.core.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.widget.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.datepicker.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.mouse.js'></script>\n<script type='text/javascript' src='../externals/jquery-ui/ui/jquery.ui.slider.js'></script>\n<script type='text/javascript' src='../externals/jquery-timepicker/jquery-ui-timepicker-addon.js'></script>\n<link rel='stylesheet' href='../externals/jquery-ui/themes/base/jquery.ui.all.css'>\n<style type='text/css'>\n.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }\n.ui-timepicker-div dl { text-align: left; }\n.ui-timepicker-div dl dt { height: 25px; }\n.ui-timepicker-div dl dd { margin: -25px 0 10px 65px; }\n.ui-timepicker-div td { font-size: 90%; }\n</style>\n", "../externals/jquery-ui/ui/i18n/jquery.ui.datepicker-%s.js"),
//~ new AdminerTinymce("../externals/tinymce/jscripts/tiny_mce/tiny_mce_dev.js"),
//~ new AdminerWymeditor(array("../externals/wymeditor/src/jquery/jquery.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.explorer.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.mozilla.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.opera.js", "../externals/wymeditor/src/wymeditor/jquery.wymeditor.safari.js")),
View
@@ -0,0 +1,28 @@
+<?php
+
+/** Log all queries to SQL file
+* @author Jakub Vrana, http://www.vrana.cz/
+* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+*/
+class AdminerSqlLog {
+ /** @var string @access protected */
+ var $filename;
+
+ /**
+ * @param string
+ */
+ function AdminerSqlLog($filename = "adminer.sql") {
+ $this->filename = $filename;
+ }
+
+ function messageQuery($query) {
+ $fp = fopen($this->filename, "a");
+ flock($fp, LOCK_EX);
+ fwrite($fp, $query);
+ fwrite($fp, "\n\n");
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ }
+
+}

0 comments on commit b96facf

Please sign in to comment.