Merge branch 'bug-602' into release
[cacert-devel.git] / www / sqldump.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 header("content-type: text/plain");
19 ?>
20 # CAcert SQL Dump
21 # version 0.0.2
22 #
23 # Generation Time: <?=date('r')?>
24 #
25 # Database: `cacert`
26 #
27 <?
28 $tables = mysql_list_tables('cacert');
29 while(list($table_name) = mysql_fetch_array($tables))
30 {
31 echo "# --------------------------------------------------------\n\n";
32 echo "#\n# Table structure for table `$table_name`\n#\n\n";
33
34 echo "DROP TABLE IF EXISTS `$table_name`;\n";
35 $create = mysql_fetch_assoc(mysql_query("SHOW CREATE TABLE `cacert`.`$table_name`"));
36 echo $create['Create Table'].";\n\n";
37 }
38 ?>