2020-03-26 00:48:27 +00:00
|
|
|
<?php
|
2019-01-29 23:18:35 +00:00
|
|
|
|
|
|
|
namespace Zotlabs\Daemon;
|
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
class Cache_embeds
|
|
|
|
{
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
public static function run($argc, $argv)
|
|
|
|
{
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
if (! $argc == 2) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$c = q(
|
|
|
|
"select body, html, created from item where id = %d ",
|
|
|
|
dbesc(intval($argv[1]))
|
|
|
|
);
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
if (! $c) {
|
|
|
|
return;
|
|
|
|
}
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$item = array_shift($c);
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +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);
|
2019-01-29 23:18:35 +00:00
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
$s = bbcode($item['body']);
|
|
|
|
$s = sslify($s, $cache_enable);
|
|
|
|
}
|
2019-01-29 23:18:35 +00:00
|
|
|
}
|