Merge branch 'nocontent' of git://github.com/doubleface/miniflux
This commit is contained in:
commit
e93517274f
@ -135,6 +135,10 @@ label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.inline-label {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
input {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ require 'schema.php';
|
||||
require 'model.php';
|
||||
|
||||
|
||||
const DB_VERSION = 6;
|
||||
const DB_VERSION = 7;
|
||||
const APP_VERSION = 'master';
|
||||
const APP_USERAGENT = 'Miniflux - http://miniflux.net';
|
||||
const HTTP_TIMEOUT = 5;
|
||||
@ -38,4 +38,4 @@ PicoTools\container('db', function() {
|
||||
|
||||
die('Unable to migrate database schema.');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -361,7 +361,7 @@ Router\get_action('config', function() {
|
||||
|
||||
Router\post_action('config', function() {
|
||||
|
||||
$values = Request\values();
|
||||
$values = Request\values() + array('nocontent' => 0);
|
||||
list($valid, $errors) = Model\validate_config_update($values);
|
||||
|
||||
if ($valid) {
|
||||
@ -404,4 +404,4 @@ Router\notfound(function() {
|
||||
'items' => $items,
|
||||
'menu' => 'unread'
|
||||
)));
|
||||
});
|
||||
});
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
'Do not fetch the content of articles (and remove it content for previous entries)' =>
|
||||
'Ne pas récupérer le contenu des articles (et supprimer ce contenu pour les articles précédents',
|
||||
'Remove automatically read items' => 'Supprimer automatiquement les éléments lus',
|
||||
'Never' => 'Jamais',
|
||||
'After %d day' => 'Après %d jour',
|
||||
|
13
model.php
13
model.php
@ -137,7 +137,6 @@ function update_feeds($limit = LIMIT_ALL)
|
||||
$feeds_id = get_feeds_id($limit);
|
||||
|
||||
foreach ($feeds_id as $feed_id) {
|
||||
|
||||
update_feed($feed_id);
|
||||
}
|
||||
|
||||
@ -406,6 +405,8 @@ function autoflush()
|
||||
|
||||
function update_items($feed_id, array $items)
|
||||
{
|
||||
$nocontent = (bool)\PicoTools\singleton('db')->table('config')->findOneColumn('nocontent');
|
||||
|
||||
$items_in_feed = array();
|
||||
$db = \PicoTools\singleton('db');
|
||||
|
||||
@ -418,6 +419,7 @@ function update_items($feed_id, array $items)
|
||||
|
||||
// Insert only new item
|
||||
if ($db->table('items')->eq('id', $item->id)->count() !== 1) {
|
||||
$content = $nocontent ? '' : $item->content;
|
||||
|
||||
$db->table('items')->save(array(
|
||||
'id' => $item->id,
|
||||
@ -425,7 +427,7 @@ function update_items($feed_id, array $items)
|
||||
'url' => $item->url,
|
||||
'updated' => $item->updated,
|
||||
'author' => $item->author,
|
||||
'content' => $item->content,
|
||||
'content' => $content,
|
||||
'status' => 'unread',
|
||||
'feed_id' => $feed_id
|
||||
));
|
||||
@ -456,7 +458,7 @@ function get_config()
|
||||
{
|
||||
return \PicoTools\singleton('db')
|
||||
->table('config')
|
||||
->columns('username', 'language', 'autoflush')
|
||||
->columns('username', 'language', 'autoflush', 'nocontent')
|
||||
->findOne();
|
||||
}
|
||||
|
||||
@ -551,5 +553,10 @@ function save_config(array $values)
|
||||
|
||||
\PicoTools\Translator\load($values['language']);
|
||||
|
||||
// if the user does not want content of feeds, remote it in previous ones
|
||||
if ((bool)$values['nocontent']) {
|
||||
\PicoTools\singleton('db')->table('items')->update(array('content'=>''));
|
||||
}
|
||||
|
||||
return \PicoTools\singleton('db')->table('config')->update($values);
|
||||
}
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
namespace Schema;
|
||||
|
||||
function version_7($pdo)
|
||||
{
|
||||
$pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER');
|
||||
}
|
||||
|
||||
function version_6($pdo)
|
||||
{
|
||||
|
@ -19,6 +19,9 @@
|
||||
<?= Helper\form_label(t('Remove automatically read items'), 'autoflush') ?>
|
||||
<?= Helper\form_select('autoflush', $autoflush_options, $values, $errors) ?><br/>
|
||||
|
||||
<?= Helper\form_label(t('Do not fetch the content of articles (and remove it content for previous entries)'), 'nocontent', "inline-label") ?>
|
||||
<?= Helper\form_checkbox('nocontent', $values) ?><br />
|
||||
|
||||
<div class="form-actions">
|
||||
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
|
||||
</div>
|
||||
@ -54,4 +57,4 @@
|
||||
<li><?= t('Official website:') ?> <a href="http://miniflux.net" target="_blank">http://miniflux.net</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
6
vendor/PicoTools/Helper.php
vendored
6
vendor/PicoTools/Helper.php
vendored
@ -182,6 +182,12 @@ function form_radio($name, $label, $value, $selected = false, $class = '')
|
||||
return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>';
|
||||
}
|
||||
|
||||
function form_checkbox($name, $values, $class = '' )
|
||||
{
|
||||
$checkedstr = (bool)$values[$name] ? 'checked' : '';
|
||||
return '<input type="checkbox" value="1" name="'.$name.'" class="'.$class.'"'.$checkedstr.'>';
|
||||
}
|
||||
|
||||
|
||||
function form_label($label, $name, $class = '')
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user