Esempio n. 1
0
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir() . "/application/configs/db-conf.php");
Propel::init(AirtimeInstall::GetAirtimeSrcDir() . "/application/configs/airtime-conf-production.php");
function pause()
{
    /* Type "sudo -s" to change to root user then type "export AIRTIME_INSTALL_DEBUG=1" and then
     * start airtime-install to enable this feature. Is used to pause between upgrade scripts
     * to examine the state of the system and see if everything is as expected. */
    if (getenv("AIRTIME_INSTALL_DEBUG") === "1") {
        echo "Press Enter to Continue" . PHP_EOL;
        fgets(STDIN);
    }
}
AirtimeInstall::DbConnect(true);
$con = Propel::getConnection();
$version = AirtimeInstall::GetVersionInstalled();
echo "******************************** Upgrade Begin *********************************" . PHP_EOL;
global $CC_CONFIG;
$user = $CC_CONFIG['dsn']['username'];
$password = $CC_CONFIG['dsn']['password'];
$host = $CC_CONFIG['dsn']['hostspec'];
$database = $CC_CONFIG['dsn']['database'];
$airtime_version = AIRTIME_VERSION;
$target_dir = trim(getenv("HOME"));
if (strlen($target_dir) == 0) {
    $target_dir = "/tmp";
}
$target_file = "/airtime_{$airtime_version}.sql";
$target_path = $target_dir . $target_file;
echo "* Backing up current database to {$target_path}" . PHP_EOL;
exec("export PGPASSWORD={$password} && pg_dump -h {$host} -U {$user} -f {$target_path} {$database}", $arr, $return_code);