From e746c4955bd9b8230d1c5427cfaeb18c6e370a3a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 11 Aug 2013 21:19:26 +0200 Subject: [PATCH] Added an option to configure the hostname manually. And there was a problem when APC wasn't present. --- include/cli_startup.php | 5 ++++- include/config.php | 5 +++-- include/cronhooks.php | 3 +++ include/delivery.php | 3 +++ include/expire.php | 2 ++ include/gprobe.php | 3 +++ include/notifier.php | 3 +++ include/onepoll.php | 3 +++ include/poller.php | 3 +++ include/queue.php | 3 +++ index.php | 3 +++ 11 files changed, 33 insertions(+), 3 deletions(-) diff --git a/include/cli_startup.php b/include/cli_startup.php index e069ec2c98..236fd14427 100644 --- a/include/cli_startup.php +++ b/include/cli_startup.php @@ -24,8 +24,11 @@ function cli_startup() { load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); -} \ No newline at end of file +} diff --git a/include/config.php b/include/config.php index 4f44de24fc..ce30d2d192 100644 --- a/include/config.php +++ b/include/config.php @@ -77,7 +77,8 @@ function get_config($family, $key, $instore = false) { return false; else return $val; - } else + } + // else //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); @@ -207,7 +208,7 @@ function get_pconfig($uid,$family, $key, $instore = false) { return false; else return $val; - } else + } // else //logger("APC: cache miss for value ".$family."|".$key, LOGGER_DEBUG); diff --git a/include/cronhooks.php b/include/cronhooks.php index 15d49fe547..096e10b718 100644 --- a/include/cronhooks.php +++ b/include/cronhooks.php @@ -24,6 +24,9 @@ function cronhooks_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $lockpath = get_config('system','lockpath'); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'cron.lck'); diff --git a/include/delivery.php b/include/delivery.php index d89cded9eb..515f286e0f 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -27,6 +27,9 @@ function delivery_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + load_hooks(); if($argc < 3) diff --git a/include/expire.php b/include/expire.php index 4c6fb7a19d..fe1007efd5 100644 --- a/include/expire.php +++ b/include/expire.php @@ -25,6 +25,8 @@ function expire_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); $a->set_baseurl(get_config('system','url')); diff --git a/include/gprobe.php b/include/gprobe.php index 0cf32e95fe..00a8e562af 100644 --- a/include/gprobe.php +++ b/include/gprobe.php @@ -24,6 +24,9 @@ function gprobe_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/notifier.php b/include/notifier.php index a3286355dd..a90e180623 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -65,6 +65,9 @@ function notifier_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + load_hooks(); if($argc < 3) diff --git a/include/onepoll.php b/include/onepoll.php index f38f6b4c61..737f70a286 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -37,6 +37,9 @@ function onepoll_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/include/poller.php b/include/poller.php index e927430ea9..0bbead1891 100644 --- a/include/poller.php +++ b/include/poller.php @@ -30,6 +30,9 @@ function poller_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $maxsysload = intval(get_config('system','maxloadavg')); if($maxsysload < 1) $maxsysload = 50; diff --git a/include/queue.php b/include/queue.php index 64cccad21e..f277b3fbd4 100644 --- a/include/queue.php +++ b/include/queue.php @@ -25,6 +25,9 @@ function queue_run(&$argv, &$argc){ load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + $a->set_baseurl(get_config('system','url')); load_hooks(); diff --git a/index.php b/index.php index 6b6e873ea6..67c0c495cf 100644 --- a/index.php +++ b/index.php @@ -53,6 +53,9 @@ if(!$install) { load_config('config'); load_config('system'); + if ($hostname = get_config('system', 'hostname')) + $a->set_hostname($hostname); + require_once("include/session.php"); load_hooks(); call_hooks('init_1');