aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-05-19 21:30:40 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-19 21:30:40 +0200
commitf5aaf5f46076e0ac11ab52ef2ea940fd789ff174 (patch)
treedce366428ef809022d62eee3dd6601083ffa2e0c
parentc1eae578986d5e0d1d9dc8ad1c35e03d8d6f4986 (diff)
New limit option when reloading a feed (#4370)
-rwxr-xr-xapp/Controllers/feedController.php6
-rw-r--r--app/i18n/cz/sub.php2
-rw-r--r--app/i18n/de/sub.php2
-rw-r--r--app/i18n/en-us/sub.php2
-rw-r--r--app/i18n/en/sub.php2
-rwxr-xr-xapp/i18n/es/sub.php2
-rw-r--r--app/i18n/fr/sub.php2
-rw-r--r--app/i18n/he/sub.php2
-rw-r--r--app/i18n/it/sub.php2
-rw-r--r--app/i18n/ja/sub.php2
-rw-r--r--app/i18n/ko/sub.php2
-rw-r--r--app/i18n/nl/sub.php2
-rw-r--r--app/i18n/oc/sub.php2
-rw-r--r--app/i18n/pl/sub.php2
-rw-r--r--app/i18n/pt-br/sub.php2
-rw-r--r--app/i18n/ru/sub.php2
-rw-r--r--app/i18n/sk/sub.php2
-rw-r--r--app/i18n/tr/sub.php2
-rw-r--r--app/i18n/zh-cn/sub.php2
-rw-r--r--app/views/helpers/feed/update.phtml34
-rw-r--r--p/scripts/extra.js11
-rw-r--r--p/scripts/feed.js4
22 files changed, 53 insertions, 38 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 4788f9639..49383342e 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -814,7 +814,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
@set_time_limit(300);
//Get Feed ID.
- $feed_id = Minz_Request::param('id');
+ $feed_id = intval(Minz_Request::param('id', 0));
+ $limit = intval(Minz_Request::param('reload_limit', 10));
$feedDAO = FreshRSS_Factory::createFeedDao();
$entryDAO = FreshRSS_Factory::createEntryDao();
@@ -831,8 +832,7 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController {
self::actualizeFeed($feed_id, '', false);
//Extract all feed entries from database, load complete content and store them back in database.
- $entries = $entryDAO->listWhere('f', $feed_id, FreshRSS_Entry::STATE_ALL, 'DESC', 0);
- //TODO: Parameter to limit the number of articles to reload
+ $entries = $entryDAO->listWhere('f', $feed_id, FreshRSS_Entry::STATE_ALL, 'DESC', $limit);
//We need another DB connection in parallel for unbuffered streaming
Minz_ModelPdo::$usesSharedPdo = false;
diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php
index 2eff49030..7efc2ab99 100644
--- a/app/i18n/cz/sub.php
+++ b/app/i18n/cz/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Vymazat mezipaměť',
'clear_cache_help' => 'Vymazat mezipaměť pro tento kanál.',
'reload_articles' => 'Znovu načíst články',
- 'reload_articles_help' => 'Znovu načíst články a získat úplný obsah, pokud je definován přepínač.',
+ 'reload_articles_help' => 'Znovu načíst články a získat úplný obsah, pokud je definován přepínač.', // DIRTY
'title' => 'Údržba',
),
'moved_category_deleted' => 'Když odstraníte kategorii, její kanály jsou automaticky přesunuty do <em>%s</em>.',
diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php
index 52323221d..7eba536da 100644
--- a/app/i18n/de/sub.php
+++ b/app/i18n/de/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Zwischenspeicher leeren',
'clear_cache_help' => 'Zwischenspeicher für diesen Feed leeren.',
'reload_articles' => 'Artikel neuladen',
- 'reload_articles_help' => 'Artikel neuladen und komplette Inhalte holen, wenn ein Selektor festgelegt wurde.',
+ 'reload_articles_help' => 'Artikel neuladen und komplette Inhalte holen, wenn ein Selektor festgelegt wurde.', // DIRTY
'title' => 'Wartung',
),
'moved_category_deleted' => 'Wenn Sie eine Kategorie entfernen, werden deren Feeds automatisch in die Kategorie <em>%s</em> eingefügt.',
diff --git a/app/i18n/en-us/sub.php b/app/i18n/en-us/sub.php
index 41b8c377b..69853e8cb 100644
--- a/app/i18n/en-us/sub.php
+++ b/app/i18n/en-us/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Clear cache', // IGNORE
'clear_cache_help' => 'Clear the cache for this feed.', // IGNORE
'reload_articles' => 'Reload articles', // IGNORE
- 'reload_articles_help' => 'Reload articles and fetch complete content if a selector is defined.', // IGNORE
+ 'reload_articles_help' => 'Reload that many articles and fetch complete content if a selector is defined.', // IGNORE
'title' => 'Maintenance', // IGNORE
),
'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.', // IGNORE
diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php
index 902deb1b5..697f5facc 100644
--- a/app/i18n/en/sub.php
+++ b/app/i18n/en/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Clear cache',
'clear_cache_help' => 'Clear the cache for this feed.',
'reload_articles' => 'Reload articles',
- 'reload_articles_help' => 'Reload articles and fetch complete content if a selector is defined.',
+ 'reload_articles_help' => 'Reload that many articles and fetch complete content if a selector is defined.',
'title' => 'Maintenance',
),
'moved_category_deleted' => 'When you delete a category, its feeds are automatically classified under <em>%s</em>.',
diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php
index f55e0cbbb..d53e6b2da 100755
--- a/app/i18n/es/sub.php
+++ b/app/i18n/es/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Borrar caché',
'clear_cache_help' => 'Borrar la memoria caché de esta fuente.',
'reload_articles' => 'Recargar artículos',
- 'reload_articles_help' => 'Vuelva a cargar artículos y obtenga contenido completo si se define un selector.',
+ 'reload_articles_help' => 'Vuelva a cargar artículos y obtenga contenido completo si se define un selector.', // DIRTY
'title' => 'Mantenimiento',
),
'moved_category_deleted' => 'Al borrar una categoría todas sus fuentes pasan automáticamente a la categoría <em>%s</em>.',
diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php
index c8528504a..461c8abdd 100644
--- a/app/i18n/fr/sub.php
+++ b/app/i18n/fr/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Vider le cache',
'clear_cache_help' => 'Supprime le cache de ce flux.',
'reload_articles' => 'Recharger les articles',
- 'reload_articles_help' => 'Recharge les articles et récupère le contenu complet si un sélecteur est défini.',
+ 'reload_articles_help' => 'Recharge cette quantité d’articles et récupère le contenu complet si un sélecteur est défini.',
'title' => 'Maintenance', // IGNORE
),
'moved_category_deleted' => 'Lors de la suppression d’une catégorie, ses flux seront automatiquement classés dans <em>%s</em>.',
diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php
index 6068a63c0..063a5da99 100644
--- a/app/i18n/he/sub.php
+++ b/app/i18n/he/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Clear cache', // TODO
'clear_cache_help' => 'Clear the cache for this feed.', // TODO
'reload_articles' => 'Reload articles', // TODO
- 'reload_articles_help' => 'Reload articles and fetch complete content if a selector is defined.', // TODO
+ 'reload_articles_help' => 'Reload that many articles and fetch complete content if a selector is defined.', // TODO
'title' => 'Maintenance', // TODO
),
'moved_category_deleted' => 'כאשר הקטגוריה נמחקת ההזנות שבתוכה אוטומטית מקוטלגות תחת <em>%s</em>.',
diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php
index cab35180e..9ffaae80b 100644
--- a/app/i18n/it/sub.php
+++ b/app/i18n/it/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Clear cache', // TODO
'clear_cache_help' => 'Clear the cache for this feed.', // TODO
'reload_articles' => 'Reload articles', // TODO
- 'reload_articles_help' => 'Reload articles and fetch complete content if a selector is defined.', // TODO
+ 'reload_articles_help' => 'Reload that many articles and fetch complete content if a selector is defined.', // TODO
'title' => 'Maintenance', // TODO
),
'moved_category_deleted' => 'Cancellando una categoria i feed al suo interno verranno classificati automaticamente come <em>%s</em>.',
diff --git a/app/i18n/ja/sub.php b/app/i18n/ja/sub.php
index ba7fa23b1..273274d54 100644
--- a/app/i18n/ja/sub.php
+++ b/app/i18n/ja/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'キャッシュのクリア',
'clear_cache_help' => 'このフィードのキャッシュをクリアします。',
'reload_articles' => '記事を再読み込みする',
- 'reload_articles_help' => '記事を再読み込みして、セレクターが定義したコンテンツを完全に取得します。',
+ 'reload_articles_help' => '記事を再読み込みして、セレクターが定義したコンテンツを完全に取得します。', // DIRTY
'title' => 'メンテナンス',
),
'moved_category_deleted' => 'カテゴリを削除したとき、フィードは自動的に<em>%s</em>下に分類されます。',
diff --git a/app/i18n/ko/sub.php b/app/i18n/ko/sub.php
index ff9af8c39..ae048244a 100644
--- a/app/i18n/ko/sub.php
+++ b/app/i18n/ko/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => '캐쉬 지우기',
'clear_cache_help' => '이 피드의 캐쉬 지우기.',
'reload_articles' => '글 다시 로드',
- 'reload_articles_help' => '글 다시 로드하고 셀렉터가 정의 되었을 경우에 모든 컨텐츠 가져오기.',
+ 'reload_articles_help' => '글 다시 로드하고 셀렉터가 정의 되었을 경우에 모든 컨텐츠 가져오기.', // DIRTY
'title' => '유지 보수',
),
'moved_category_deleted' => '카테고리를 삭제하면, 해당 카테고리 아래에 있던 피드들은 자동적으로 <em>%s</em> 아래로 분류됩니다.',
diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php
index b8439f0b5..10d158852 100644
--- a/app/i18n/nl/sub.php
+++ b/app/i18n/nl/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Cache leegmaken',
'clear_cache_help' => 'Cache voor deze feed leegmaken.',
'reload_articles' => 'Artikels herladen',
- 'reload_articles_help' => 'Artikels herladen en complete inhoud ophalen als een selector is gedefinieerd.',
+ 'reload_articles_help' => 'Artikels herladen en complete inhoud ophalen als een selector is gedefinieerd.', // DIRTY
'title' => 'Onderhoud',
),
'moved_category_deleted' => 'Als u een categorie verwijderd, worden de feeds automatisch geclassificeerd onder <em>%s</em>.',
diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.php
index 5cc7c792a..2f36d5889 100644
--- a/app/i18n/oc/sub.php
+++ b/app/i18n/oc/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Escafar lo cache',
'clear_cache_help' => 'Escafar lo cache d’aqueste flux sul disc',
'reload_articles' => 'Recargar los articles',
- 'reload_articles_help' => 'Recargar los articles e recuperar lo contengut complet',
+ 'reload_articles_help' => 'Recargar los articles e recuperar lo contengut complet', // DIRTY
'title' => 'Mantenença',
),
'moved_category_deleted' => 'Quand escafatz una categoria, sos fluxes son automaticament classats dins <em>%s</em>.',
diff --git a/app/i18n/pl/sub.php b/app/i18n/pl/sub.php
index 204d9ffef..103d0500e 100644
--- a/app/i18n/pl/sub.php
+++ b/app/i18n/pl/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Wyczyść pamięć podręczną',
'clear_cache_help' => 'Czyści pamięć podręczną tego kanału.',
'reload_articles' => 'Przeładuj wiadomości',
- 'reload_articles_help' => 'Ponownie pobiera wiadomości i przetwarza treść ze strony pierwotnej, jeżeli zdefiniowany został selektor CSS.',
+ 'reload_articles_help' => 'Ponownie pobiera wiadomości i przetwarza treść ze strony pierwotnej, jeżeli zdefiniowany został selektor CSS.', // DIRTY
'title' => 'Konserwacja',
),
'moved_category_deleted' => 'Po usunięciu kategorii znajdujące się w niej kanały zostaną automatycznie przeniesione do <em>%s</em>.',
diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php
index 25d76ad9f..3d6f86147 100644
--- a/app/i18n/pt-br/sub.php
+++ b/app/i18n/pt-br/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Limpar o cache',
'clear_cache_help' => 'Limpar o cache em disco deste feed',
'reload_articles' => 'Recarregar artigos',
- 'reload_articles_help' => 'Recarregar artigos e buscar conteúdo completo',
+ 'reload_articles_help' => 'Recarregar artigos e buscar conteúdo completo', // DIRTY
'title' => 'Manutenção',
),
'moved_category_deleted' => 'Quando você deleta uma categoria, seus feeds são automaticamente classificados como <em>%s</em>.',
diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php
index 1be761ab6..623c354f9 100644
--- a/app/i18n/ru/sub.php
+++ b/app/i18n/ru/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Очистить кэш',
'clear_cache_help' => 'Очистить кэш для этой ленты.',
'reload_articles' => 'Снова загрузить статьи',
- 'reload_articles_help' => 'Снова загрузить статьи и извлечь полное содержимое, если задан селектор.',
+ 'reload_articles_help' => 'Снова загрузить статьи и извлечь полное содержимое, если задан селектор.', // DIRTY
'title' => 'Обслуживание',
),
'moved_category_deleted' => 'Когда вы удаляете категорию, ленты категории автоматически попадают в категорию <em>%s</em>.',
diff --git a/app/i18n/sk/sub.php b/app/i18n/sk/sub.php
index ef6e037fb..8a5ede475 100644
--- a/app/i18n/sk/sub.php
+++ b/app/i18n/sk/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Vymazať vyrovnáciu pamäť',
'clear_cache_help' => 'Vymazať vyrovnáciu pamäť pre tento kanál.',
'reload_articles' => 'Obnoviť články',
- 'reload_articles_help' => 'Obnoviť články a stiahnuť kompletný obsah, ak je definovaný selektor.',
+ 'reload_articles_help' => 'Obnoviť články a stiahnuť kompletný obsah, ak je definovaný selektor.', // DIRTY
'title' => 'Údržba',
),
'moved_category_deleted' => 'Keď vymažete kategóriu, jej kanály sa automaticky zaradia pod <em>%s</em>.',
diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php
index e9f58f895..c883a6caa 100644
--- a/app/i18n/tr/sub.php
+++ b/app/i18n/tr/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => 'Önbelleği temizle',
'clear_cache_help' => 'Bu akışın önbelleğini temizler.',
'reload_articles' => 'Makaleleri yeniden yükle',
- 'reload_articles_help' => 'Reload articles and fetch complete content if a selector is defined.', // TODO
+ 'reload_articles_help' => 'Reload that many articles and fetch complete content if a selector is defined.', // TODO
'title' => 'Bakım',
),
'moved_category_deleted' => 'Bir kategoriyi silerseniz, içerisindeki akışlar <em>%s</em> içerisine yerleşir.',
diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php
index a1bb7e0d4..82b660c79 100644
--- a/app/i18n/zh-cn/sub.php
+++ b/app/i18n/zh-cn/sub.php
@@ -108,7 +108,7 @@ return array(
'clear_cache' => '清理缓存',
'clear_cache_help' => '清除该feed的缓存',
'reload_articles' => '重载文章',
- 'reload_articles_help' => '重新加载文章并获取完整内容',
+ 'reload_articles_help' => '重新加载文章并获取完整内容', // DIRTY
'title' => '维护',
),
'moved_category_deleted' => '删除分类时,其中的订阅源会自动归类到 <em>%s</em>',
diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml
index da4e04e50..9764b3f47 100644
--- a/app/views/helpers/feed/update.phtml
+++ b/app/views/helpers/feed/update.phtml
@@ -478,7 +478,7 @@
<div class="group-controls">
<div class="stick w100">
<input type="text" name="path_entries" id="path_entries" class="w100" value="<?= $this->feed->pathEntries() ?>"
- placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
+ data-leave-validation="<?= $this->feed->pathEntries() ?>" placeholder="<?= _t('gen.short.blank_to_disable') ?>" />
<a id="popup-preview-selector" class="btn" href="<?=
_url('feed', 'contentSelectorPreview', 'id', $this->feed->id(), 'selector', 'selector-token') ?>"><?= _i('look') ?></a>
</div>
@@ -573,23 +573,29 @@
<button type="reset" class="btn"><?= _t('gen.action.cancel') ?></button>
</div>
</div>
+ </form>
- <legend><?= _t('sub.feed.maintenance.title') ?></legend>
- <div class="form-group">
- <div class="group-controls">
- <a class="btn btn-important" href="<?= _url('feed', 'clearCache', 'id', $this->feed->id()) ?>">
- <?= _t('sub.feed.maintenance.clear_cache') ?>
- </a>
- <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
- </div>
- <div class="group-controls">
- <a class="btn btn-important" href="<?= _url('feed', 'reload', 'id', $this->feed->id()) ?>">
+ <legend><?= _t('sub.feed.maintenance.title') ?></legend>
+ <div class="form-group">
+ <div class="group-controls">
+ <a class="btn btn-important" href="<?= _url('feed', 'clearCache', 'id', $this->feed->id()) ?>">
+ <?= _t('sub.feed.maintenance.clear_cache') ?>
+ </a>
+ <p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.clear_cache_help') ?></p>
+ </div>
+ <div class="group-controls">
+ <form method="post" action="<?= _url('feed', 'reload') ?>">
+ <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
+ <input type="hidden" name="id" value="<?= $this->feed->id() ?>" />
+ <button type="submit" class="btn btn-important">
<?= _t('sub.feed.maintenance.reload_articles') ?>
- </a>
+ </button>
+ <input type="number" name="reload_limit" min="1" value="10" />
<p class="help"><?= _i('help') ?> <?= _t('sub.feed.maintenance.reload_articles_help') ?></p>
- </div>
+ </form>
</div>
- </form>
+ </div>
+
</div>
<div id="popup">
diff --git a/p/scripts/extra.js b/p/scripts/extra.js
index e20fe821c..a95eb620d 100644
--- a/p/scripts/extra.js
+++ b/p/scripts/extra.js
@@ -233,11 +233,18 @@ function init_select_observers() {
});
}
-function data_leave_validation(parent) {
+/**
+ * Returns true when no input element is changed, false otherwise.
+ * When excludeForm is defined, will only report changes outside the specified form.
+ */
+function data_leave_validation(parent, excludeForm = null) {
const ds = parent.querySelectorAll('[data-leave-validation]');
for (let i = ds.length - 1; i >= 0; i--) {
const input = ds[i];
+ if (excludeForm && excludeForm === input.form) {
+ continue;
+ }
if (input.type === 'checkbox' || input.type === 'radio') {
if (input.checked != input.getAttribute('data-leave-validation')) {
return false;
@@ -251,7 +258,7 @@ function data_leave_validation(parent) {
function init_configuration_alert() {
window.onsubmit = function (e) {
- window.hasSubmit = true;
+ window.hasSubmit = data_leave_validation(document.body, e.submitter ? e.submitter.form : null);
};
window.onbeforeunload = function (e) {
if (window.hasSubmit) {
diff --git a/p/scripts/feed.js b/p/scripts/feed.js
index b206b79d4..2a213b422 100644
--- a/p/scripts/feed.js
+++ b/p/scripts/feed.js
@@ -1,6 +1,6 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
'use strict';
-/* globals init_archiving, init_password_observers, init_slider */
+/* globals init_archiving, init_configuration_alert, init_password_observers, init_slider */
// <popup>
let popup = null;
@@ -134,6 +134,8 @@ function init_feed_afterDOM() {
init_valid_xpath(document.body);
}
+ init_configuration_alert();
+
if (window.console) {
console.log('FreshRSS feed init done.');
}