Add subscription option to ignore expire header

This commit is contained in:
Frederic Guillot 2017-04-05 16:49:57 -04:00
parent 13b87739da
commit a7aeae463f
6 changed files with 32 additions and 11 deletions

View File

@ -142,7 +142,7 @@ function update_feed($user_id, $feed_id)
'etag' => $resource->getEtag(),
'last_modified' => $resource->getLastModified(),
'last_checked' => time(),
'expiration' => $resource->getExpiration()->getTimestamp(),
'expiration' => $subscription['ignore_expiration'] == 1 ? 0 : $resource->getExpiration()->getTimestamp(),
'parsing_error' => 0,
'parsing_error_message' => '',
));

View File

@ -140,6 +140,10 @@ function update_feed($user_id, $feed_id, array $values)
unset($feed['group_name']);
unset($feed['feed_group_ids']);
if (isset($feed['ignore_expiration']) && $feed['ignore_expiration'] == 1) {
$feed['expiration'] = 0;
}
$result = Database::getInstance('db')
->table('feeds')
->eq('user_id', $user_id)

View File

@ -5,7 +5,12 @@ namespace Miniflux\Schema;
use PDO;
use Miniflux\Helper;
const VERSION = 2;
const VERSION = 3;
function version_3(PDO $pdo)
{
$pdo->exec('ALTER TABLE feeds ADD COLUMN ignore_expiration TINYINT(1) DEFAULT 0');
}
function version_2(PDO $pdo)
{

View File

@ -5,7 +5,12 @@ namespace Miniflux\Schema;
use PDO;
use Miniflux\Helper;
const VERSION = 4;
const VERSION = 5;
function version_5(PDO $pdo)
{
$pdo->exec('ALTER TABLE feeds ADD COLUMN ignore_expiration BOOLEAN DEFAULT FALSE');
}
function version_4(PDO $pdo)
{

View File

@ -5,7 +5,12 @@ namespace Miniflux\Schema;
use PDO;
use Miniflux\Helper;
const VERSION = 3;
const VERSION = 4;
function version_4(PDO $pdo)
{
$pdo->exec('ALTER TABLE feeds ADD COLUMN ignore_expiration INTEGER DEFAULT 0');
}
function version_3(PDO $pdo)
{

View File

@ -22,13 +22,15 @@
<?php echo Miniflux\Helper\form_label(t('Feed URL'), 'feed_url') ?>
<?php echo Miniflux\Helper\form_text('feed_url', $values, $errors, array('required', 'placeholder="http://..."')) ?>
<?php echo Miniflux\Helper\form_checkbox('rtl', t('Force RTL mode (Right-to-left language)'), 1, $values['rtl']) ?><br />
<?php echo Miniflux\Helper\form_checkbox('rtl', t('Force RTL mode (Right-to-left language)'), 1, $values['rtl']) ?><br>
<?php echo Miniflux\Helper\form_checkbox('download_content', t('Download full content'), 1, $values['download_content']) ?><br />
<?php echo Miniflux\Helper\form_checkbox('download_content', t('Download full content'), 1, $values['download_content']) ?><br>
<?php echo Miniflux\Helper\form_checkbox('cloak_referrer', t('Cloak the image referrer'), 1, $values['cloak_referrer']) ?><br />
<?php echo Miniflux\Helper\form_checkbox('cloak_referrer', t('Cloak the image referrer'), 1, $values['cloak_referrer']) ?><br>
<?php echo Miniflux\Helper\form_checkbox('enabled', t('Activated'), 1, $values['enabled']) ?><br />
<?php echo Miniflux\Helper\form_checkbox('ignore_expiration', t('Ignore expiration date'), 1, isset($values['ignore_expiration']) && $values['ignore_expiration'] == 1) ?><br>
<?php echo Miniflux\Helper\form_checkbox('enabled', t('Activated'), 1, $values['enabled']) ?><br>
<?php echo Miniflux\Helper\form_label(t('Groups'), 'group_name'); ?>
@ -49,9 +51,9 @@
<div class="panel panel-default">
<ul>
<li><?= t('Last checked: ') ?> <?= empty($values['last_checked']) ? t('Never') : dt('%e %B %Y %k:%M', $values['last_checked']) ?></li>
<li><?= t('Last modified: ') ?> <?= empty($values['last_modified']) ? t('Never') : dt('%e %B %Y %k:%M', $values['last_modified']) ?></li>
<li><?= t('Expiration date: ') ?> <?= empty($values['expiration']) ? t('Never') : dt('%e %B %Y %k:%M', $values['expiration']) ?></li>
<li><?= t('Last checked: ') ?> <?= empty($values['last_checked']) ? t('None') : dt('%e %B %Y %k:%M', $values['last_checked']) ?></li>
<li><?= t('Last modified: ') ?> <?= empty($values['last_modified']) ? t('None') : dt('%e %B %Y %k:%M', strtotime($values['last_modified'])) ?></li>
<li><?= t('Expiration date: ') ?> <?= empty($values['expiration']) ? t('None') : dt('%e %B %Y %k:%M', $values['expiration']) ?></li>
<li><?= t('ETag: ') ?> <?= empty($values['etag']) ? t('None') : \Miniflux\Helper\escape($values['etag']) ?></li>
<li><?= t('Last parsing error: ') ?> <?= empty($values['parsing_error_message']) ? t('None') : \Miniflux\Helper\escape($values['parsing_error_message']) ?></li>
</ul>