From e800e2db2b6149cb1a3d32bb111fc23eb8bcc2c4 Mon Sep 17 00:00:00 2001 From: "DM42.Net Zap Dev" Date: Mon, 19 Aug 2019 23:13:19 -0400 Subject: Return in the case of further processing --- Zotlabs/Daemon/Cron.php | 2 +- Zotlabs/Daemon/CurlAuth.php | 6 +++--- Zotlabs/Daemon/Master.php | 2 +- Zotlabs/Daemon/Poller.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index fe356bcbf..a08d2b7d2 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -215,7 +215,7 @@ class Cron { $restart = true; $generation = intval($argv[2]); if(! $generation) - killme(); + return; } reload_plugins(); diff --git a/Zotlabs/Daemon/CurlAuth.php b/Zotlabs/Daemon/CurlAuth.php index be12bc779..de41382e3 100644 --- a/Zotlabs/Daemon/CurlAuth.php +++ b/Zotlabs/Daemon/CurlAuth.php @@ -13,7 +13,7 @@ class CurlAuth { static public function run($argc,$argv) { if($argc != 2) - killme(); + return; \App::$session->start(); @@ -50,6 +50,6 @@ class CurlAuth { file_put_contents($c,$x); - killme(); + return; } -} \ No newline at end of file +} diff --git a/Zotlabs/Daemon/Master.php b/Zotlabs/Daemon/Master.php index 67a3acc0a..8c3a7e570 100644 --- a/Zotlabs/Daemon/Master.php +++ b/Zotlabs/Daemon/Master.php @@ -9,7 +9,7 @@ if(array_search( __file__ , get_included_files()) === 0) { if($argc) Master::Release($argc,$argv); - killme(); + return; } diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php index 84bf7e923..ebc0584ba 100644 --- a/Zotlabs/Daemon/Poller.php +++ b/Zotlabs/Daemon/Poller.php @@ -47,7 +47,7 @@ class Poller { $restart = true; $generation = intval($argv[2]); if(! $generation) - killme(); + return; } if(($argc > 1) && intval($argv[1])) { -- cgit v1.2.3 From 7c5cfe66973a8e529c01c3a214e9f8b791c89c23 Mon Sep 17 00:00:00 2001 From: "M. Dent" Date: Mon, 23 Sep 2019 10:11:27 +0200 Subject: Notify on custom items - rework hooks --- Zotlabs/Daemon/Notifier.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 15dc08908..1d0be10d9 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -285,8 +285,21 @@ class Notifier { } if(! in_array(intval($target_item['item_type']), [ ITEM_TYPE_POST ] )) { - logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG); - return; + $hookinfo=[ + 'targetitem'=>$target_item, + 'deliver'=>false + ]; + if (intval($target_item['item_type'] == ITEM_TYPE_CUSTOM)) { + call_hooks('customitem_deliver',$hookinfo); + } + + if (!$hookinfo['deliver']) { + logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG); + return; + } + + $target_item = $hookinfo['targetitem']; + } // Check for non published items, but allow an exclusion for transmitting hidden file activities -- cgit v1.2.3 From 9fac43a3a3f1993e4ffaa543da6a6b3e175fc7f4 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 1 Nov 2019 10:34:02 +0100 Subject: Better photo cache expiry processing --- Zotlabs/Daemon/Cron.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index a08d2b7d2..94d2b634f 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -97,13 +97,14 @@ class Cron { // Clean expired photos from cache - $age = get_config('system','active_expire_days', '30'); - $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", - intval(PHOTO_CACHE), - db_utcnow(), - db_quoteinterval($age . ' DAY') + $sql_interval = db_utcnow() . ' - ' . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); + $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < $sql_interval", + intval(PHOTO_CACHE) ); if($r) { + q("DELETE FROM photo WHERE photo_usage = %d AND expires < $sql_interval", + intval(PHOTO_CACHE) + ); foreach($r as $rr) { $file = dbunescbin($rr['content']); if(is_file($file)) { @@ -113,11 +114,6 @@ class Cron { } } } - q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", - intval(PHOTO_CACHE), - db_utcnow(), - db_quoteinterval($age . ' DAY') - ); // publish any applicable items that were set to be published in the future // (time travel posts). Restrict to items that have come of age in the last -- cgit v1.2.3 From 69533ce8f5eb61ea4da2cbed1c91c5c743dc4645 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Fri, 1 Nov 2019 10:46:49 +0100 Subject: Add missed interval in SQL query --- Zotlabs/Daemon/Cron.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 94d2b634f..8835d8fca 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -97,7 +97,7 @@ class Cron { // Clean expired photos from cache - $sql_interval = db_utcnow() . ' - ' . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); + $sql_interval = db_utcnow() . ' - INTERVAL ' . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < $sql_interval", intval(PHOTO_CACHE) ); -- cgit v1.2.3 From 74ef5f38e9bf4642c6e752ad365ae20ead394e56 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 2 Nov 2019 10:36:04 +0100 Subject: Fix start time to sync queries on photo cache purge --- Zotlabs/Daemon/Cron.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 8835d8fca..7b951e7d4 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -97,7 +97,7 @@ class Cron { // Clean expired photos from cache - $sql_interval = db_utcnow() . ' - INTERVAL ' . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); + $sql_interval = "'" . dbesc(datetime_convert()) . "' - INTERVAL " . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < $sql_interval", intval(PHOTO_CACHE) ); -- cgit v1.2.3 From 158b8aea387098e62e83920a8425549c02f17bdf Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 10 Nov 2019 10:49:44 +0000 Subject: hopefully fix query for postgres (cherry picked from commit 9ad4c6528cc3ee4e34d2b5d77027a1c33cbadf5c) --- Zotlabs/Daemon/Cron.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 7b951e7d4..8fa31e6ce 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -97,13 +97,16 @@ class Cron { // Clean expired photos from cache - $sql_interval = "'" . dbesc(datetime_convert()) . "' - INTERVAL " . db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY'); - $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < $sql_interval", - intval(PHOTO_CACHE) + $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','active_expire_days', '30') . ' DAY') ); if($r) { - q("DELETE FROM photo WHERE photo_usage = %d AND expires < $sql_interval", - intval(PHOTO_CACHE) + q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", + intval(PHOTO_CACHE), + db_utcnow(), + db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY') ); foreach($r as $rr) { $file = dbunescbin($rr['content']); -- cgit v1.2.3 From 05604e4bd2f6491ebd567e8583acf820e5459514 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 15 Nov 2019 10:01:21 +0000 Subject: onepoll: do not update dead feeds (cherry picked from commit 5a6b14f8787927ee6ea99c622d02875811d3a74a) --- Zotlabs/Daemon/Onepoll.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index 1d9fd5f72..2f06ec125 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -61,11 +61,13 @@ class Onepoll { if($contact['xchan_network'] === 'rss') { logger('onepoll: processing feed ' . $contact['xchan_name'], LOGGER_DEBUG); - handle_feed($importer['channel_id'],$contact_id,$contact['xchan_hash']); - q("update abook set abook_connected = '%s' where abook_id = %d", - dbesc(datetime_convert()), - intval($contact['abook_id']) - ); + $alive = handle_feed($importer['channel_id'],$contact_id,$contact['xchan_hash']); + if ($alive) { + q("update abook set abook_connected = '%s' where abook_id = %d", + dbesc(datetime_convert()), + intval($contact['abook_id']) + ); + } return; } -- cgit v1.2.3 From 63aa3948e5b4a02abdb1531b2dee990d134351fd Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 25 Nov 2019 21:50:02 +0100 Subject: resolve merge conflict --- Zotlabs/Daemon/Cron_daily.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Zotlabs/Daemon') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index dbfcff439..eebdb0229 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -44,6 +44,11 @@ class Cron_daily { db_utcnow(), db_quoteinterval('1 YEAR') ); + // Clean up emdedded content cache + q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", + db_utcnow(), + db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY') + ); //update statistics in config require_once('include/statistics_fns.php'); -- cgit v1.2.3