aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r--Zotlabs/Daemon/Cache_query.php7
-rw-r--r--Zotlabs/Daemon/Checksites.php4
-rw-r--r--Zotlabs/Daemon/Cron.php21
-rw-r--r--Zotlabs/Daemon/Cron_daily.php7
-rw-r--r--Zotlabs/Daemon/Cron_weekly.php4
-rw-r--r--Zotlabs/Daemon/Directory.php3
-rw-r--r--Zotlabs/Daemon/Expire.php16
-rw-r--r--Zotlabs/Daemon/Master.php2
-rw-r--r--Zotlabs/Daemon/Notifier.php7
-rw-r--r--Zotlabs/Daemon/Onepoll.php5
-rw-r--r--Zotlabs/Daemon/Poller.php16
-rw-r--r--Zotlabs/Daemon/Thumbnail.php7
12 files changed, 57 insertions, 42 deletions
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php
index cd9597e9a..8e5c6b2ea 100644
--- a/Zotlabs/Daemon/Cache_query.php
+++ b/Zotlabs/Daemon/Cache_query.php
@@ -3,6 +3,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Cache;
+use Zotlabs\Lib\Config;
class Cache_query {
@@ -13,14 +14,14 @@ class Cache_query {
$key = $argv[1];
- $pid = get_config('procid', $key, false);
+ $pid = Config::Get('procid', $key, false);
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
logger($key . ': procedure already run with pid ' . $pid, LOGGER_DEBUG);
return;
}
$pid = getmypid();
- set_config('procid', $key, $pid);
+ Config::Set('procid', $key, $pid);
array_shift($argv);
array_shift($argv);
@@ -31,7 +32,7 @@ class Cache_query {
if($r)
Cache::set($key, serialize($r));
- del_config('procid', $key);
+ Config::Delete('procid', $key);
return;
}
diff --git a/Zotlabs/Daemon/Checksites.php b/Zotlabs/Daemon/Checksites.php
index eacf8c6bc..8f6319edb 100644
--- a/Zotlabs/Daemon/Checksites.php
+++ b/Zotlabs/Daemon/Checksites.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
require_once('include/hubloc.php');
class Checksites {
@@ -19,7 +21,7 @@ class Checksites {
if ($site_id)
$sql_options = " and site_url = '" . dbesc($argv[1]) . "' ";
- $days = intval(get_config('system', 'sitecheckdays'));
+ $days = intval(Config::Get('system', 'sitecheckdays'));
if ($days < 1)
$days = 30;
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index e0fa2d629..d2c863572 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libzotdir;
@@ -9,7 +10,7 @@ class Cron {
static public function run($argc, $argv) {
- $maxsysload = intval(get_config('system', 'maxloadavg'));
+ $maxsysload = intval(Config::Get('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
if (function_exists('sys_getloadavg')) {
@@ -24,7 +25,7 @@ class Cron {
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/cron';
if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
- && (!get_config('system', 'override_cron_lockfile'))) {
+ && (!Config::Get('system', 'override_cron_lockfile'))) {
logger("cron: Already running");
return;
}
@@ -41,7 +42,7 @@ class Cron {
// Pull remote changes and push local changes.
// potential issue: how do we keep from creating an endless update loop?
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
Libzotdir::sync_directories($dirmode);
@@ -64,7 +65,7 @@ class Cron {
require_once('include/account.php');
remove_expired_registrations();
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
// expire any expired items
@@ -124,13 +125,13 @@ class Cron {
$r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
if ($r) {
q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s",
intval(PHOTO_CACHE),
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
foreach ($r as $rr) {
$file = dbunescbin($rr['content']);
@@ -185,13 +186,13 @@ class Cron {
// FIXME: add birthday updates, both locally and for xprof for use
// by directory servers
- $d1 = intval(get_config('system', 'last_expire_day'));
+ $d1 = intval(Config::Get('system', 'last_expire_day'));
$d2 = intval(datetime_convert('UTC', 'UTC', 'now', 'd'));
// Allow somebody to staggger daily activities if they have more than one site on their server,
// or if it happens at an inconvenient (busy) hour.
- $h1 = intval(get_config('system', 'cron_hour'));
+ $h1 = intval(Config::Get('system', 'cron_hour'));
$h2 = intval(datetime_convert('UTC', 'UTC', 'now', 'G'));
@@ -225,7 +226,7 @@ class Cron {
// pull in some public posts if allowed
- $disable_externals = get_config('system', 'disable_discover_tab') || get_config('system', 'disable_discover_tab') === false || get_config('system', 'site_firehose');
+ $disable_externals = Config::Get('system', 'disable_discover_tab') || Config::Get('system', 'disable_discover_tab') === false || Config::Get('system', 'site_firehose');
if (!$disable_externals)
Master::Summon(['Externals']);
@@ -245,7 +246,7 @@ class Cron {
if (!$restart)
Master::Summon(array('Cronhooks'));
- set_config('system', 'lastcron', datetime_convert());
+ Config::Set('system', 'lastcron', datetime_convert());
//All done - clear the lockfile
//@unlink($lockfile);
diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php
index 98379be1b..3bc267f08 100644
--- a/Zotlabs/Daemon/Cron_daily.php
+++ b/Zotlabs/Daemon/Cron_daily.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzotdir;
class Cron_daily {
@@ -68,7 +69,7 @@ class Cron_daily {
// Clean up cache
q("DELETE FROM cache WHERE updated < %s - INTERVAL %s",
db_utcnow(),
- db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY')
+ db_quoteinterval(Config::Get('system', 'cache_expire_days', 7) . ' DAY')
);
//update statistics in config
@@ -82,7 +83,7 @@ class Cron_daily {
// expire old delivery reports
- $keep_reports = intval(get_config('system', 'expire_delivery_reports'));
+ $keep_reports = intval(Config::Get('system', 'expire_delivery_reports'));
if ($keep_reports === 0)
$keep_reports = 10;
@@ -103,7 +104,7 @@ class Cron_daily {
$date = datetime_convert();
call_hooks('cron_daily', $date);
- set_config('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
+ Config::Set('system', 'last_expire_day', intval(datetime_convert('UTC', 'UTC', 'now', 'd')));
/**
* End Cron Daily
diff --git a/Zotlabs/Daemon/Cron_weekly.php b/Zotlabs/Daemon/Cron_weekly.php
index 75fb94700..f9ea5aae7 100644
--- a/Zotlabs/Daemon/Cron_weekly.php
+++ b/Zotlabs/Daemon/Cron_weekly.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
class Cron_weekly {
static public function run($argc, $argv) {
@@ -44,7 +46,7 @@ class Cron_weekly {
db_utcnow(), db_quoteinterval('14 DAY')
);
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if ($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())), true));
}
diff --git a/Zotlabs/Daemon/Directory.php b/Zotlabs/Daemon/Directory.php
index 19adf8273..1c4c29ac2 100644
--- a/Zotlabs/Daemon/Directory.php
+++ b/Zotlabs/Daemon/Directory.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Queue;
@@ -25,7 +26,7 @@ class Directory {
logger('directory update', LOGGER_DEBUG);
- $dirmode = get_config('system', 'directory_mode');
+ $dirmode = Config::Get('system', 'directory_mode');
if ($dirmode === false)
$dirmode = DIRECTORY_MODE_NORMAL;
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 6ab67150f..ad52a6b71 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
require_once('include/items.php');
class Expire {
@@ -10,14 +12,14 @@ class Expire {
cli_startup();
- $pid = get_config('procid', 'expire', false);
+ $pid = Config::Get('procid', 'expire', false);
if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
logger('procedure already run with pid ' . $pid, LOGGER_DEBUG);
return;
}
$pid = getmypid();
- set_config('procid', 'expire', $pid);
+ Config::Set('procid', 'expire', $pid);
// perform final cleanup on previously delete items
@@ -38,13 +40,13 @@ class Expire {
db_quoteinterval('36 DAY')
);
- if (intval(get_config('system', 'optimize_items')))
+ if (intval(Config::Get('system', 'optimize_items')))
q("optimize table item");
logger('expire: start with pid ' . $pid, LOGGER_DEBUG);
- $site_expire = intval(get_config('system', 'default_expire_days', 30));
- $commented_days = intval(get_config('system', 'active_expire_days', 7));
+ $site_expire = intval(Config::Get('system', 'default_expire_days', 30));
+ $commented_days = intval(Config::Get('system', 'active_expire_days', 7));
logger('site_expire: ' . $site_expire);
@@ -84,7 +86,7 @@ class Expire {
// this should probably just fetch the channel_expire_days from the sys channel,
// but there's no convenient way to set it.
- $expire_days = get_config('system', 'sys_expire_days');
+ $expire_days = Config::Get('system', 'sys_expire_days');
if ($expire_days === false)
$expire_days = 30;
@@ -101,7 +103,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
- del_config('procid', 'expire');
+ Config::Delete('procid', 'expire');
return;
}
diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php
index c9ed91aaa..d28e462dd 100644
--- a/Zotlabs/Daemon/Master.php
+++ b/Zotlabs/Daemon/Master.php
@@ -37,7 +37,7 @@ class Master {
return;
}
- $phpbin = get_config('system', 'phpbin', 'php');
+ $phpbin = Config::Get('system', 'phpbin', 'php');
proc_run($phpbin, 'Zotlabs/Daemon/Master.php', $arr);
*/
}
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 4e7ca3911..20134b8fe 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -2,8 +2,9 @@
namespace Zotlabs\Daemon;
-use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Activity;
+use Zotlabs\Lib\Config;
+use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
require_once('include/html2plain.php');
@@ -668,7 +669,7 @@ class Notifier {
);
// only create delivery reports for normal undeleted items
- if (is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
+ if (is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
dbesc($target_item['mid']),
@@ -698,7 +699,7 @@ class Notifier {
do_delivery(self::$deliveries);
}
- if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!get_config('system', 'disable_dreport'))) {
+ if ($dead_hosts && is_array($target_item) && (!$target_item['item_deleted']) && (!Config::Get('system', 'disable_dreport'))) {
foreach ($dead_hosts as $deceased_host) {
$r = q("insert into dreport ( dreport_mid, dreport_site, dreport_recip, dreport_name, dreport_result, dreport_time, dreport_xchan, dreport_queue )
values ( '%s', '%s','%s','%s','%s','%s','%s','%s' ) ",
diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php
index 973bcf402..e525d138c 100644
--- a/Zotlabs/Daemon/Onepoll.php
+++ b/Zotlabs/Daemon/Onepoll.php
@@ -5,6 +5,7 @@ namespace Zotlabs\Daemon;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\ASCollection;
+use Zotlabs\Lib\Config;
use Zotlabs\Lib\Libzot;
require_once('include/socgraph.php');
@@ -25,7 +26,7 @@ class Onepoll {
}
$sql_extra = '';
- $allow_feeds = get_config('system', 'feed_contacts');
+ $allow_feeds = Config::Get('system', 'feed_contacts');
if(!$allow_feeds) {
$sql_extra = ' and abook_feed = 0 ';
}
@@ -125,7 +126,7 @@ class Onepoll {
if ($fetch_feed) {
- $max = intval(get_config('system', 'max_imported_posts', 30));
+ $max = intval(Config::Get('system', 'max_imported_posts', 30));
if (intval($max)) {
$cl = Activity::get_actor_collections($contact['abook_xchan']);
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index 77a428ec3..2103310b9 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -2,11 +2,13 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
+
class Poller {
static public function run($argc, $argv) {
- $maxsysload = intval(get_config('system', 'maxloadavg'));
+ $maxsysload = intval(Config::Get('system', 'maxloadavg'));
if ($maxsysload < 1)
$maxsysload = 50;
if (function_exists('sys_getloadavg')) {
@@ -17,7 +19,7 @@ class Poller {
}
}
- $interval = get_config('queueworker', 'queue_interval', 500000);
+ $interval = Config::Get('queueworker', 'queue_interval', 500000);
logger('poller: start');
@@ -43,13 +45,13 @@ class Poller {
reload_plugins();
// Only poll from those with suitable relationships
- $abandon_days = intval(get_config('system', 'account_abandon_days', 0));
+ $abandon_days = intval(Config::Get('system', 'account_abandon_days', 0));
$abandon_sql = (($abandon_days)
? sprintf(" AND account_lastlog > %s - INTERVAL %s ", db_utcnow(), db_quoteinterval(intval($abandon_days) . ' DAY'))
: ''
);
- $allow_feeds = get_config('system', 'feed_contacts');
+ $allow_feeds = Config::Get('system', 'feed_contacts');
if(!$allow_feeds) {
$sql_extra .= ' and abook_feed = 0 ';
}
@@ -81,7 +83,7 @@ class Poller {
if (intval($contact['abook_feed'])) {
$min = service_class_fetch($contact['abook_channel'], 'minimum_feedcheck_minutes');
if (!$min)
- $min = intval(get_config('system', 'minimum_feedcheck_minutes'));
+ $min = intval(Config::Get('system', 'minimum_feedcheck_minutes'));
if (!$min)
$min = 60;
@@ -167,7 +169,7 @@ class Poller {
}
}
- $dirmode = intval(get_config('system', 'directory_mode'));
+ $dirmode = intval(Config::Get('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
$r = q("SELECT * FROM updates WHERE ud_update = 1 AND (ud_last = '%s' OR ud_last > %s - INTERVAL %s)",
@@ -195,7 +197,7 @@ class Poller {
}
}
- set_config('system', 'lastpoll', datetime_convert());
+ Config::Set('system', 'lastpoll', datetime_convert());
return;
}
diff --git a/Zotlabs/Daemon/Thumbnail.php b/Zotlabs/Daemon/Thumbnail.php
index fa9570658..85fcb8b72 100644
--- a/Zotlabs/Daemon/Thumbnail.php
+++ b/Zotlabs/Daemon/Thumbnail.php
@@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
+use Zotlabs\Lib\Config;
class Thumbnail {
@@ -19,9 +20,9 @@ class Thumbnail {
$attach = $c[0];
- $preview_style = intval(get_config('system', 'thumbnail_security', 0));
- $preview_width = intval(get_config('system', 'thumbnail_width', 300));
- $preview_height = intval(get_config('system', 'thumbnail_height', 300));
+ $preview_style = intval(Config::Get('system', 'thumbnail_security', 0));
+ $preview_width = intval(Config::Get('system', 'thumbnail_width', 300));
+ $preview_height = intval(Config::Get('system', 'thumbnail_height', 300));
$p = [
'attach' => $attach,