inst-resources/selfdestruct.php
author Neal Gompa <neal@enanocms.org>
Fri, 18 Dec 2009 20:36:15 -0600
changeset 9 100ba25b6dba
parent 4 ea7b100e5de6
child 10 014d58335b6d
permissions -rw-r--r--
Adding uninstall commands for shortcuts, we don't want unnecessary stuff floating around after the uninstallation...
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