FeedDAOSQLite.php 769 B

12345678910111213141516171819
  1. <?php
  2. class FreshRSS_FeedDAOSQLite extends FreshRSS_FeedDAO {
  3. public function updateCachedValues() { //For one single feed, call updateLastUpdate($id)
  4. $sql = 'UPDATE `' . $this->prefix . 'feed` '
  5. . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `' . $this->prefix . 'entry` e1 WHERE e1.id_feed=`' . $this->prefix . 'feed`.id),'
  6. . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `' . $this->prefix . 'entry` e2 WHERE e2.id_feed=`' . $this->prefix . 'feed`.id AND e2.is_read=0)';
  7. $stm = $this->bd->prepare($sql);
  8. if ($stm && $stm->execute()) {
  9. return $stm->rowCount();
  10. } else {
  11. $info = $stm == null ? array(2 => 'syntax error') : $stm->errorInfo();
  12. Minz_Log::error('SQL error updateCachedValues: ' . $info[2]);
  13. return false;
  14. }
  15. }
  16. }