diff options
-rw-r--r-- | Zotlabs/Daemon/Cache_embeds.php | 15 | ||||
-rw-r--r-- | include/items.php | 9 |
2 files changed, 14 insertions, 10 deletions
diff --git a/Zotlabs/Daemon/Cache_embeds.php b/Zotlabs/Daemon/Cache_embeds.php index d5adfcc59..99b1c7ac0 100644 --- a/Zotlabs/Daemon/Cache_embeds.php +++ b/Zotlabs/Daemon/Cache_embeds.php @@ -6,23 +6,28 @@ class Cache_embeds { static public function run($argc,$argv) { - if(! $argc == 2) + if(!$argc == 2) { return; + } - $c = q("select body from item where id = %d ", - dbesc(intval($argv[1])) + $c = q("select uid, aid, body, item_private from item where uuid = '%s'", + dbesc($argv[1]) ); - if(! $c) + if(!$c) { return; + } $item = $c[0]; // bbcode conversion by default processes embeds that aren't already cached. // Ignore the returned html output. - bbcode($item['body']); + // photocache addon hook to prefetch one copy of public item images for the sys channel + call_hooks('cache_prefetch_hook', $item); + return; } + } diff --git a/include/items.php b/include/items.php index 06ee34476..ee8f856d7 100644 --- a/include/items.php +++ b/include/items.php @@ -2076,9 +2076,8 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr item_update_parent_commented($arr); - - if(strpos($arr['body'],'[embed]') !== false) { - Master::Summon([ 'Cache_embeds', $current_post ]); + if (str_contains($arr['body'], '[/embed]') || str_contains($arr['body'], '[/img]') || str_contains($arr['body'], '[/zmg]')) { + Master::Summon(['Cache_embeds', $arr['uuid']]); } $ret['success'] = true; @@ -2422,8 +2421,8 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy */ call_hooks('item_stored_update',$arr); - if(strpos($arr['body'],'[embed]') !== false) { - Master::Summon([ 'Cache_embeds', $orig_post_id ]); + if (str_contains($arr['body'], '[/embed]') || str_contains($arr['body'], '[/img]') || str_contains($arr['body'], '[/zmg]')) { + Master::Summon(['Cache_embeds', $arr['uuid']]); } $ret['success'] = true; |