diff options
| author | 2014-03-30 19:17:27 +0200 | |
|---|---|---|
| committer | 2014-03-30 19:17:27 +0200 | |
| commit | 5f974c2567091412f4e98cad2a31e882e14cac9b (patch) | |
| tree | 0561137e90c9d03d4e318ea8847dd82444d9b9f4 /app/Models/EntryDAO.php | |
| parent | 19517baf13dba7ebd7d41dbbacceaea3ed75af8e (diff) | |
| parent | 34b17b748efb996f0202815dcf095a45d28e38da (diff) | |
Merge branch '163-export' into dev
Conflicts:
app/layout/aside_feed.phtml
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index e4cf128ea..6d00967fc 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -35,6 +35,36 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } + public function addEntryObject($entry, $conf, $feedHistory) { + $existingGuids = array_fill_keys( + $this->listLastGuidsByFeed($entry->feed(), 20), 1 + ); + + $nb_month_old = max($conf->old_entries, 1); + $date_min = time() - (3600 * 24 * 30 * $nb_month_old); + + $eDate = $entry->date(true); + + if ($feedHistory == -2) { + $feedHistory = $conf->keep_history_default; + } + + if (!isset($existingGuids[$entry->guid()]) && + ($feedHistory != 0 || $eDate >= $date_min)) { + $values = $entry->toArray(); + + $useDeclaredDate = empty($existingGuids); + $values['id'] = ($useDeclaredDate || $eDate < $date_min) ? + min(time(), $eDate) . uSecString() : + uTimeString(); + + return $this->addEntry($values); + } + + // We don't return Entry object to avoid a research in DB + return -1; + } + public function markFavorite($ids, $is_favorite = true) { if (!is_array($ids)) { $ids = array($ids); |
