inst-resources/selfdestruct.php
author Dan
Sun, 16 Aug 2009 00:13:41 -0400
changeset 5 85800cb04cc5
parent 4 ea7b100e5de6
child 10 014d58335b6d
permissions -rw-r--r--
Moved around some ExperienceUI directives; fixed missing $XPUI_ABORTED check in StackSelectLeave
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     1
<?php
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     2
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     3
// basically: self-destruct the database side of Enano.
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     4
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     5
$mydir = dirname(__FILE__);
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     6
require($mydir . '/../htdocs/includes/common.php');
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     7
if ( !defined('ENANO_CLI') )
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     8
  die("Don't even try.");
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
     9
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    10
require(ENANO_ROOT . '/config.php');
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    11
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    12
// one is mysql, one is postgresql
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    13
// too lazy to check right now
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    14
// FIXME this fails right now because we don't have root
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    15
$db->sql_query("DROP ROLE `$dbuser`;");
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    16
$db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;");
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    17
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    18
$q = $db->sql_query("DROP DATABASE `$dbname`;");
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    19
if ( $q )
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    20
  exit(0);
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    21
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    22
exit(1);
ea7b100e5de6 Got some basic uninstaller code in
Dan
parents:
diff changeset
    23