diff options
| author | 2014-09-26 14:36:30 +0200 | |
|---|---|---|
| committer | 2014-09-26 14:36:30 +0200 | |
| commit | 147a3d21bbe78ae66c7134ac0c355472a92e1159 (patch) | |
| tree | 7f8ca64ccc0939c8c9aef145a8fd86cc2e52640b /app/Models/FeedDAOSQLite.php | |
| parent | 7e949d50320317b5c3b5a2da2bdaf324e794b2f7 (diff) | |
| parent | c14162221365077bcaeecde7127806190490dd58 (diff) | |
Merge branch 'dev'
Diffstat (limited to 'app/Models/FeedDAOSQLite.php')
| -rw-r--r-- | app/Models/FeedDAOSQLite.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/Models/FeedDAOSQLite.php b/app/Models/FeedDAOSQLite.php new file mode 100644 index 000000000..0d1872389 --- /dev/null +++ b/app/Models/FeedDAOSQLite.php @@ -0,0 +1,19 @@ +<?php + +class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO { + + public function updateCachedValues() { //For one single feed, call updateLastUpdate($id) + $sql = 'UPDATE `' . $this->prefix . 'feed` ' + . 'SET cache_nbEntries=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),' + . 'cache_nbUnreads=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)'; + $stm = $this->bd->prepare($sql); + if ($stm && $stm->execute()) { + return $stm->rowCount(); + } else { + $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo(); + Minz_Log::record('SQL error updateCachedValues: ' . $info[2], Minz_Log::ERROR); + return false; + } + } + +} |
