diff options
| author | 2013-10-06 23:06:25 +0200 | |
|---|---|---|
| committer | 2013-10-06 23:06:25 +0200 | |
| commit | 7c1c7226a3519d9f54c2bcdc288bb3a13c57479c (patch) | |
| tree | c0109e4309004e2c8f6daa5a514acb36425735e6 /app/models/Feed.php | |
| parent | 4a2581f00d7c2febb95ea3de8ec47f1d3917232c (diff) | |
| parent | 35dcb5e39aee8029fee541d5649456bc385cd649 (diff) | |
Merge branch 'sql-optimisation' into dev
Diffstat (limited to 'app/models/Feed.php')
| -rw-r--r-- | app/models/Feed.php | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php index b3c23d4e8..6f09bf844 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -4,6 +4,7 @@ class Feed extends Model { private $id = null; private $url; private $category = '000000'; + private $nbNotRead = -1; private $entries = null; private $name = ''; private $website = ''; @@ -82,8 +83,12 @@ class Feed extends Model { return $feedDAO->countEntries ($this->id ()); } public function nbNotRead () { + if ($this->nbNotRead < 0) { $feedDAO = new FeedDAO (); - return $feedDAO->countNotRead ($this->id ()); + $this->nbNotRead = $feedDAO->countNotRead ($this->id ()); + } + + return $this->nbNotRead; } public function favicon () { $file = '/data/favicons/' . $this->id () . '.ico'; @@ -162,6 +167,13 @@ class Feed extends Model { } $this->keep_history = $value; } + public function _nbNotRead ($value) { + if (!is_int ($value)) { + $value = -1; + } + + $this->nbNotRead = intval ($value); + } public function load () { if (!is_null ($this->url)) { @@ -493,6 +505,9 @@ class HelperFeed { } foreach ($listDAO as $key => $dao) { + if (empty ($dao['url'])) { + continue; + } if (isset ($dao['id'])) { $key = $dao['id']; } @@ -508,7 +523,9 @@ class HelperFeed { $list[$key]->_httpAuth (base64_decode ($dao['httpAuth'])); $list[$key]->_error ($dao['error']); $list[$key]->_keepHistory ($dao['keep_history']); - + if (isset ($dao['nbNotRead'])) { + $list[$key]->_nbNotRead ($dao['nbNotRead']); + } if (isset ($dao['id'])) { $list[$key]->_id ($dao['id']); } |
