inst-resources/selfdestruct.php
changeset 10 014d58335b6d
parent 4 ea7b100e5de6
--- a/inst-resources/selfdestruct.php	Fri Dec 18 19:16:05 2009 -0600
+++ b/inst-resources/selfdestruct.php	Sat Aug 21 18:19:58 2010 -0400
@@ -5,19 +5,28 @@
 $mydir = dirname(__FILE__);
 require($mydir . '/../htdocs/includes/common.php');
 if ( !defined('ENANO_CLI') )
-  die("Don't even try.");
+	die("Don't even try.");
 
 require(ENANO_ROOT . '/config.php');
 
-// one is mysql, one is postgresql
-// too lazy to check right now
-// FIXME this fails right now because we don't have root
-$db->sql_query("DROP ROLE `$dbuser`;");
-$db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;");
+if ( !in_array('--skip-revoke', $argv) )
+{
+	$db->sql_query("DROP DATABASE `$dbname`;");
+	// one is mysql, one is postgresql
+	// too lazy to check right now
+	// FIXME this fails right now because we don't have root
+	$db->sql_query("DROP ROLE `$dbuser`;");
+	$db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;");
+}
+else
+{
+	foreach ( $system_table_list as $table )
+	{
+		$q = "DROP TABLE `" . table_prefix . "$table`;";
+		echo "$q\n";
+		$db->sql_query($q);
+	}
+}
 
-$q = $db->sql_query("DROP DATABASE `$dbname`;");
-if ( $q )
-  exit(0);
+exit(0);
 
-exit(1);
-