author | Dan Fuhry <dan@enanocms.org> |
Sat, 21 Aug 2010 18:19:58 -0400 | |
changeset 10 | 014d58335b6d |
parent 4 | ea7b100e5de6 |
permissions | -rw-r--r-- |
4 | 1 |
<?php |
2 |
||
3 |
// basically: self-destruct the database side of Enano. |
|
4 |
||
5 |
$mydir = dirname(__FILE__); |
|
6 |
require($mydir . '/../htdocs/includes/common.php'); |
|
7 |
if ( !defined('ENANO_CLI') ) |
|
10
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
8 |
die("Don't even try."); |
4 | 9 |
|
10 |
require(ENANO_ROOT . '/config.php'); |
|
11 |
||
10
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
12 |
if ( !in_array('--skip-revoke', $argv) ) |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
13 |
{ |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
14 |
$db->sql_query("DROP DATABASE `$dbname`;"); |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
15 |
// one is mysql, one is postgresql |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
16 |
// too lazy to check right now |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
17 |
// FIXME this fails right now because we don't have root |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
18 |
$db->sql_query("DROP ROLE `$dbuser`;"); |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
19 |
$db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;"); |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
20 |
} |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
21 |
else |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
22 |
{ |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
23 |
foreach ( $system_table_list as $table ) |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
24 |
{ |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
25 |
$q = "DROP TABLE `" . table_prefix . "$table`;"; |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
26 |
echo "$q\n"; |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
27 |
$db->sql_query($q); |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
28 |
} |
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
29 |
} |
4 | 30 |
|
10
014d58335b6d
Changed behavior of the entire database selection process. A real "upgrade"/"don't touch the database" option was added, and the old options unconditionally delete the database.
Dan Fuhry <dan@enanocms.org>
parents:
4
diff
changeset
|
31 |
exit(0); |
4 | 32 |