cache_starred_images: minor fixes

This commit is contained in:
Andrew Dolgov 2021-02-17 16:17:05 +03:00
parent ea37d05a83
commit 6ecee2abbd
1 changed files with 28 additions and 25 deletions

View File

@ -59,7 +59,7 @@ class Cache_Starred_Images extends Plugin {
$success = $this->cache_article_images($line["content"], $line["site_url"], $line["owner_uid"], $line["id"]);
if ($success) {
$plugin_data = "starred_cache_images,${line['owner_uid']}:" . $line["plugin_data"];
$plugin_data = "starred_cache_images," . $line["owner_uid"] . ":" . $line["plugin_data"];
$usth->execute([$plugin_data, $line['id']]);
}
@ -71,7 +71,10 @@ class Cache_Starred_Images extends Plugin {
Debug::log("expiring " . $this->cache->get_dir() . "...");
$files = glob($this->cache->get_dir() . "/*.{png,mp4,status}", GLOB_BRACE);
$files = array_merge(
glob($this->cache->get_dir() . "/*.png"),
glob($this->cache->get_dir() . "/*.mp4"),
glob($this->cache->get_dir() . "/*.status"));
$last_article_id = 0;
$article_exists = 1;
@ -105,7 +108,7 @@ class Cache_Starred_Images extends Plugin {
}
function hook_sanitize($doc, $site_url, $allowed_elements, $disallowed_attributes, $article_id) {
$xpath = new DOMXpath($doc);
$xpath = new DOMXPath($doc);
if ($article_id) {
$entries = $xpath->query('(//img[@src])|(//video/source[@src])');