Exemplo n.º 1
0
        }
    }
}
if ($overwrite) {
    echo "* Creating INI files" . PHP_EOL;
    AirtimeIni::CreateIniFiles();
}
AirtimeIni::CreateMonitFile();
AirtimeInstall::InstallPhpCode();
AirtimeInstall::InstallBinaries();
if ($overwrite) {
    echo "* Initializing INI files" . PHP_EOL;
    AirtimeIni::UpdateIniFiles();
}
// Update the build.properties file to point to the correct directory.
AirtimeIni::UpdateIniValue(AirtimeInstall::CONF_DIR_WWW . '/build/build.properties', 'project.home', AirtimeInstall::CONF_DIR_WWW);
require_once AirtimeInstall::GetAirtimeSrcDir() . '/application/configs/conf.php';
echo "* Airtime Version: " . AIRTIME_VERSION . PHP_EOL;
AirtimeInstall::InstallStorageDirectory();
if ($db_install) {
    if ($newInstall) {
        // This is called with "system" so that we can pass in a parameter.  See the file itself
        // for why we need to do this.
        system('php ' . __DIR__ . '/airtime-db-install.php y');
        AirtimeInstall::DbConnect(true);
    } else {
        require_once 'airtime-db-install.php';
    }
}
AirtimeInstall::CreateSymlinksToUtils();
AirtimeInstall::CreateZendPhpLogFile();
Exemplo n.º 2
0
 public static function MergeConfigFiles($configFiles, $suffix)
 {
     foreach ($configFiles as $conf) {
         if (file_exists("{$conf}{$suffix}.bak")) {
             if ($conf === CONF_FILE_AIRTIME) {
                 // Parse with sections
                 $newSettings = parse_ini_file($conf, true);
                 $oldSettings = parse_ini_file("{$conf}{$suffix}.bak", true);
             } else {
                 $newSettings = AirtimeIni::ReadPythonConfig($conf);
                 $oldSettings = AirtimeIni::ReadPythonConfig("{$conf}{$suffix}.bak");
             }
             $settings = array_keys($newSettings);
             foreach ($settings as $section) {
                 if (isset($oldSettings[$section])) {
                     if (is_array($oldSettings[$section])) {
                         $sectionKeys = array_keys($newSettings[$section]);
                         foreach ($sectionKeys as $sectionKey) {
                             if (isset($oldSettings[$section][$sectionKey])) {
                                 AirtimeIni::UpdateIniValue($conf, $sectionKey, $oldSettings[$section][$sectionKey]);
                             }
                         }
                     } else {
                         AirtimeIni::UpdateIniValue($conf, $section, $oldSettings[$section]);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
                echo PHP_EOL . "You have existing config files. Do you want to (O)verwrite them, or (P)reserve them? (o/P) ";
                $userAnswer = trim(fgets(STDIN));
            }
            if (in_array($userAnswer, array("o", "O"))) {
                $overwrite = true;
            }
        } else {
            $overwrite = true;
        }
    }
}
if ($overwrite) {
    echo "* Creating INI files" . PHP_EOL;
    AirtimeIni::CreateIniFiles();
    echo "* Initializing INI files" . PHP_EOL;
    AirtimeIni::UpdateIniFiles();
}
if (!$iniExists) {
    require_once AirtimeInstall::GetAirtimeSrcDir() . '/application/configs/conf.php';
    $CC_CONFIG = Config::getConfig();
    require_once 'propel/runtime/lib/Propel.php';
    Propel::init(AirtimeInstall::GetAirtimeSrcDir() . "/application/configs/airtime-conf-production.php");
}
echo "* Airtime Version: " . AIRTIME_VERSION . PHP_EOL;
AirtimeInstall::InstallStorageDirectory();
$db_install = getenv("nodb") != "t";
if ($db_install) {
    echo "* Checking database for correct encoding" . PHP_EOL;
    exec('su -c \'psql -t -c "SHOW SERVER_ENCODING"\' postgres | grep -i "UTF.*8"', $out, $return_code);
    if ($return_code != 0) {
        echo " * Unfortunately your postgresql database has not been created using a UTF-8 encoding." . PHP_EOL;
Exemplo n.º 4
0
            $rows = array();
        }
        foreach ($rows as $row) {
            $tablename = $row["tablename"];
            echo "   * Removing database table {$tablename}...";
            if (AirtimeInstall::DbTableExists($tablename)) {
                $sql = "DROP TABLE {$tablename} CASCADE";
                AirtimeInstall::InstallQuery($sql, false);
                $CC_DBC->dropSequence($tablename . "_id");
            }
            echo "done." . PHP_EOL;
        }
    }
}
//------------------------------------------------------------------------
// Delete the user
//------------------------------------------------------------------------
echo " * Deleting database user '{$CC_CONFIG['dsn']['username']}'..." . PHP_EOL;
$command = "echo \"DROP USER IF EXISTS {$CC_CONFIG['dsn']['username']}\" | su postgres -c psql >/dev/null 2>&1";
@exec($command, $output, $results);
if ($results == 0) {
    echo "   * User '{$CC_CONFIG['dsn']['username']}' deleted." . PHP_EOL;
} else {
    echo "   * Nothing to delete." . PHP_EOL;
}
AirtimeInstall::RemoveSymlinks();
AirtimeInstall::UninstallBinaries();
AirtimeInstall::RemoveLogDirectories();
AirtimeIni::RemoveMonitFile();
@unlink('/etc/cron.d/airtime-crons');
/* FINISHED AIRTIME PHP UNINSTALLER */