Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add download ability from the history window

  • Loading branch information...
commit 0e8c2bf0b3020e6e1dfd2be8f5003bce627c0797 1 parent 472392b
@ioguix ioguix authored
Showing with 21 additions and 2 deletions.
  1. +21 −2 history.php
View
23 history.php
@@ -72,7 +72,8 @@ function doDefault() {
if (isset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']])
&& count($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']]))
echo "\t<li><a href=\"history.php?action=confclearhistory&amp;{$misc->href}\">{$lang['strclearhistory']}</a></li>\n";
- echo "\t<li><a href=\"history.php?action=history&amp;{$misc->href}\">{$lang['strrefresh']}</a></li>\n</ul>\n";
+ echo "\t<li><a href=\"history.php?action=history&amp;{$misc->href}\">{$lang['strrefresh']}</a></li>\n";
+ echo "\t<li><a href=\"history.php?action=download&amp;{$misc->href}\">{$lang['strdownload']}</a></li>\n</ul>\n";
}
function doDelHistory($qid, $confirm) {
@@ -122,7 +123,22 @@ function doClearHistory($confirm) {
else
unset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']]);
}
-
+
+ function doDownloadHistory() {
+ header('Content-Type: application/download');
+ $datetime = date('YmdHis');
+ header("Content-Disposition: attachment; filename=history{$datetime}.sql");
+
+ foreach ($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']] as $queries) {
+ $query = rtrim($queries['query']);
+ echo $query;
+ if (substr($query, -1) != ';')
+ echo ';';
+ echo "\n";
+ }
+
+ exit;
+ }
switch ($action) {
case 'confdelhistory':
@@ -139,6 +155,9 @@ function doClearHistory($confirm) {
if (isset($_POST['yes'])) doClearHistory(false);
doDefault();
break;
+ case 'download':
+ doDownloadHistory();
+ break;
default:
doDefault();
}
Please sign in to comment.
Something went wrong with that request. Please try again.