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/Channel_purge.php2
-rw-r--r--Zotlabs/Daemon/Checksites.php4
-rw-r--r--Zotlabs/Daemon/Content_importer.php12
-rw-r--r--Zotlabs/Daemon/Cron.php74
-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.php20
-rw-r--r--Zotlabs/Daemon/File_importer.php8
-rw-r--r--Zotlabs/Daemon/Importdoc.php21
-rw-r--r--Zotlabs/Daemon/Master.php2
-rw-r--r--Zotlabs/Daemon/Notifier.php50
-rw-r--r--Zotlabs/Daemon/Onepoll.php5
-rw-r--r--Zotlabs/Daemon/Poller.php16
-rw-r--r--Zotlabs/Daemon/Thumbnail.php7
-rw-r--r--Zotlabs/Daemon/Xchan_photo.php9
17 files changed, 139 insertions, 112 deletions
diff --git a/Zotlabs/Daemon/Cache_query.php b/Zotlabs/Daemon/Cache_query.php
index d6f66f1f0..d5788795f 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 {
@@ -14,14 +15,14 @@ class Cache_query {
$r = null;
$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);
@@ -34,7 +35,7 @@ class Cache_query {
Cache::set($key, serialize($r));
}
- del_config('procid', $key);
+ Config::Delete('procid', $key);
return;
}
diff --git a/Zotlabs/Daemon/Channel_purge.php b/Zotlabs/Daemon/Channel_purge.php
index 9fceb0fb9..7286a791a 100644
--- a/Zotlabs/Daemon/Channel_purge.php
+++ b/Zotlabs/Daemon/Channel_purge.php
@@ -24,7 +24,7 @@ class Channel_purge {
);
if ($r) {
foreach ($r as $rv) {
- drop_item($rv['id'], false);
+ drop_item($rv['id'], uid: $channel_id);
}
}
} while ($r);
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/Content_importer.php b/Zotlabs/Daemon/Content_importer.php
index 67f1c8e80..b98a1f10d 100644
--- a/Zotlabs/Daemon/Content_importer.php
+++ b/Zotlabs/Daemon/Content_importer.php
@@ -38,7 +38,13 @@ class Content_importer {
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512');
- $x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,false,$redirects,[ 'headers' => $headers ]);
+ $redirects = 0;
+ $x = z_fetch_url(
+ $hz_server . '/api/z/1.0/item/export_page?f=&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,
+ false,
+ $redirects,
+ [ 'headers' => $headers ]
+ );
// logger('item fetch: ' . print_r($x,true));
@@ -47,9 +53,9 @@ class Content_importer {
killme();
}
- $j = json_decode($x['body'],true);
+ $j = json_decode($x['body'], true);
- if(! is_array($j['item']) || ! count($j['item'])) {
+ if($j && empty($j['item'])) {
PConfig::Set($channel['channel_id'], 'import', 'content_completed', 1);
return;
}
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index e0fa2d629..a38809f45 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,22 +65,22 @@ 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
- $r = q("select id,item_wall from item where expires > '2001-01-01 00:00:00' and expires < %s
+ $r = q("select id, uid, item_wall from item where expires > '2001-01-01 00:00:00' and expires < %s
and item_deleted = 0 ",
db_utcnow()
);
+
if ($r) {
- require_once('include/items.php');
foreach ($r as $rr) {
- drop_item($rr['id'], false, (($rr['item_wall']) ? DROPITEM_PHASE1 : DROPITEM_NORMAL));
+ // pass uid of the message for permission check as we are running as a daemon process with no session.
+ drop_item($rr['id'], (($rr['item_wall']) ? DROPITEM_PHASE1 : DROPITEM_NORMAL), uid: intval($rr['uid']));
if ($rr['item_wall']) {
// The notifier isn't normally invoked unless item_drop is interactive.
Master::Summon(['Notifier', 'drop', $rr['id']]);
-
if ($interval) {
usleep($interval);
}
@@ -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']);
@@ -146,52 +147,41 @@ class Cron {
// (time travel posts). Restrict to items that have come of age in the last
// couple of days to limit the query to something reasonable.
- $r = q("select id from item where item_delayed = 1 and created <= %s and created > '%s' ",
+ $r = q("select * from item where item_delayed = 1 and created <= %s and created > '%s' ",
db_utcnow(),
dbesc(datetime_convert('UTC', 'UTC', 'now - 2 days'))
);
- if ($r) {
- foreach ($r as $rr) {
- $x = q("update item set item_delayed = 0 where id = %d",
- intval($rr['id'])
- );
- if ($x) {
- $z = q("select * from item where id = %d",
- intval($rr['id'])
- );
- if ($z) {
- xchan_query($z);
- $sync_item = fetch_post_tags($z);
- Libsync::build_sync_packet($sync_item[0]['uid'],
- [
- 'item' => [encode_item($sync_item[0], true)]
- ]
- );
- }
- Master::Summon(array('Notifier', 'wall-new', $rr['id']));
- if ($interval) {
- usleep($interval);
+ if ($r) {
+ xchan_query($r);
+ $items = fetch_post_tags($r);
+ foreach ($items as $item) {
+ $item['item_delayed'] = 0;
+ $post = item_store_update($item);
+
+ if($post['success']) {
+ Master::Summon(['Notifier', 'wall-new', $post['item_id']]);
+ if (!empty($post['approval_id'])) {
+ Master::Summon(['Notifier', 'wall-new', $post['approval_id']]);
}
}
- }
- }
-
- require_once('include/attach.php');
- attach_upgrade();
-
+ if ($interval) {
+ usleep($interval);
+ }
+ }
+ }
// once daily run birthday_updates and then expire in background
// 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 +215,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 +235,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..dae585578 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,24 +12,24 @@ 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
- $r = q("select id from item where item_deleted = 1 and item_pending_remove = 0 and changed < %s - INTERVAL %s",
+ $r = q("select id, uid from item where item_deleted = 1 and item_pending_remove = 0 and changed < %s - INTERVAL %s",
db_utcnow(),
db_quoteinterval('10 DAY')
);
if ($r) {
foreach ($r as $rr) {
- drop_item($rr['id'], false, DROPITEM_PHASE2);
+ drop_item($rr['id'], DROPITEM_PHASE2, uid: $rr['uid']);
}
}
@@ -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/File_importer.php b/Zotlabs/Daemon/File_importer.php
index 7067e152d..1ddab60f0 100644
--- a/Zotlabs/Daemon/File_importer.php
+++ b/Zotlabs/Daemon/File_importer.php
@@ -38,7 +38,13 @@ class File_importer {
$headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),true,'sha512');
// TODO: implement total count
- $x = z_fetch_url($hz_server . '/api/z/1.0/file/export_page?f=records=1&page=' . $page, false, $redirects, [ 'headers' => $headers ]);
+ $redirects = 0;
+ $x = z_fetch_url(
+ $hz_server . '/api/z/1.0/file/export_page?f=records=1&page=' . $page,
+ false,
+ $redirects,
+ [ 'headers' => $headers ]
+ );
// logger('file fetch: ' . print_r($x,true));
if(! $x['success']) {
diff --git a/Zotlabs/Daemon/Importdoc.php b/Zotlabs/Daemon/Importdoc.php
index c5a81e50c..de571848e 100644
--- a/Zotlabs/Daemon/Importdoc.php
+++ b/Zotlabs/Daemon/Importdoc.php
@@ -11,6 +11,21 @@ class Importdoc {
self::update_docs_dir('doc/*');
+ $sys = get_sys_channel();
+
+ // remove old files that weren't updated (indicates they were most likely deleted).
+ $i = q("select id from item where uid = %d and item_type = 5 and edited < %s - INTERVAL %s",
+ intval($sys['channel_id']),
+ db_utcnow(),
+ db_quoteinterval('14 DAY')
+ );
+
+ if ($i) {
+ foreach ($i as $iv) {
+ drop_item($iv['id'], uid: $sys['channel_id']);
+ }
+ }
+
return;
}
@@ -18,9 +33,13 @@ class Importdoc {
static public function update_docs_dir($s) {
$f = basename($s);
$d = dirname($s);
- if ($s === 'doc/html')
+
+ if ($s === 'doc/html') {
return;
+ }
+
$files = glob("$d/$f");
+
if ($files) {
foreach ($files as $fi) {
if ($fi === 'doc/html') {
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..9fdb1defb 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');
@@ -240,11 +241,6 @@ class Notifier {
$target_item = $r[0];
- if (in_array($target_item['author']['xchan_network'], ['rss', 'anon', 'token'])) {
- logger('notifier: target item author is not a fetchable actor', LOGGER_DEBUG);
- return;
- }
-
if (intval($target_item['item_deleted'])) {
logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG);
}
@@ -267,22 +263,9 @@ class Notifier {
}
- // Check for non published items, but allow an exclusion for transmitting hidden file activities
-
- if (intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) ||
- intval($target_item['item_blocked']) || intval($target_item['item_hidden'])) {
- logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG);
- return;
- }
-
- // follow/unfollow is for internal use only
- if (in_array($target_item['verb'], ['Follow', 'Ignore', ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW])) {
- logger('not fowarding follow/unfollow note activity');
- return;
- }
-
- if (strpos($target_item['postopts'], 'nodeliver') !== false) {
- logger('notifier: target item is undeliverable', LOGGER_DEBUG);
+ if (!item_forwardable($target_item)) {
+ //hz_syslog(print_r($target_item,true));
+ logger('notifier: target item not forwardable', LOGGER_DEBUG);
return;
}
@@ -298,7 +281,7 @@ class Notifier {
return;
}
- if ($target_item['verb'] === ACTIVITY_SHARE) {
+ if (in_array($target_item['verb'], [ACTIVITY_SHARE])) {
// Provide correct representation across the wire. Internally this is treated as a comment.
$target_item['parent_mid'] = $target_item['thr_parent'] = $target_item['mid'];
}
@@ -340,7 +323,13 @@ class Notifier {
self::$encoded_item = json_decode($m, true);
}
else {
- self::$encoded_item = Activity::build_packet(Activity::encode_activity($target_item), self::$channel, false);
+ $activity = Activity::encode_activity($target_item);
+
+ if (!$activity) {
+ return;
+ }
+
+ self::$encoded_item = Activity::build_packet($activity, self::$channel, false);
}
logger('target_item: ' . print_r($target_item, true), LOGGER_DEBUG);
@@ -357,6 +346,10 @@ class Notifier {
$relay_to_owner = (!$top_level_post && intval($target_item['item_origin']) && comment_local_origin($target_item));
+ if (self::$channel['channel_hash'] === $target_item['owner_xchan']) {
+ $relay_to_owner = false;
+ }
+
// $cmd === 'relay' indicates the owner is sending it to the original recipients
// don't allow the item in the relay command to relay to owner under any circumstances, it will loop
@@ -373,7 +366,6 @@ class Notifier {
if (($relay_to_owner || $uplink) && ($cmd !== 'relay')) {
logger('notifier: followup relay', LOGGER_DEBUG);
- // If the Parent item is an Announce the real owner is the parent author
$sendto = (($uplink) ? $parent_item['source_xchan'] : $parent_item['owner_xchan']);
self::$recipients = [$sendto];
self::$private = true;
@@ -388,7 +380,7 @@ class Notifier {
logger('normal (downstream) distribution', LOGGER_DEBUG);
}
- if ($parent_item && $parent_item['item_private'] !== $target_item['item_private']) {
+ if (($parent_item && $parent_item['item_private'] !== $target_item['item_private']) || (intval($target_item['item_restrict']) & 1)) {
logger('conversation privacy mismatch - downstream delivery prevented');
return;
}
@@ -588,8 +580,6 @@ class Notifier {
foreach ($dhubs as $hub) {
- logger('notifier_hub: ' . $hub['hubloc_url'], LOGGER_DEBUG);
-
if ($hub['hubloc_network'] !== 'zot6') {
$narr = [
'channel' => self::$channel,
@@ -668,7 +658,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 +688,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,
diff --git a/Zotlabs/Daemon/Xchan_photo.php b/Zotlabs/Daemon/Xchan_photo.php
index f90d1d726..662fc967c 100644
--- a/Zotlabs/Daemon/Xchan_photo.php
+++ b/Zotlabs/Daemon/Xchan_photo.php
@@ -8,14 +8,15 @@ class Xchan_photo {
static public function run($argc, $argv) {
- if ($argc != 3) {
+ if ($argc < 3) {
return;
}
$url = hex2bin($argv[1]);
$xchan = hex2bin($argv[2]);
+ $force = $argv[3];
- $photos = import_xchan_photo($url, $xchan);
+ $photos = import_xchan_photo($url, $xchan, false, $force);
if ($photos) {
$result = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_hash = '%s'",
dbescdate(datetime_convert()),
@@ -27,8 +28,10 @@ class Xchan_photo {
);
if (! $result) {
- logger("xchan update failed for $url");
+ logger("xchan photo update failed for $url");
}
}
+
+ return;
}
}