diff options
author | Mario <mario@mariovavti.com> | 2024-12-08 22:46:21 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-12-08 22:46:21 +0000 |
commit | 7785487d776cdb5117f9a9206da9557ad2f59d0f (patch) | |
tree | 9f0da496b1d321d925cf0cc50af5e5efccbe711a /Zotlabs | |
parent | 9756023e39cb58081b68644e23322cb69c8f0833 (diff) | |
download | volse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.tar.gz volse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.tar.bz2 volse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.zip |
fix delayed post handling in cron, always set item_delayed if we select a create date
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 42 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 2 |
3 files changed, 20 insertions, 28 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index 4a5d88f8f..a38809f45 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -147,37 +147,29 @@ 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']]); } } - } - } - + 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 diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 66d2b06a7..f0b69038a 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -3807,8 +3807,8 @@ class Activity { ->setDenyGid($sourceItem['deny_gid']) ->setPrivate($sourceItem['item_private']) ->setRestrict($sourceItem['item_restrict']) - ->setNocomment($sourceItem['item_nocomment']) - ->setCommentsClosed($sourceItem['comments_closed']) + // ->setNocomment($sourceItem['item_nocomment']) + // ->setCommentsClosed($sourceItem['comments_closed']) ->setType($sourceItem['item_type']) ->setCommentPolicy($sourceItem['comment_policy']) ->setPublicPolicy($sourceItem['public_policy']) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 06175109f..f542e44ff 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -100,7 +100,6 @@ class Item extends Controller { $item_deleted = false; $item_hidden = false; $item_unpublished = false; - $item_delayed = false; $item_pending_remove = false; $item_blocked = false; @@ -178,6 +177,7 @@ class Item extends Controller { $categories = ((x($_REQUEST, 'category')) ? escape_tags($_REQUEST['category']) : ''); $webpage = ((x($_REQUEST, 'webpage')) ? intval($_REQUEST['webpage']) : 0); $item_obscured = ((x($_REQUEST, 'obscured')) ? intval($_REQUEST['obscured']) : 0); + $item_delayed = ((x($_REQUEST, 'delayed')) ? intval($_REQUEST['delayed']) : 0); $pagetitle = ((x($_REQUEST, 'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : ''); $layout_mid = ((x($_REQUEST, 'layout_mid')) ? escape_tags($_REQUEST['layout_mid']) : ''); $plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); |