]> git.joonet.de Git - adminer.git/commitdiff
Routines and events checkboxes (thanks to cvicebni ubor)
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 25 Sep 2009 11:29:46 +0000 (11:29 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 25 Sep 2009 11:29:46 +0000 (11:29 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1146 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/dump.inc.php

index a90c44a005f99892d1e1c303153d752c6c0a4826..c3c2e80fd70a8955fa3404daed010788e8cc4aa7 100644 (file)
@@ -23,10 +23,12 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
                                $create = $connection->result($result, 1);
                                dump(($style == "CREATE+ALTER" ? preg_replace('~^CREATE DATABASE ~', '\\0IF NOT EXISTS ', $create) : $create) . ";\n");
                        }
-                       if ($style && $_POST["format"] == "sql") {
-                               dump("USE " . idf_escape($db) . ";\n" . ($style == "CREATE+ALTER" ? "SET @adminer_alter = '';\n" : "") . "\n");
+                       if ($_POST["format"] == "sql") {
+                               if ($style) {
+                                       dump("USE " . idf_escape($db) . ";\n" . ($style == "CREATE+ALTER" ? "SET @adminer_alter = '';\n" : "") . "\n");
+                               }
                                $out = "";
-                               if ($connection->server_info >= 5) {
+                               if ($_POST["routines"]) {
                                        foreach (array("FUNCTION", "PROCEDURE") as $routine) {
                                                $result = $connection->query("SHOW $routine STATUS WHERE Db = " . $connection->quote($db));
                                                while ($row = $result->fetch_assoc()) {
@@ -35,7 +37,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
                                                }
                                        }
                                }
-                               if ($connection->server_info >= 5.1) {
+                               if ($_POST["events"]) {
                                        $result = $connection->query("SHOW EVENTS");
                                        while ($row = $result->fetch_assoc()) {
                                                $out .= ($style != 'DROP+CREATE' ? "DROP EVENT IF EXISTS " . idf_escape($row["Name"]) . ";;\n" : "")
@@ -145,6 +147,15 @@ echo "<tr><th>" . lang('Output') . "<td><input type='hidden' name='token' value=
 echo "<tr><th>" . lang('Format') . "<td>$dump_format\n";
 echo "<tr><th>" . lang('Compression') . "<td>" . ($dump_compress ? $dump_compress : lang('None of the supported PHP extensions (%s) are available.', 'zlib, bz2')) . "\n";
 echo "<tr><th>" . lang('Database') . "<td><select name='db_style'>" . optionlist($db_style, (strlen(DB) ? '' : 'CREATE')) . "</select>\n";
+if ($connection->server_info >= 5) {
+       $objects = array('routines' => lang('Routines'));
+       if ($connection->server_info >= 5.1) {
+               $objects['events'] = lang('Events');
+       }
+       foreach ($objects as $key => $val) {
+               echo " <label><input type='checkbox' name='$key' value='1'" . (strlen($_GET["dump"]) ? "" : " checked") . ">$val</label>";
+       }
+}
 echo "<tr><th>" . lang('Tables') . "<td><select name='table_style'>" . optionlist($table_style, 'DROP+CREATE') . "</select>\n";
 echo "<tr><th>" . lang('Data') . "<td><select name='data_style'>" . optionlist($data_style, 'INSERT') . "</select>\n";
 ?>