aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php39
1 files changed, 15 insertions, 24 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index 74c9eacfa..0aed9b0a1 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -289,7 +289,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
$ttl = $feed->ttl();
if ((!$simplePiePush) && (!$feed_id) &&
- ($feed->lastUpdate() + 10 >= time() - ($ttl == FreshRSS_Feed::TTL_DEFAULT ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) {
+ ($feed->lastUpdate() + 10 >= time() - (
+ $ttl == FreshRSS_Feed::TTL_DEFAULT ? FreshRSS_Context::$user_conf->ttl_default : $ttl))) {
//Too early to refresh from source, but check whether the feed was updated by another user
$mtime = $feed->cacheModifiedTime();
if ($feed->lastUpdate() + 10 >= $mtime) {
@@ -347,8 +348,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entry_date = $entry->date(true);
if (isset($existingHashForGuids[$entry->guid()])) {
$existingHash = $existingHashForGuids[$entry->guid()];
- if (strcasecmp($existingHash, $entry->hash()) === 0 || trim($existingHash, '0') == '') {
- //This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3
+ if (strcasecmp($existingHash, $entry->hash()) === 0) {
+ //This entry already exists and is unchanged.
$oldGuids[] = $entry->guid();
} else { //This entry already exists but has been updated
//Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) .
@@ -357,7 +358,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$feed->attributes('mark_updated_article_unread')
) : FreshRSS_Context::$user_conf->mark_updated_article_unread;
$needFeedCacheRefresh = $mark_updated_article_unread;
- $entry->_isRead(FreshRSS_Context::$user_conf->mark_updated_article_unread ? false : null); //Change is_read according to policy.
+ $entry->_isRead($mark_updated_article_unread ? false : null); //Change is_read according to policy.
$entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry);
if ($entry === null) {
@@ -374,20 +375,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
// This entry should not be added considering configuration and date.
$oldGuids[] = $entry->guid();
} else {
- $read_upon_reception = $feed->attributes('read_upon_reception') !== null ? (
- $feed->attributes('read_upon_reception')
- ) : FreshRSS_Context::$user_conf->mark_when['reception'];
- if ($isNewFeed) {
- $id = min(time(), $entry_date) . uSecString();
- $entry->_isRead($read_upon_reception);
- } elseif ($entry_date < $date_min) {
- $id = min(time(), $entry_date) . uSecString();
+ $id = uTimeString();
+ $entry->_id($id);
+ if ($entry_date < $date_min) {
$entry->_isRead(true); //Old article that was not in database. Probably an error, so mark as read
- } else {
- $id = uTimeString();
- $entry->_isRead($read_upon_reception);
}
- $entry->_id($id);
+
+ $entry->applyFilterActions();
$entry = Minz_ExtensionManager::callHook('entry_before_insert', $entry);
if ($entry === null) {
@@ -396,7 +390,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
if ($pubSubHubbubEnabled && !$simplePiePush) { //We use push, but have discovered an article by pull!
- $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url . ' GUID ' . $entry->guid();
+ $text = 'An article was discovered by pull although we use PubSubHubbub!: Feed ' . $url .
+ ' GUID ' . $entry->guid();
Minz_Log::warning($text, PSHB_LOG);
Minz_Log::warning($text);
$pubSubHubbubEnabled = false;
@@ -420,9 +415,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entryDAO->beginTransaction();
}
- $nb = $entryDAO->cleanOldEntries($feed->id(),
- $date_min,
- max($feed_history, count($entries) + 10));
+ $nb = $entryDAO->cleanOldEntries($feed->id(), $date_min, max($feed_history, count($entries) + 10));
if ($nb > 0) {
$needFeedCacheRefresh = true;
Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']');
@@ -602,11 +595,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if (self::moveFeed($feed_id, $cat_id)) {
// TODO: return something useful
// Log a notice to prevent "Empty IF statement" warning in PHP_CodeSniffer
- Minz_Log::notice('Moved feed `' . $feed_id . '` ' .
- 'in the category `' . $cat_id . '`');;
+ Minz_Log::notice('Moved feed `' . $feed_id . '` in the category `' . $cat_id . '`');
} else {
- Minz_Log::warning('Cannot move feed `' . $feed_id . '` ' .
- 'in the category `' . $cat_id . '`');
+ Minz_Log::warning('Cannot move feed `' . $feed_id . '` in the category `' . $cat_id . '`');
Minz_Error::error(404);
}
}