Skip to content

Commit

Permalink
No old ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex committed Mar 16, 2019
1 parent e91ef15 commit 8b9f5e1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
10 changes: 3 additions & 7 deletions app/Controllers/feedController.php
Expand Up @@ -377,17 +377,13 @@ public static function actualizeFeed($feed_id, $feed_url, $force, $simplePiePush
$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 = Minz_ExtensionManager::callHook('entry_before_insert', $entry);
if ($entry === null) {
Expand Down
2 changes: 1 addition & 1 deletion app/Controllers/importExportController.php
Expand Up @@ -585,7 +585,7 @@ private function importJson($article_file, $starred = false) {
$feed_id, $item['id'], $item['title'], $author,
$content, $url, $published, $is_read, $is_starred
);
$entry->_id(min(time(), $entry->date(true)) . uSecString());
$entry->_id(uTimeString());
$entry->_tags($tags);

if (isset($newGuids[$entry->guid()])) {
Expand Down
7 changes: 1 addition & 6 deletions lib/lib_rss.php
Expand Up @@ -303,12 +303,7 @@ function lazyimg($content) {

function uTimeString() {
$t = @gettimeofday();
return $t['sec'] . str_pad($t['usec'], 6, '0');
}

function uSecString() {
$t = @gettimeofday();
return str_pad($t['usec'], 6, '0');
return $t['sec'] . str_pad($t['usec'], 6, '0', STR_PAD_LEFT);
}

function invalidateHttpCache($username = '') {
Expand Down

0 comments on commit 8b9f5e1

Please sign in to comment.