adding db check to psm_load_conf in case we're on install page

This commit is contained in:
Pepijn Over 2014-08-05 12:57:47 +02:00
parent 0922823814
commit 750513d681
2 changed files with 4 additions and 9 deletions

View File

@ -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');

View File

@ -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;
}