Got some basic uninstaller code in
authorDan
Sat, 11 Jul 2009 10:08:22 -0400
changeset 4 ea7b100e5de6
parent 3 0cce88c7cf7c
child 5 85800cb04cc5
Got some basic uninstaller code in
inst-resources/selfdestruct.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inst-resources/selfdestruct.php	Sat Jul 11 10:08:22 2009 -0400
@@ -0,0 +1,23 @@
+<?php
+
+// basically: self-destruct the database side of Enano.
+
+$mydir = dirname(__FILE__);
+require($mydir . '/../htdocs/includes/common.php');
+if ( !defined('ENANO_CLI') )
+  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;");
+
+$q = $db->sql_query("DROP DATABASE `$dbname`;");
+if ( $q )
+  exit(0);
+
+exit(1);
+