From bd588f7f3ed3772b635895b64eaf1e6409cd8d82 Mon Sep 17 00:00:00 2001
From: James Moon <james.moon@sourcefabric.org>
Date: Thu, 12 May 2011 12:05:48 -0700
Subject: [PATCH] CC-2209:Put database install stuff into separate script

done.
---
 install/airtime-uninstall.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php
index bd95a175a..3d6e2f3cb 100644
--- a/install/airtime-uninstall.php
+++ b/install/airtime-uninstall.php
@@ -29,7 +29,9 @@ 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 = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']} 2> /dev/null";
+
+// check if DB exists
+$command = "echo \"DROP DATABASE IF EXISTS ".$CC_CONFIG['dsn']['database']."\" | sudo -u postgres psql";
 @exec($command, $output, $dbDeleteFailed);
 
 //------------------------------------------------------------------------