Browse Source

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

pull/1/head
Friendika 10 years ago
parent
commit
994011ddb6
7 changed files with 34 additions and 23 deletions
  1. +5
    -4
      boot.php
  2. +14
    -10
      include/directory.php
  3. +4
    -0
      include/expire.php
  4. +3
    -0
      include/notifier.php
  5. +3
    -0
      include/poller.php
  6. +3
    -0
      include/queue.php
  7. +2
    -9
      index.php

+ 5
- 4
boot.php 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'];
}
}
}
}}


+ 14
- 10
include/directory.php 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;


+ 4
- 0
include/expire.php 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'));


+ 3
- 0
include/notifier.php 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)


+ 3
- 0
include/poller.php 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();


+ 3
- 0
include/queue.php 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();


+ 2
- 9
index.php 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();


Loading…
Cancel
Save