cache embeds in the background on initial storage rather than on first access
This commit is contained in:
parent
753f137575
commit
b15421826d
27
Zotlabs/Daemon/Cache_embeds.php
Normal file
27
Zotlabs/Daemon/Cache_embeds.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php /** @file */
|
||||
|
||||
namespace Zotlabs\Daemon;
|
||||
|
||||
|
||||
class Cache_embeds {
|
||||
|
||||
static public function run($argc,$argv) {
|
||||
|
||||
if(! $argc == 2)
|
||||
return;
|
||||
|
||||
$c = q("select body from item where id = %d ",
|
||||
dbesc(intval($argv[1]))
|
||||
);
|
||||
|
||||
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']);
|
||||
}
|
||||
}
|
@ -2048,6 +2048,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
||||
|
||||
item_update_parent_commented($arr);
|
||||
|
||||
|
||||
if(strpos($arr['body'],'[embed]') !== false) {
|
||||
Master::Summon([ 'Cache_embeds', $current_post ]);
|
||||
}
|
||||
|
||||
// If _creating_ a deleted item, don't propagate it further or send out notifications.
|
||||
// We need to store the item details just in case the delete came in before the original post,
|
||||
// so that we have an item in the DB that's marked deleted and won't store a fresh post
|
||||
@ -2384,6 +2389,13 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) {
|
||||
*/
|
||||
call_hooks('item_stored_update',$arr);
|
||||
|
||||
if(strpos($arr['body'],'[embed]') !== false) {
|
||||
Master::Summon([ 'Cache_embeds', $orig_post_id ]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if($deliver) {
|
||||
send_status_notifications($orig_post_id,$arr);
|
||||
tag_deliver($uid,$orig_post_id);
|
||||
|
Reference in New Issue
Block a user