CC-3015: Upgrade- upgrade fails
This commit is contained in:
parent
6291c67ace
commit
b99d0f97ce
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
set_include_path(__DIR__.'/../../airtime_mvc/library/pear' . PATH_SEPARATOR . get_include_path());
|
||||
require_once('DB.php');
|
||||
|
||||
/* These are helper functions that are common to each upgrade such as
|
||||
* creating connections to a database, backing up config files etc.
|
||||
*/
|
||||
|
@ -14,6 +17,25 @@ class UpgradeCommon{
|
|||
const CONF_PYPO_GRP = "pypo";
|
||||
const CONF_WWW_DATA_GRP = "www-data";
|
||||
|
||||
public static function connectToDatabase($p_exitOnError = true)
|
||||
{
|
||||
global $CC_DBC, $CC_CONFIG;
|
||||
$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;
|
||||
if ($p_exitOnError) {
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
$CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function DbTableExists($p_name)
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
|
|
@ -79,7 +79,7 @@ class AirtimeMiscUpgrade{
|
|||
}
|
||||
}
|
||||
|
||||
UpgradeCommonFunctions::connectToDatabase();
|
||||
UpgradeCommon::connectToDatabase();
|
||||
|
||||
AirtimeDatabaseUpgrade::start();
|
||||
AirtimeStorWatchedDirsUpgrade::start();
|
||||
|
|
Loading…
Reference in New Issue