aboutsummaryrefslogtreecommitdiff
path: root/app/models/Feed.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-09-14 19:44:53 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2013-09-14 19:44:53 +0200
commit008d6a704748f04687ecf14f587b986d2fe5eacd (patch)
tree284e081b27bd79dec046320b6ec14f498ac5f951 /app/models/Feed.php
parent73fe0eabbe4461ba8c6d24692ca05de0ac93de11 (diff)
parent7627970862e03a9061ddced3423689e9dccd6f45 (diff)
Merge branch 'SqlOptimisation' of https://github.com/Alkarex/FreshRSS into Alkarex-SqlOptimisation
Conflicts: app/controllers/feedController.php
Diffstat (limited to 'app/models/Feed.php')
-rw-r--r--app/models/Feed.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/app/models/Feed.php b/app/models/Feed.php
index e53df16a1..f72008c05 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,12 @@ class Feed extends Model {
}
$this->keep_history = $value;
}
+ public function _nbNotRead ($value) { //Alex
+ if (!is_int (intval ($value))) {
+ $value = -1;
+ }
+ $this->nbNotRead = $value;
+ }
public function load () {
if (!is_null ($this->url)) {
@@ -493,6 +504,9 @@ class HelperFeed {
}
foreach ($listDAO as $key => $dao) {
+ if (empty ($dao['url'])) {
+ continue;
+ }
if (isset ($dao['id'])) {
$key = $dao['id'];
}
@@ -508,7 +522,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']);
}