CC-1927: Remove Pear DB

Final touches on install/upgrade scripts, now they are working.
Still need to remove last traces of PEAR throughout the code.
This commit is contained in:
paul.baranowski 2012-04-02 00:31:26 -04:00 committed by Martin Konecny
parent 95d69a3bbe
commit c0da27b445
4 changed files with 13 additions and 53 deletions

View file

@ -2,59 +2,17 @@
require_once __DIR__."/logging/Logging.php"; require_once __DIR__."/logging/Logging.php";
Logging::setLogPath('/var/log/airtime/zendphp.log'); Logging::setLogPath('/var/log/airtime/zendphp.log');
require_once __DIR__."/configs/conf.php"; require_once __DIR__."/configs/conf.php";
require_once __DIR__."/configs/ACL.php"; require_once __DIR__."/configs/ACL.php";
require_once 'propel/runtime/lib/Propel.php'; require_once 'propel/runtime/lib/Propel.php';
Propel::init(__DIR__."/configs/airtime-conf-production.php"); Propel::init(__DIR__."/configs/airtime-conf-production.php");
require_once __DIR__."/configs/constants.php"; require_once __DIR__."/configs/constants.php";
// require_once 'DB.php';
require_once 'Preference.php'; require_once 'Preference.php';
require_once "DateHelper.php"; require_once "DateHelper.php";
require_once "OsPath.php"; require_once "OsPath.php";
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
global $CC_CONFIG; //, $CC_DBC; global $CC_CONFIG;
$dsn = $CC_CONFIG['dsn'];
// ******************************************************************
// Differences between PEAR DB & Propel/PDO:
// When selecting a single value from a null return set,
// PEAR returns NULL
// PDO returns false
// ******************************************************************
// $CC_DBC = DB::connect($dsn, FALSE);
// if (PEAR::isError($CC_DBC)) {
// echo "ERROR: ".$CC_DBC->getMessage()." ".$CC_DBC->getUserInfo()."\n";
// exit(1);
// }
// $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
// $sql = "SELECT column_name, character_maximum_length FROM information_schema.columns"
// ." WHERE table_name = 'cc_show' AND character_maximum_length > 0 and table_name=''";
// // $sql = "SELECT * FROM cc_files WHERE id=1";
// // $result = $CC_DBC->GetAll($sql);
// $result = $CC_DBC->GetOne($sql);
// var_dump($result);
// $sql = "SELECT 1";
// try {
// $con = Propel::getConnection();
// //$q = $con->query($sql);
// } catch (Exception $e) {
// var_dump($e);
// }
// var_dump($q);
// //var_dump($q->fetchAll());
// var_dump($q->fetchColumn(0));
// exit;
$CC_CONFIG['airtime_version'] = Application_Model_Preference::GetAirtimeVersion(); $CC_CONFIG['airtime_version'] = Application_Model_Preference::GetAirtimeVersion();
require_once __DIR__."/configs/navigation.php"; require_once __DIR__."/configs/navigation.php";

View file

@ -5,8 +5,6 @@
* cannot be created. So this script is run after all DEB packages have been installed. * cannot be created. So this script is run after all DEB packages have been installed.
*/ */
//set_include_path(__DIR__.'/../airtime_mvc/library' . PATH_SEPARATOR . get_include_path());
require_once(__DIR__.'/AirtimeIni.php'); require_once(__DIR__.'/AirtimeIni.php');
require_once(__DIR__.'/AirtimeInstall.php'); require_once(__DIR__.'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php'); require_once(__DIR__.'/airtime-constants.php');
@ -21,7 +19,7 @@ AirtimeInstall::CreateDatabaseUser();
$databaseExisted = AirtimeInstall::CreateDatabase(); $databaseExisted = AirtimeInstall::CreateDatabase();
//AirtimeInstall::DbConnect(true); AirtimeInstall::DbConnect(true);
AirtimeInstall::InstallPostgresScriptingLanguage(); AirtimeInstall::InstallPostgresScriptingLanguage();

View file

@ -10,6 +10,9 @@
require_once(__DIR__.'/AirtimeIni.php'); require_once(__DIR__.'/AirtimeIni.php');
require_once(__DIR__.'/AirtimeInstall.php'); require_once(__DIR__.'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php'); require_once(__DIR__.'/airtime-constants.php');
require_once(AirtimeInstall::GetAirtimeSrcDir().'/application/configs/conf.php');
require_once 'propel/runtime/lib/Propel.php';
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
$version = AirtimeInstall::GetVersionInstalled(); $version = AirtimeInstall::GetVersionInstalled();

View file

@ -1,30 +1,31 @@
<?php <?php
/** /**
* @package Airtime
* @copyright 2011 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*
* Checks if a current version of Airtime is installed. * Checks if a current version of Airtime is installed.
* If so, the user is presented with the help menu and can * If so, the user is presented with the help menu and can
* choose -r to reinstall. * choose -r to reinstall.
* *
* Returns 0 if Airtime is not installed * Returns 0 if Airtime is not installed
* Returns 1 if the same version of Airtime already installed * Returns 1 if the same version of Airtime already installed
* Returns 2 if a previous version of Airtime is installed we can upgrade from * Returns 2 if a previous version of Airtime is installed we can upgrade from
* Returns 3 if a version of Airtime is installed that we can't upgrade from. * Returns 3 if a version of Airtime is installed that we can't upgrade from.
*/ */
require_once(dirname(__FILE__).'/AirtimeInstall.php'); require_once(__DIR__.'/AirtimeInstall.php');
require_once(__DIR__.'/airtime-constants.php'); require_once(__DIR__.'/airtime-constants.php');
AirtimeInstall::ExitIfNotRoot(); AirtimeInstall::ExitIfNotRoot();
require_once(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/conf.php");
require_once('propel/runtime/lib/Propel.php');
Propel::init(AirtimeInstall::GetAirtimeSrcDir()."/application/configs/airtime-conf-production.php");
$version = AirtimeInstall::GetVersionInstalled(); $version = AirtimeInstall::GetVersionInstalled();
// The current version is already installed. // The current version is already installed.
echo "* Checking for existing Airtime installation...".PHP_EOL; echo "* Checking for existing Airtime installation...".PHP_EOL;
if (isset($version)){ if (isset($version)){
if ($version === false){ if ($version === false){
//version of Airtime older than 1.7.0 detected //version of Airtime older than 1.7.0 detected
exit(3); exit(3);
} else { } else {
if (($version == AIRTIME_VERSION)) { if (($version == AIRTIME_VERSION)) {
//same version of Airtime is already installed //same version of Airtime is already installed