diff options
| author | 2018-10-17 18:03:50 +0200 | |
|---|---|---|
| committer | 2018-10-17 18:03:50 +0200 | |
| commit | 0aecf442946f7aa618fcc759f79807cd81346dc4 (patch) | |
| tree | 403faeff60c72f61299eba66f2f1701d92be9060 /app | |
| parent | dfff5f21886ed023962aa8087a11222fe3c3f995 (diff) | |
Option to force clear cache (#2052)
https://github.com/FreshRSS/FreshRSS/issues/1020#issuecomment-428515868
Diffstat (limited to 'app')
| -rw-r--r-- | app/Controllers/subscriptionController.php | 1 | ||||
| -rw-r--r-- | app/Models/Feed.php | 14 | ||||
| -rw-r--r-- | app/i18n/cz/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/de/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/en/sub.php | 1 | ||||
| -rwxr-xr-x | app/i18n/es/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/fr/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/he/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/it/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/kr/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/nl/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/pt-br/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/ru/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/tr/sub.php | 1 | ||||
| -rw-r--r-- | app/i18n/zh-cn/sub.php | 1 | ||||
| -rw-r--r-- | app/views/helpers/feed/update.phtml | 7 |
16 files changed, 34 insertions, 1 deletions
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 511cea11b..0b1439ba5 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -98,6 +98,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $feed->_attributes('mark_updated_article_unread', Minz_Request::paramTernary('mark_updated_article_unread')); $feed->_attributes('read_upon_reception', Minz_Request::paramTernary('read_upon_reception')); + $feed->_attributes('clear_cache', Minz_Request::paramTernary('clear_cache')); if (FreshRSS_Auth::hasAccess('admin')) { $feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify')); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index d09577e6e..e1dd2990d 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -286,6 +286,10 @@ class FreshRSS_Feed extends Minz_Model { if (!$loadDetails) { //Only activates auto-discovery when adding a new feed $feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE); } + if ($this->attributes('clear_cache')) { + // Do not use `$simplePie->enable_cache(false);` as it would prevent caching in multiuser context + $this->clearCache(); + } Minz_ExtensionManager::callHook('simplepie_before_init', $feed, $this); $mtime = $feed->init(); @@ -465,8 +469,16 @@ class FreshRSS_Feed extends Minz_Model { $this->entries = $entries; } + protected function cacheFilename() { + return CACHE_PATH . '/' . md5($this->url) . '.spc'; + } + + public function clearCache() { + return @unlink($this->cacheFilename()); + } + public function cacheModifiedTime() { - return @filemtime(CACHE_PATH . '/' . md5($this->url) . '.spc'); + return @filemtime($this->cacheFilename()); } public function lock() { diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php index 5caf9acbe..55441aaf8 100644 --- a/app/i18n/cz/sub.php +++ b/app/i18n/cz/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Heslo', 'username' => 'Přihlašovací jméno', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)', 'css_path' => 'Původní CSS soubor článku z webových stránek', 'description' => 'Popis', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 0ba818c69..ff5c11d2b 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP-Passwort', 'username' => 'HTTP-Nutzername', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Ruft gekürzte RSS-Feeds ab (Achtung, benötigt mehr Zeit!)', 'css_path' => 'Pfad zur CSS-Datei des Artikels auf der Original-Webseite', 'description' => 'Beschreibung', diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 5ff41a4b3..22c7edc30 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password', 'username' => 'HTTP username', ), + 'clear_cache' => 'Always clear cache', 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', 'css_path' => 'Articles CSS path on original website', 'description' => 'Description', diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php index 3abc85578..8a4fb98de 100755 --- a/app/i18n/es/sub.php +++ b/app/i18n/es/sub.php @@ -22,6 +22,7 @@ return array( 'password' => 'Contraseña HTTP', 'username' => 'Nombre de usuario HTTP', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Recibir fuentes RSS truncadas (aviso, ¡necesita más tiempo!)', 'css_path' => 'Ruta a la CSS de los artículos en la web original', 'description' => 'Descripción', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index c6af2fb90..d3921f1d9 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Mot de passe HTTP', 'username' => 'Identifiant HTTP', ), + 'clear_cache' => 'Toujours vider le cache', 'css_help' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', 'css_path' => 'Sélecteur CSS des articles sur le site d’origine', 'description' => 'Description', diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php index a263cd728..711004662 100644 --- a/app/i18n/he/sub.php +++ b/app/i18n/he/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP סיסמה', 'username' => 'HTTP שם משתמש', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'קבלת הזנות RSS קטומות (זהירות, לוקח זמן רב יותר!)', 'css_path' => 'נתיב הCSS של המאמר באתר המקורי', 'description' => 'תיאור', diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php index 22d58a27f..b22340c9b 100644 --- a/app/i18n/it/sub.php +++ b/app/i18n/it/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password', 'username' => 'HTTP username', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)', 'css_path' => 'Percorso del foglio di stile CSS del sito di origine', 'description' => 'Descrizione', diff --git a/app/i18n/kr/sub.php b/app/i18n/kr/sub.php index de200c330..ee6b25e3f 100644 --- a/app/i18n/kr/sub.php +++ b/app/i18n/kr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP 암호', 'username' => 'HTTP 사용자 이름', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => '글의 일부가 포함된 RSS 피드를 가져옵니다 (주의, 시간이 좀 더 걸립니다!)', 'css_path' => '웹사이트 상의 글 본문에 해당하는 CSS 경로', 'description' => '설명', diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php index 4ce254ef5..fec7fb4e7 100644 --- a/app/i18n/nl/sub.php +++ b/app/i18n/nl/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP wachtwoord', 'username' => 'HTTP gebruikers naam', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Haalt verstoorde RSS feeds op (attentie, heeft meer tijd nodig!)', 'css_path' => 'Artikelen CSS pad op originele website', 'description' => 'Omschrijving', diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php index 1b084f08f..daa24e8f3 100644 --- a/app/i18n/pt-br/sub.php +++ b/app/i18n/pt-br/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'Senha HTTP', 'username' => 'Usuário HTTP', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Retorna RSS feeds truncados (atenção, requer mais tempo!)', 'css_path' => 'Caminho do CSS do artigo no site original', 'description' => 'Descrição', diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php index bef49623f..12901998d 100644 --- a/app/i18n/ru/sub.php +++ b/app/i18n/ru/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP password',// TODO 'username' => 'HTTP username',// TODO ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',// TODO 'css_path' => 'Articles CSS path on original website',// TODO 'description' => 'Description',// TODO diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php index e8cd15d0d..ef0c8ffbd 100644 --- a/app/i18n/tr/sub.php +++ b/app/i18n/tr/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP şifre', 'username' => 'HTTP kullanıcı adı', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => 'Dikkat, daha çok zaman gerekir!', 'css_path' => 'Makaleleri kendi CSS görünümü ile göster', 'description' => 'Tanım', diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php index 034f8a9d9..4980b803a 100644 --- a/app/i18n/zh-cn/sub.php +++ b/app/i18n/zh-cn/sub.php @@ -27,6 +27,7 @@ return array( 'password' => 'HTTP 密码', 'username' => 'HTTP 用户名', ), + 'clear_cache' => 'Always clear cache', //TODO 'css_help' => '用于获取全文(注意,这将耗费更多时间!)', 'css_path' => '原文的 CSS 选择器', 'description' => '描述', diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 7144aab46..4dbaacd04 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -205,6 +205,13 @@ </div> </div> + <div class="form-group"> + <label class="group-name" for="clear_cache"><?php echo _t('sub.feed.clear_cache'); ?></label> + <div class="group-controls"> + <input type="checkbox" name="clear_cache" id="clear_cache" value="1"<?php echo $this->feed->attributes('clear_cache') ? ' checked="checked"' : ''; ?> /> + </div> + </div> + <?php if (FreshRSS_Auth::hasAccess('admin')) { ?> <div class="form-group"> <label class="group-name" for="timeout"><?php echo _t('sub.feed.timeout'); ?></label> |
