streams/Zotlabs/Daemon/Cache_embeds.php

35 lines
635 B
PHP
Raw Normal View History

2020-03-26 00:48:27 +00:00
<?php
2019-01-29 23:18:35 +00:00
namespace Zotlabs\Daemon;
class Cache_embeds {
static public function run($argc,$argv) {
2020-03-26 00:48:27 +00:00
if (! $argc == 2) {
2019-01-29 23:18:35 +00:00
return;
2020-03-26 00:48:27 +00:00
}
2019-01-29 23:18:35 +00:00
2020-08-17 04:55:59 +00:00
$c = q("select body, html, created from item where id = %d ",
2019-01-29 23:18:35 +00:00
dbesc(intval($argv[1]))
);
2020-03-26 00:48:27 +00:00
if (! $c) {
2019-01-29 23:18:35 +00:00
return;
2020-03-26 00:48:27 +00:00
}
2019-01-29 23:18:35 +00:00
2020-03-26 00:48:27 +00:00
$item = array_shift($c);
2019-01-29 23:18:35 +00:00
2020-08-17 04:55:59 +00:00
$cache_expire = intval(get_config('system', 'default_expire_days'));
if ($cache_expire <= 0) {
$cache_expire = 60;
}
$cache_enable = ((($cache_expire) && ($item['created'] < datetime_convert('UTC','UTC', 'now - ' . $cache_expire . ' days'))) ? false : true);
2020-05-07 05:01:48 +00:00
$s = bbcode($item['body']);
2020-08-17 04:55:59 +00:00
$s = sslify($s, $cache_enable);
2019-01-29 23:18:35 +00:00
}
}