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')) { if(! function_exists('check_config')) {
function check_config(&$a) { function check_config(&$a) {
load_config('system');
$build = get_config('system','build'); $build = get_config('system','build');
if(! x($build)) if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION); $build = set_config('system','build',DB_UPDATE_VERSION);
@ -1218,9 +1215,13 @@ function load_config($family) {
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$k = $rr['k']; $k = $rr['k'];
if ($rr['cat'] === 'config') {
$a->config[$k] = $rr['v'];
} else {
$a->config[$family][$k] = $rr['v']; $a->config[$family][$k] = $rr['v'];
} }
} }
}
}} }}
// get a particular config variable given the family name // get a particular config variable given the family name

View file

@ -15,6 +15,10 @@ function directory_run($argv, $argc){
unset($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) if($argc != 2)
return; return;

View file

@ -22,6 +22,10 @@ function expire_run($argv, $argc){
require_once('include/items.php'); require_once('include/items.php');
require_once('include/Contact.php'); require_once('include/Contact.php');
load_config('config');
load_config('system');
$a->set_baseurl(get_config('system','url')); $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/items.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
load_config('config');
load_config('system');
load_hooks(); load_hooks();
if($argc < 3) if($argc < 3)

View file

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

View file

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

View file

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