aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Feed.php
diff options
context:
space:
mode:
authorGravatar Patrick Hyatt <patrickhyatt@duck.com> 2024-11-01 11:22:54 -0400
committerGravatar GitHub <noreply@github.com> 2024-11-01 16:22:54 +0100
commitdf86cbb361e480dbe50b1dc52025c880f170f6b2 (patch)
tree7defeac7710d6694f0c6cbf21a55bc118da45d5a /app/Models/Feed.php
parent643a31558cf926ff8d2601f779be3a56b9e40192 (diff)
Rebuild Feed .ico and .txt on cache clear (#6961)
* - Modify Feed.faviconPrepare signature to allow forced retrieval of the favicon - Add faviconRebuild which clears file cache and re-retrieves icons - Call faviconRebuild when clearCache is fired * Update app/Models/Feed.php * - PHPStan fix : Use static method call vs dynamic --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Models/Feed.php')
-rw-r--r--app/Models/Feed.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/Models/Feed.php b/app/Models/Feed.php
index b5b599d5f..03c7cdd74 100644
--- a/app/Models/Feed.php
+++ b/app/Models/Feed.php
@@ -225,7 +225,7 @@ class FreshRSS_Feed extends Minz_Model {
return $this->nbNotRead;
}
- public function faviconPrepare(): void {
+ public function faviconPrepare(bool $force = false): void {
require_once(LIB_PATH . '/favicons.php');
$url = $this->website;
if ($url == '') {
@@ -235,7 +235,7 @@ class FreshRSS_Feed extends Minz_Model {
if (@file_get_contents($txt) !== $url) {
file_put_contents($txt, $url);
}
- if (FreshRSS_Context::$isCli) {
+ if (FreshRSS_Context::$isCli || $force) {
$ico = FAVICONS_DIR . $this->hash() . '.ico';
$ico_mtime = @filemtime($ico);
$txt_mtime = @filemtime($txt);
@@ -1006,7 +1006,13 @@ class FreshRSS_Feed extends Minz_Model {
}
}
+ private function faviconRebuild(): void {
+ FreshRSS_Feed::faviconDelete($this->hash());
+ $this->faviconPrepare(true);
+ }
+
public function clearCache(): bool {
+ $this->faviconRebuild();
return @unlink($this->cacheFilename());
}