inst-resources/selfdestruct.php
changeset 4 ea7b100e5de6
child 10 014d58335b6d
equal deleted inserted replaced
3:0cce88c7cf7c 4:ea7b100e5de6
       
     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') )
       
     8   die("Don't even try.");
       
     9 
       
    10 require(ENANO_ROOT . '/config.php');
       
    11 
       
    12 // one is mysql, one is postgresql
       
    13 // too lazy to check right now
       
    14 // FIXME this fails right now because we don't have root
       
    15 $db->sql_query("DROP ROLE `$dbuser`;");
       
    16 $db->sql_query("REVOKE ALL PRIVILEGES ON `$dbname`.* FROM `$dbuser`@localhost;");
       
    17 
       
    18 $q = $db->sql_query("DROP DATABASE `$dbname`;");
       
    19 if ( $q )
       
    20   exit(0);
       
    21 
       
    22 exit(1);
       
    23