CC-3694: Upgrade fails with Propel database conversion.

-fixed
This commit is contained in:
Martin Konecny 2012-04-20 15:06:20 -04:00
parent 85bc150159
commit 2a9ea435f2
4 changed files with 20 additions and 6 deletions

View File

@ -8,8 +8,6 @@
* that the user can customize these.
*/
require_once (__DIR__."/conf.php");
global $CC_CONFIG;
$dbhost = $CC_CONFIG['dsn']['hostspec'];

View File

@ -0,0 +1,18 @@
<?php
/* This file is only needed during upgrades when we need the database parameters from /etc/airtime/airtime.conf.
* The reason we don't just use conf.php is because conf.php may try to load configuration parameters that aren't
* yet available because airtime.conf hasn't been updated yet. This situation ends up throwing a lot of errors to stdout.
* airtime*/
global $CC_CONFIG;
$filename = "/etc/airtime/airtime.conf";
$values = parse_ini_file($filename, true);
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];
$CC_CONFIG['dsn']['hostspec'] = $values['database']['host'];
$CC_CONFIG['dsn']['phptype'] = 'pgsql';
$CC_CONFIG['dsn']['database'] = $values['database']['dbname'];

View File

@ -14,7 +14,7 @@ require_once(__DIR__.'/airtime-constants.php');
AirtimeInstall::ExitIfNotRoot();
require_once(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/conf.php");
require_once(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/db-conf.php");
require_once('propel/runtime/lib/Propel.php');
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");

View File

@ -20,6 +20,7 @@ require_once(__DIR__.'/airtime-constants.php');
require_once(__DIR__.'/AirtimeIni.php');
require_once(__DIR__.'/AirtimeInstall.php');
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");
@ -106,9 +107,6 @@ if (strcmp($version, "2.1.0") < 0){
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
$con->exec($sql);
$values = parse_ini_file(CONF_FILE_AIRTIME, true);
$phpDir = $values['general']['airtime_dir'];
$newVersion = AIRTIME_VERSION;
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('system_version', '$newVersion')";
$con->exec($sql);