]> git.joonet.de Git - adminer.git/commitdiff
New plugin: SQL log
authorJakub Vrana <jakub@vrana.cz>
Mon, 8 Aug 2011 15:19:56 +0000 (17:19 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 8 Aug 2011 15:19:56 +0000 (17:19 +0200)
adminer/plugin.php
plugins/sql-log.php [new file with mode: 0644]

index 84198adbc671c994fa8bfd65ded17563a9f9a044..082817d3d7561609d7475fe2b75cdf832f3ff6e6 100644 (file)
@@ -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")),
diff --git a/plugins/sql-log.php b/plugins/sql-log.php
new file mode 100644 (file)
index 0000000..6310a73
--- /dev/null
@@ -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);
+       }
+       
+}