mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-24 16:25:00 -04:00
Permet de configurer plus finement le nombre d’articles minimum à conserver par flux
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
* Améliorations partage vers Shaarli, Poche, Diaspora*, Facebook, Twitter, Google+, courriel
|
||||
* Permet la suppression de tous les articles d’un flux
|
||||
* Option pour marquer les articles comme lus dès la réception
|
||||
* Permet de configurer plus finement le nombre d’articles minimum à conserver par flux
|
||||
* Permet de modifier la description et l’adresse d’un flux RSS ainsi que le site Web associé
|
||||
* Nouveau raccourci pour ouvrir/fermer un article (‘c’ par défaut)
|
||||
* Bouton pour effacer les logs
|
||||
|
||||
@@ -102,14 +102,11 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
$feedDAO->beginTransaction ();
|
||||
// on ajoute les articles en masse sans vérification
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry->date (true) >= $date_min ||
|
||||
$feed->keepHistory ()) {
|
||||
$values = $entry->toArray ();
|
||||
$values['id_feed'] = $feed->id ();
|
||||
$values['id'] = min(time(), $entry->date (true)) . uSecString();
|
||||
$values['is_read'] = $is_read;
|
||||
$entryDAO->addEntry ($values);
|
||||
}
|
||||
$values = $entry->toArray ();
|
||||
$values['id_feed'] = $feed->id ();
|
||||
$values['id'] = min(time(), $entry->date (true)) . uSecString();
|
||||
$values['is_read'] = $is_read;
|
||||
$entryDAO->addEntry ($values);
|
||||
}
|
||||
$feedDAO->updateLastUpdate ($feed->id ());
|
||||
$feedDAO->commit ();
|
||||
@@ -217,8 +214,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
$feedDAO->beginTransaction ();
|
||||
foreach ($entries as $entry) {
|
||||
if ((!isset ($existingGuids[$entry->guid ()])) &&
|
||||
($entry->date (true) >= $date_min ||
|
||||
$feed->keepHistory ())) {
|
||||
($entry->date (true) >= $date_min)) {
|
||||
$values = $entry->toArray ();
|
||||
//Use declared date at first import, otherwise use discovery date
|
||||
$values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . uSecString() : uTimeString();
|
||||
@@ -227,8 +223,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
|
||||
}
|
||||
}
|
||||
|
||||
if ((!$feed->keepHistory()) && (rand(0, 30) === 1)) {
|
||||
$nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, count($entries) + 10);
|
||||
if (($feed->keepHistory() >= 0) && (rand(0, 30) === 1)) {
|
||||
$nb = $feedDAO->cleanOldEntries ($feed->id (), $date_min, max($feed->keepHistory(), count($entries) + 10));
|
||||
if ($nb > 0) {
|
||||
Minz_Log::record ($nb . ' old entries cleaned in feed ' . $feed->id (), Minz_Log::DEBUG);
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
|
||||
$where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' ';
|
||||
}
|
||||
if (($date_min > 0) && ($type !== 's')) {
|
||||
$where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history = 1) ';
|
||||
$where .= 'AND (e1.id >= ' . $date_min . '000000 OR e1.is_favorite = 1 OR f.keep_history <> 0) ';
|
||||
$joinFeed = true;
|
||||
}
|
||||
$search = '';
|
||||
|
||||
@@ -15,7 +15,7 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
private $pathEntries = '';
|
||||
private $httpAuth = '';
|
||||
private $error = false;
|
||||
private $keep_history = false;
|
||||
private $keep_history = 0;
|
||||
|
||||
public function __construct ($url, $validate=true) {
|
||||
if ($validate) {
|
||||
@@ -163,19 +163,12 @@ class FreshRSS_Feed extends Minz_Model {
|
||||
$this->httpAuth = $value;
|
||||
}
|
||||
public function _error ($value) {
|
||||
if ($value) {
|
||||
$value = true;
|
||||
} else {
|
||||
$value = false;
|
||||
}
|
||||
$this->error = $value;
|
||||
$this->error = (bool)$value;
|
||||
}
|
||||
public function _keepHistory ($value) {
|
||||
if ($value) {
|
||||
$value = true;
|
||||
} else {
|
||||
$value = false;
|
||||
}
|
||||
$value = intval($value);
|
||||
$value = min($value, 1000000);
|
||||
$value = max($value, -1);
|
||||
$this->keep_history = $value;
|
||||
}
|
||||
public function _nbNotRead ($value) {
|
||||
|
||||
@@ -193,7 +193,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
|
||||
}
|
||||
|
||||
public function listFeedsOrderUpdate () {
|
||||
$sql = 'SELECT * FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate';
|
||||
$sql = 'SELECT id, url, pathEntries, httpAuth, keep_history FROM `' . $this->prefix . 'feed` ORDER BY lastUpdate';
|
||||
$stm = $this->bd->prepare ($sql);
|
||||
$stm->execute ();
|
||||
|
||||
@@ -326,7 +326,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {
|
||||
$myFeed->_pathEntries (isset($dao['pathEntries']) ? $dao['pathEntries'] : '');
|
||||
$myFeed->_httpAuth (isset($dao['httpAuth']) ? base64_decode ($dao['httpAuth']) : '');
|
||||
$myFeed->_error ($dao['error']);
|
||||
$myFeed->_keepHistory (isset($dao['keep_history']) ? $dao['keep_history'] : '');
|
||||
$myFeed->_keepHistory (isset($dao['keep_history']) ? $dao['keep_history'] : 0);
|
||||
$myFeed->_nbNotRead ($dao['cache_nbUnreads']);
|
||||
$myFeed->_nbEntries ($dao['cache_nbEntries']);
|
||||
if (isset ($dao['id'])) {
|
||||
|
||||
@@ -137,7 +137,8 @@ return array (
|
||||
'feed_url' => 'Feed URL',
|
||||
'articles' => 'articles',
|
||||
'number_articles' => 'Number of articles',
|
||||
'keep_history' => 'Keep old articles?',
|
||||
'keep_history' => 'Minimum number of articles to keep',
|
||||
'keep_history_help' => 'Set to -1 to keep everything',
|
||||
'categorize' => 'Store in a category',
|
||||
'truncate' => 'Delete all articles',
|
||||
'advanced' => 'Advanced',
|
||||
@@ -157,13 +158,15 @@ return array (
|
||||
|
||||
'general_configuration' => 'General configuration',
|
||||
'language' => 'Language',
|
||||
'delete_articles_every' => 'Remove articles after',
|
||||
'month' => 'months',
|
||||
'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)',
|
||||
'persona_connection_email' => 'Login mail address (use <a href="https://persona.org/">Mozilla Persona</a>)',
|
||||
'allow_anonymous' => 'Allow anonymous reading',
|
||||
'auth_token' => 'Authentication token',
|
||||
'explain_token' => 'Allows to access RSS output without authentication.<br />%s?token=%s',
|
||||
'archiving_configuration' => 'Archiving configuration',
|
||||
'delete_articles_every' => 'Remove articles after',
|
||||
'archiving_configuration_help' => 'More options are available in the individual stream settings',
|
||||
'reading_configuration' => 'Reading configuration',
|
||||
'articles_per_page' => 'Number of articles per page',
|
||||
'default_view' => 'Default view',
|
||||
|
||||
@@ -137,7 +137,8 @@ return array (
|
||||
'feed_url' => 'URL du flux',
|
||||
'articles' => 'articles',
|
||||
'number_articles' => 'Nombre d’articles',
|
||||
'keep_history' => 'Garder les vieux articles ?',
|
||||
'keep_history' => 'Nombre minimum d’articles à conserver',
|
||||
'keep_history_help' => 'Mettre à -1 pour tout conserver',
|
||||
'categorize' => 'Ranger dans une catégorie',
|
||||
'truncate' => 'Supprimer tous les articles',
|
||||
'advanced' => 'Avancé',
|
||||
@@ -157,13 +158,16 @@ return array (
|
||||
|
||||
'general_configuration' => 'Configuration générale',
|
||||
'language' => 'Langue',
|
||||
'delete_articles_every' => 'Supprimer les articles après',
|
||||
|
||||
'month' => 'mois',
|
||||
'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)',
|
||||
'persona_connection_email' => 'Adresse courriel de connexion (utilise <a href="https://persona.org/">Mozilla Persona</a>)',
|
||||
'allow_anonymous' => 'Autoriser la lecture anonyme',
|
||||
'auth_token' => 'Jeton d’identification',
|
||||
'explain_token' => 'Permet d’accéder à la sortie RSS sans besoin de s’authentifier.<br />%s?output=rss&token=%s',
|
||||
'archiving_configuration' => 'Configuration de l’archivage',
|
||||
'delete_articles_every' => 'Supprimer les articles après',
|
||||
'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux',
|
||||
'reading_configuration' => 'Configuration de lecture',
|
||||
'articles_per_page' => 'Nombre d’articles par page',
|
||||
'default_view' => 'Vue par défaut',
|
||||
|
||||
@@ -31,13 +31,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="old_entries"><?php echo Minz_Translate::t ('delete_articles_every'); ?></label>
|
||||
<div class="group-controls">
|
||||
<input type="number" id="old_entries" name="old_entries" value="<?php echo $this->conf->oldEntries (); ?>" /> <?php echo Minz_Translate::t ('month'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="mail_login"><?php echo Minz_Translate::t ('persona_connection_email'); ?></label>
|
||||
<?php $mail = $this->conf->mailLogin (); ?>
|
||||
@@ -59,7 +52,27 @@
|
||||
<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('explain_token', Minz_Url::display(null, 'html', true), $token); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<legend><?php echo Minz_Translate::t ('archiving_configuration'); ?></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="old_entries"><?php echo Minz_Translate::t ('delete_articles_every'); ?></label>
|
||||
<div class="group-controls">
|
||||
<input type="number" id="old_entries" name="old_entries" list="list_months" min="1" max="1200" value="<?php echo $this->conf->oldEntries (); ?>" /> <?php echo Minz_Translate::t ('month'); ?>
|
||||
<datalist id="list_months">
|
||||
<option>1</option>
|
||||
<option>2</option>
|
||||
<option>3</option>
|
||||
<option>6</option>
|
||||
<option>12</option>
|
||||
<option>18</option>
|
||||
<option>24</option>
|
||||
<option>36</option>
|
||||
</datalist><br />
|
||||
<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t('archiving_configuration_help'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<legend><?php echo Minz_Translate::t ('reading_configuration'); ?></legend>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<legend><?php echo Minz_Translate::t ('archiving_configuration'); ?></legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="group-name"></label>
|
||||
<div class="group-controls">
|
||||
@@ -64,10 +67,21 @@
|
||||
<label class="group-name"><?php echo Minz_Translate::t ('number_articles'); ?></label>
|
||||
<div class="group-controls">
|
||||
<span class="control"><?php echo $this->flux->nbEntries (); ?></span>
|
||||
<label class="checkbox" for="keep_history">
|
||||
<input type="checkbox" name="keep_history" id="keep_history" value="yes"<?php echo $this->flux->keepHistory () == 'yes' ? ' checked="checked"' : ''; ?> />
|
||||
<?php echo Minz_Translate::t ('keep_history'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="group-name" for="keep_history"><?php echo Minz_Translate::t ('keep_history'); ?></label>
|
||||
<div class="group-controls">
|
||||
<input type="number" name="keep_history" id="keep_history" list="old_values" min="-1" max="1000000" value="<?php echo $this->flux->keepHistory(); ?>" />
|
||||
<datalist id="old_values">
|
||||
<option value="0">0</option>
|
||||
<option value="10">10</option>
|
||||
<option value="100">100</option>
|
||||
<option value="1000">1 000</option>
|
||||
<option value="10000">10 000</option>
|
||||
<option value="-1">∞</option>
|
||||
</datalist>
|
||||
<?php echo FreshRSS_Themes::icon('help'); ?> <?php echo Minz_Translate::t ('keep_history_help'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -93,7 +93,7 @@ FROM `%1$scategory006`
|
||||
ORDER BY id2;
|
||||
|
||||
INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history)
|
||||
SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, keep_history
|
||||
SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, -1 * keep_history
|
||||
FROM `%1$sfeed006`
|
||||
ORDER BY id2;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user