adding db check to psm_load_conf in case we're on install page
parent
0922823814
commit
750513d681
|
@ -90,14 +90,7 @@ foreach($includes as $file) {
|
||||||
$db = new psm\Service\Database();
|
$db = new psm\Service\Database();
|
||||||
|
|
||||||
// sanity check!
|
// sanity check!
|
||||||
if(defined('PSM_INSTALL') && PSM_INSTALL) {
|
if(!defined('PSM_INSTALL') || !PSM_INSTALL) {
|
||||||
// install mode
|
|
||||||
if($db->status()) {
|
|
||||||
// connection established, attempt to load config.
|
|
||||||
// no biggie if it doesnt work because the user is still in the install module.
|
|
||||||
psm_load_conf();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if($db->getDbHost() === null) {
|
if($db->getDbHost() === null) {
|
||||||
// no config file has been loaded, redirect the user to the install
|
// no config file has been loaded, redirect the user to the install
|
||||||
header('Location: install.php');
|
header('Location: install.php');
|
||||||
|
|
|
@ -136,9 +136,11 @@ function psm_get_conf($key, $alt = null) {
|
||||||
function psm_load_conf() {
|
function psm_load_conf() {
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
// load config from database into global scope
|
|
||||||
$GLOBALS['sm_config'] = array();
|
$GLOBALS['sm_config'] = array();
|
||||||
|
|
||||||
|
if(!defined('PSM_DB_PREFIX') || !$db->status()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if(!$db->ifTableExists(PSM_DB_PREFIX.'config')) {
|
if(!$db->ifTableExists(PSM_DB_PREFIX.'config')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue