|
@@ -241,6 +241,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
if (count($ids) < 1) {
|
|
if (count($ids) < 1) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
+ FreshRSS_UserDAO::touch();
|
|
|
$sql = 'UPDATE `' . $this->prefix . 'entry` '
|
|
$sql = 'UPDATE `' . $this->prefix . 'entry` '
|
|
|
. 'SET is_favorite=? '
|
|
. 'SET is_favorite=? '
|
|
|
. 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
|
|
. 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
|
|
@@ -315,6 +316,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
* @return integer affected rows
|
|
* @return integer affected rows
|
|
|
*/
|
|
*/
|
|
|
public function markRead($ids, $is_read = true) {
|
|
public function markRead($ids, $is_read = true) {
|
|
|
|
|
+ FreshRSS_UserDAO::touch();
|
|
|
if (is_array($ids)) { //Many IDs at once (used by API)
|
|
if (is_array($ids)) { //Many IDs at once (used by API)
|
|
|
if (count($ids) < 6) { //Speed heuristics
|
|
if (count($ids) < 6) { //Speed heuristics
|
|
|
$affected = 0;
|
|
$affected = 0;
|
|
@@ -379,6 +381,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
* @return integer affected rows
|
|
* @return integer affected rows
|
|
|
*/
|
|
*/
|
|
|
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) {
|
|
public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) {
|
|
|
|
|
+ FreshRSS_UserDAO::touch();
|
|
|
if ($idMax == 0) {
|
|
if ($idMax == 0) {
|
|
|
$idMax = time() . '000000';
|
|
$idMax = time() . '000000';
|
|
|
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
|
|
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
|
|
@@ -421,6 +424,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
* @return integer affected rows
|
|
* @return integer affected rows
|
|
|
*/
|
|
*/
|
|
|
public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) {
|
|
public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) {
|
|
|
|
|
+ FreshRSS_UserDAO::touch();
|
|
|
if ($idMax == 0) {
|
|
if ($idMax == 0) {
|
|
|
$idMax = time() . '000000';
|
|
$idMax = time() . '000000';
|
|
|
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
|
|
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
|
|
@@ -458,6 +462,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
* @return integer affected rows
|
|
* @return integer affected rows
|
|
|
*/
|
|
*/
|
|
|
public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) {
|
|
public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) {
|
|
|
|
|
+ FreshRSS_UserDAO::touch();
|
|
|
if ($idMax == 0) {
|
|
if ($idMax == 0) {
|
|
|
$idMax = time() . '000000';
|
|
$idMax = time() . '000000';
|
|
|
Minz_Log::debug('Calling markReadFeed(0) is deprecated!');
|
|
Minz_Log::debug('Calling markReadFeed(0) is deprecated!');
|
|
@@ -513,7 +518,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
|
|
|
|
|
$stm->execute($values);
|
|
$stm->execute($values);
|
|
|
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
|
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
|
|
- $entries = self::daoToEntry($res);
|
|
|
|
|
|
|
+ $entries = self::daoToEntries($res);
|
|
|
return isset($entries[0]) ? $entries[0] : null;
|
|
return isset($entries[0]) ? $entries[0] : null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -528,7 +533,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
|
|
|
|
|
$stm->execute($values);
|
|
$stm->execute($values);
|
|
|
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
|
$res = $stm->fetchAll(PDO::FETCH_ASSOC);
|
|
|
- $entries = self::daoToEntry($res);
|
|
|
|
|
|
|
+ $entries = self::daoToEntries($res);
|
|
|
return isset($entries[0]) ? $entries[0] : null;
|
|
return isset($entries[0]) ? $entries[0] : null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -661,7 +666,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
. ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
|
|
. ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
|
|
|
|
|
|
|
+ public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
|
|
|
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);
|
|
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);
|
|
|
|
|
|
|
|
$sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, '
|
|
$sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, '
|
|
@@ -675,8 +680,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
|
|
|
|
|
$stm = $this->bd->prepare($sql);
|
|
$stm = $this->bd->prepare($sql);
|
|
|
$stm->execute($values);
|
|
$stm->execute($values);
|
|
|
|
|
+ return $stm;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return self::daoToEntry($stm->fetchAll(PDO::FETCH_ASSOC));
|
|
|
|
|
|
|
+ public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) {
|
|
|
|
|
+ $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filter, $date_min);
|
|
|
|
|
+ return self::daoToEntries($stm->fetchAll(PDO::FETCH_ASSOC));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API
|
|
public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API
|
|
@@ -805,15 +814,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
return $res[0];
|
|
return $res[0];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static function daoToEntry($listDAO) {
|
|
|
|
|
- $list = array();
|
|
|
|
|
-
|
|
|
|
|
- if (!is_array($listDAO)) {
|
|
|
|
|
- $listDAO = array($listDAO);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- foreach ($listDAO as $key => $dao) {
|
|
|
|
|
- $entry = new FreshRSS_Entry(
|
|
|
|
|
|
|
+ public static function daoToEntry($dao) {
|
|
|
|
|
+ $entry = new FreshRSS_Entry(
|
|
|
$dao['id_feed'],
|
|
$dao['id_feed'],
|
|
|
$dao['guid'],
|
|
$dao['guid'],
|
|
|
$dao['title'],
|
|
$dao['title'],
|
|
@@ -825,10 +827,21 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
|
|
|
$dao['is_favorite'],
|
|
$dao['is_favorite'],
|
|
|
$dao['tags']
|
|
$dao['tags']
|
|
|
);
|
|
);
|
|
|
- if (isset($dao['id'])) {
|
|
|
|
|
- $entry->_id($dao['id']);
|
|
|
|
|
- }
|
|
|
|
|
- $list[] = $entry;
|
|
|
|
|
|
|
+ if (isset($dao['id'])) {
|
|
|
|
|
+ $entry->_id($dao['id']);
|
|
|
|
|
+ }
|
|
|
|
|
+ return $entry;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static function daoToEntries($listDAO) {
|
|
|
|
|
+ $list = array();
|
|
|
|
|
+
|
|
|
|
|
+ if (!is_array($listDAO)) {
|
|
|
|
|
+ $listDAO = array($listDAO);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($listDAO as $key => $dao) {
|
|
|
|
|
+ $list[] = self::daoToEntry($dao);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
unset($listDAO);
|
|
unset($listDAO);
|