Fixed bug on uninstall where it would complain about removing files that
didnt exist, and also would stop the uninstallation if it couldnt connect to the database.
This commit is contained in:
parent
37f6812194
commit
7684fedb50
2 changed files with 7 additions and 7 deletions
|
@ -39,7 +39,7 @@ $command = "sudo -u postgres dropdb {$CC_CONFIG['dsn']['database']} 2> /dev/null
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
if ($dbDeleteFailed) {
|
if ($dbDeleteFailed) {
|
||||||
echo " * Couldn't delete the database, so deleting all the DB tables...".PHP_EOL;
|
echo " * Couldn't delete the database, so deleting all the DB tables...".PHP_EOL;
|
||||||
AirtimeInstall::DbConnect(true);
|
AirtimeInstall::DbConnect(false);
|
||||||
|
|
||||||
if (!PEAR::isError($CC_DBC)) {
|
if (!PEAR::isError($CC_DBC)) {
|
||||||
$sql = "select * from pg_tables where tableowner = 'airtime'";
|
$sql = "select * from pg_tables where tableowner = 'airtime'";
|
||||||
|
|
|
@ -112,7 +112,7 @@ class AirtimeInstall {
|
||||||
public static function SetupStorageDirectory($CC_CONFIG)
|
public static function SetupStorageDirectory($CC_CONFIG)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
echo PHP_EOL."*** Directory Setup ***".PHP_EOL;
|
echo PHP_EOL."*** Directory Setup ***".PHP_EOL;
|
||||||
foreach (array('baseFilesDir', 'storageDir') as $d) {
|
foreach (array('baseFilesDir', 'storageDir') as $d) {
|
||||||
if ( !file_exists($CC_CONFIG[$d]) ) {
|
if ( !file_exists($CC_CONFIG[$d]) ) {
|
||||||
|
@ -141,7 +141,7 @@ class AirtimeInstall {
|
||||||
// Create the database user
|
// Create the database user
|
||||||
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
|
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
|
||||||
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
|
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
|
||||||
|
|
||||||
@exec($command, $output, $results);
|
@exec($command, $output, $results);
|
||||||
if ($results == 0) {
|
if ($results == 0) {
|
||||||
echo "* User {$CC_CONFIG['dsn']['username']} created.".PHP_EOL;
|
echo "* User {$CC_CONFIG['dsn']['username']} created.".PHP_EOL;
|
||||||
|
@ -153,7 +153,7 @@ class AirtimeInstall {
|
||||||
public static function CreateDatabase()
|
public static function CreateDatabase()
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
|
|
||||||
$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null";
|
$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null";
|
||||||
@exec($command, $output, $results);
|
@exec($command, $output, $results);
|
||||||
if ($results == 0) {
|
if ($results == 0) {
|
||||||
|
@ -205,7 +205,7 @@ class AirtimeInstall {
|
||||||
|
|
||||||
public static function CreateSymlinks(){
|
public static function CreateSymlinks(){
|
||||||
AirtimeInstall::RemoveSymlinks();
|
AirtimeInstall::RemoveSymlinks();
|
||||||
|
|
||||||
$dir = realpath(__DIR__."/../utils/airtime-import");
|
$dir = realpath(__DIR__."/../utils/airtime-import");
|
||||||
exec("ln -s $dir /usr/bin/airtime-import");
|
exec("ln -s $dir /usr/bin/airtime-import");
|
||||||
|
|
||||||
|
@ -214,8 +214,8 @@ class AirtimeInstall {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function RemoveSymlinks(){
|
public static function RemoveSymlinks(){
|
||||||
exec("rm /usr/bin/airtime-import");
|
exec("rm -f /usr/bin/airtime-import");
|
||||||
exec("rm /usr/bin/airtime-clean-storage");
|
exec("rm -f /usr/bin/airtime-clean-storage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue