CC-1927: Remove PEAR DB
Fixed all install/upgrade scripts.
This commit is contained in:
parent
7f78a7f663
commit
95d69a3bbe
17 changed files with 351 additions and 2140 deletions
|
@ -11,12 +11,20 @@ require_once(__DIR__.'/airtime-constants.php');
|
|||
require_once(dirname(__FILE__).'/AirtimeIni.php');
|
||||
require_once(dirname(__FILE__).'/AirtimeInstall.php');
|
||||
|
||||
if(posix_geteuid() != 0){
|
||||
if(posix_geteuid() != 0) {
|
||||
echo "Must be root user.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function pause(){
|
||||
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/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. */
|
||||
|
@ -26,33 +34,8 @@ function pause(){
|
|||
}
|
||||
}
|
||||
|
||||
const CONF_FILE_AIRTIME = "/etc/airtime/airtime.conf";
|
||||
|
||||
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
|
||||
$values = parse_ini_file('/etc/airtime/airtime.conf', 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'];
|
||||
|
||||
$CC_DBC = DB::connect($CC_CONFIG['dsn'], FALSE);
|
||||
|
||||
if (PEAR::isError($CC_DBC)) {
|
||||
echo $CC_DBC->getMessage().PHP_EOL;
|
||||
echo $CC_DBC->getUserInfo().PHP_EOL;
|
||||
echo "Database connection problem.".PHP_EOL;
|
||||
echo "Check if database '{$CC_CONFIG['dsn']['database']}' exists".
|
||||
" with corresponding permissions.".PHP_EOL;
|
||||
exit(1);
|
||||
} else {
|
||||
echo "* Connected to database".PHP_EOL;
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
}
|
||||
AirtimeInstall::DbConnect(true);
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$version = AirtimeInstall::GetVersionInstalled();
|
||||
|
||||
|
@ -121,13 +104,13 @@ if (strcmp($version, "2.1.0") < 0){
|
|||
|
||||
//set the new version in the database.
|
||||
$sql = "DELETE FROM cc_pref WHERE keystr = 'system_version'";
|
||||
$CC_DBC->query($sql);
|
||||
$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')";
|
||||
$CC_DBC->query($sql);
|
||||
$con->exec($sql);
|
||||
|
||||
echo "******************************* Upgrade Complete *******************************".PHP_EOL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue