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:
commit
32acd59fcb
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
require_once(dirname(__FILE__).'/include/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/include/AirtimeInstall.php');
|
||||
|
||||
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
|
||||
|
||||
//echo PHP_EOL."*** Database Installation ***".PHP_EOL;
|
||||
|
||||
AirtimeInstall::CreateDatabaseUser();
|
||||
|
||||
AirtimeInstall::CreateDatabase();
|
||||
|
||||
AirtimeInstall::DbConnect(true);
|
||||
|
||||
AirtimeInstall::InstallPostgresScriptingLanguage();
|
||||
|
||||
AirtimeInstall::CreateDatabaseTables();
|
||||
|
||||
AirtimeInstall::SetAirtimeVersion(AIRTIME_VERSION);
|
||||
|
|
@ -22,7 +22,8 @@ try {
|
|||
array(
|
||||
'help|h' => 'Displays usage information.',
|
||||
'overwrite|o' => 'Overwrite any existing config files.',
|
||||
'preserve|p' => 'Keep any existing config files.'
|
||||
'preserve|p' => 'Keep any existing config files.',
|
||||
'no-db|n' => 'Turn off database install.'
|
||||
)
|
||||
);
|
||||
$opts->parse();
|
||||
|
@ -34,6 +35,10 @@ if (isset($opts->h)) {
|
|||
echo $opts->getUsageMessage();
|
||||
exit;
|
||||
}
|
||||
$db_install = true;
|
||||
if (isset($opts->n)){
|
||||
$db_install = false;
|
||||
}
|
||||
|
||||
$overwrite = false;
|
||||
if (isset($opts->o)) {
|
||||
|
@ -72,17 +77,21 @@ require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php')
|
|||
|
||||
echo "* Airtime Version: ".AIRTIME_VERSION.PHP_EOL;
|
||||
|
||||
if ($db_install) {
|
||||
|
||||
//echo PHP_EOL."*** Database Installation ***".PHP_EOL;
|
||||
|
||||
AirtimeInstall::CreateDatabaseUser();
|
||||
/* AirtimeInstall::CreateDatabaseUser();
|
||||
|
||||
AirtimeInstall::CreateDatabase();
|
||||
AirtimeInstall::CreateDatabase();
|
||||
|
||||
AirtimeInstall::DbConnect(true);
|
||||
AirtimeInstall::DbConnect(true);
|
||||
|
||||
AirtimeInstall::InstallPostgresScriptingLanguage();
|
||||
AirtimeInstall::InstallPostgresScriptingLanguage();
|
||||
|
||||
AirtimeInstall::CreateDatabaseTables();
|
||||
AirtimeInstall::CreateDatabaseTables();*/
|
||||
require( 'airtime-db-install.php' );
|
||||
}
|
||||
|
||||
AirtimeInstall::InstallStorageDirectory();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue