From f3250ac6160c33c5bd01523a53b55627b768e60e Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 17 Sep 2012 16:06:16 -0400 Subject: [PATCH] CC-4447: Install minimal -> reinstall uring -r reports ERROR on existing database -fixed --- install_minimal/include/AirtimeInstall.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/install_minimal/include/AirtimeInstall.php b/install_minimal/include/AirtimeInstall.php index cb054b429..02a2b43b2 100644 --- a/install_minimal/include/AirtimeInstall.php +++ b/install_minimal/include/AirtimeInstall.php @@ -215,6 +215,15 @@ class AirtimeInstall $database = $CC_CONFIG['dsn']['database']; $username = $CC_CONFIG['dsn']['username']; #$command = "echo \"CREATE DATABASE $database OWNER $username\" | su postgres -c psql 2>/dev/null"; + + $command = "su postgres -c \"psql -l | cut -f2 -d' ' | grep -w 'airtime'\";"; + exec($command, $output, $rv); + + if ($rv == 0) { + //database already exists + return true; + } + $command = "su postgres -c \"createdb $database --encoding UTF8 --owner $username\""; @exec($command, $output, $results);