diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-04-14 10:51:09 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-04-14 10:51:09 +0200 |
commit | 53eccb2ff78f6d94355cfca3cbfefc981e5de03b (patch) | |
tree | d03d66d896b19638fea6140e2b1eb1f7ae707841 /db/itemmapper.php | |
parent | 2c194953f0ff0f24b7f9a18815ec80971871951a (diff) |
more phpdoc and remove unused code
Diffstat (limited to 'db/itemmapper.php')
-rw-r--r-- | db/itemmapper.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php index 0ea3b77fc..cc12a2bd0 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -49,19 +49,18 @@ class ItemMapper extends NewsMapper { // WARNING: Potential SQL injection if you change this carelessly $sql = 'AND ((`items`.`status` & ' . $status . ') = ' . $status . ') '; - - foreach ($search as $_) { - $sql .= 'AND `items`.`search_index` LIKE ? '; - } - + $sql .= str_repeat('AND `items`.`search_index` LIKE ? ', count($search)); $sql .= $prependTo; return $this->makeSelectQuery($sql, $oldestFirst); } - /** - * wrap and escape search parameters in a like statement - */ + /** + * wrap and escape search parameters in a like statement + * + * @param string[] $search an array of strings that should be searched + * @return array with like parameters + */ private function buildLikeParameters($search=[]) { return array_map(function ($param) { $param = addcslashes($param, '\\_%'); @@ -262,6 +261,7 @@ class ItemMapper extends NewsMapper { /** * Delete all items for feeds that have over $threshold unread and not * starred items + * @param int $threshold the number of items that should be deleted */ public function deleteReadOlderThanThreshold($threshold){ $status = StatusFlag::STARRED | StatusFlag::UNREAD; |