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();
|
||||
|
||||
// sanity check!
|
||||
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(!defined('PSM_INSTALL') || !PSM_INSTALL) {
|
||||
if($db->getDbHost() === null) {
|
||||
// no config file has been loaded, redirect the user to the install
|
||||
header('Location: install.php');
|
||||
|
|
|
@ -136,9 +136,11 @@ function psm_get_conf($key, $alt = null) {
|
|||
function psm_load_conf() {
|
||||
global $db;
|
||||
|
||||
// load config from database into global scope
|
||||
$GLOBALS['sm_config'] = array();
|
||||
|
||||
if(!defined('PSM_DB_PREFIX') || !$db->status()) {
|
||||
return false;
|
||||
}
|
||||
if(!$db->ifTableExists(PSM_DB_PREFIX.'config')) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue