inst-resources/selfdestruct.php
author Neal Gompa <neal@enanocms.org>
Fri, 18 Dec 2009 19:16:05 -0600
changeset 8 af10a4dbafb4
parent 4 ea7b100e5de6
child 10 014d58335b6d
permissions -rw-r--r--
Commenting out plugin component blocks. We aren't using them for anything, and they are currently empty anyway...

<?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);