mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-10-21 18:54:39 -04:00
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>
This commit is contained in:
1 parent
643a31558c
commit
df86cbb361
1 file changed
+8
-2
+8
-2
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user