Merge branch 'cc-2209-put-database-install-stuff-into-separate-script' into devel

Conflicts:
	install/airtime-install.php
	install/airtime-uninstall.php
This commit is contained in:
Martin Konecny 2011-05-12 16:36:01 -04:00
commit 32acd59fcb
3 changed files with 43 additions and 8 deletions

View file

@ -29,7 +29,10 @@ AirtimeInstall::UninstallPhpCode();
// still be a connection to the database and you wont be able to delete it.
//------------------------------------------------------------------------
echo " * Dropping the database '".$CC_CONFIG['dsn']['database']."'...".PHP_EOL;
$command = "su postgres -c \"dropdb {$CC_CONFIG['dsn']['database']}\"";
// check if DB exists
$command = "echo \"DROP DATABASE IF EXISTS ".$CC_CONFIG['dsn']['database']."\" | sudo -u postgres psql";
@exec($command, $output, $dbDeleteFailed);
//------------------------------------------------------------------------
@ -66,7 +69,7 @@ if ($dbDeleteFailed) {
// Delete the user
//------------------------------------------------------------------------
echo " * Deleting database user '{$CC_CONFIG['dsn']['username']}'...".PHP_EOL;
$command = "echo \"DROP USER {$CC_CONFIG['dsn']['username']}\" | su postgres -c psql";
$command = "echo \"DROP USER IF EXISTS {$CC_CONFIG['dsn']['username']}\" | su postgres -c psql";
@exec($command, $output, $results);
if ($results == 0) {
echo " * User '{$CC_CONFIG['dsn']['username']}' deleted.".PHP_EOL;