load db configs (config,system) for all "executables"

This commit is contained in:
Friendika 2011-06-30 01:15:18 -07:00
parent 3eb0b4be2a
commit 994011ddb6
7 changed files with 34 additions and 23 deletions

View File

@ -498,9 +498,6 @@ function install_plugin($plugin){
if(! function_exists('check_config')) {
function check_config(&$a) {
load_config('system');
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
@ -1218,7 +1215,11 @@ function load_config($family) {
if(count($r)) {
foreach($r as $rr) {
$k = $rr['k'];
$a->config[$family][$k] = $rr['v'];
if ($rr['cat'] === 'config') {
$a->config[$k] = $rr['v'];
} else {
$a->config[$family][$k] = $rr['v'];
}
}
}
}}

View File

@ -2,18 +2,22 @@
require_once("boot.php");
function directory_run($argv, $argc){
global $a, $db;
global $a, $db;
if(is_null($a)){
$a = new App;
}
if(is_null($a)) {
$a = new App;
}
if(is_null($db)){
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
if(is_null($db)) {
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
load_config('config');
load_config('system');
if($argc != 2)
return;

View File

@ -22,6 +22,10 @@ function expire_run($argv, $argc){
require_once('include/items.php');
require_once('include/Contact.php');
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system','url'));

View File

@ -20,6 +20,9 @@ function notifier_run($argv, $argc){
require_once('include/items.php');
require_once('include/bbcode.php');
load_config('config');
load_config('system');
load_hooks();
if($argc < 3)

View File

@ -24,6 +24,9 @@ function poller_run($argv, $argc){
require_once('include/Contact.php');
require_once('include/email.php');
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system','url'));
load_hooks();

View File

@ -22,6 +22,9 @@ function queue_run($argv, $argc){
require_once('include/items.php');
require_once('include/bbcode.php');
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system','url'));
load_hooks();

View File

@ -50,15 +50,8 @@ if(! $install) {
* Load configs from db. Overwrite configs from .htconfig.php
*/
$r = q("SELECT * FROM `config` WHERE `cat` IN ('system', 'config')");
foreach ($r as $c) {
if ($c['cat']=='config') {
$a->config[$c['k']] = $c['v'];
} else {
$a->config[$c['cat']][$c['k']] = $c['v'];
}
}
unset($r);
load_config('config');
load_config('system');
require_once("session.php");
load_hooks();