diff options
| author | 2021-02-28 12:26:24 +0100 | |
|---|---|---|
| committer | 2021-02-28 12:26:24 +0100 | |
| commit | 947e918f05d70d5dce4efa4ef403e593581c3fa9 (patch) | |
| tree | e66ef1ffe8a6cc0ffbea1bff1791588f72879637 /app/Models | |
| parent | bf2718cada964fba66d8497592abcb73cb9520ba (diff) | |
Travis: Enforce phpcs line length + whitespace (#3488)
* Update Travis line length
* Also check whitespace in CSS files
* Fix line length ext.php
* More syntax, string templates
* Fix exclude-pattern
* Test JS files as well
Diffstat (limited to 'app/Models')
| -rw-r--r-- | app/Models/CategoryDAO.php | 29 | ||||
| -rw-r--r-- | app/Models/DatabaseDAOPGSQL.php | 16 | ||||
| -rw-r--r-- | app/Models/Entry.php | 2 | ||||
| -rw-r--r-- | app/Models/EntryDAO.php | 34 | ||||
| -rw-r--r-- | app/Models/EntryDAOSQLite.php | 4 | ||||
| -rw-r--r-- | app/Models/FeedDAO.php | 36 | ||||
| -rw-r--r-- | app/Models/FormAuth.php | 5 | ||||
| -rw-r--r-- | app/Models/Share.php | 3 | ||||
| -rw-r--r-- | app/Models/StatsDAO.php | 4 | ||||
| -rw-r--r-- | app/Models/TagDAO.php | 24 | ||||
| -rw-r--r-- | app/Models/UserQuery.php | 12 |
11 files changed, 98 insertions, 71 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 519c7a29b..0a9bd68db 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -80,9 +80,13 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } public function addCategory($valuesTmp) { - $sql = 'INSERT INTO `_category`(name, attributes) ' - . 'SELECT * FROM (SELECT TRIM(?) AS name, TRIM(?) AS attributes) c2 ' //TRIM() to provide a type hint as text - . 'WHERE NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = TRIM(?))'; //No tag of the same name + // TRIM() to provide a type hint as text + // No tag of the same name + $sql = <<<'SQL' +INSERT INTO `_category`(name, attributes) +SELECT * FROM (SELECT TRIM(?) AS name, TRIM(?) AS attributes) c2 +WHERE NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = TRIM(?)) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8'); @@ -121,8 +125,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } public function updateCategory($id, $valuesTmp) { - $sql = 'UPDATE `_category` SET name=?, attributes=? WHERE id=? ' - . 'AND NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = ?)'; //No tag of the same name + // No tag of the same name + $sql = <<<'SQL' +UPDATE `_category` SET name=?, attributes=? WHERE id=? +AND NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = ?) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8'); @@ -240,12 +247,12 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable public function listCategories($prePopulateFeeds = true, $details = false) { if ($prePopulateFeeds) { $sql = 'SELECT c.id AS c_id, c.name AS c_name, c.attributes AS c_attributes, ' - . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.`cache_nbEntries`, f.`cache_nbUnreads`, f.ttl ') - . 'FROM `_category` c ' - . 'LEFT OUTER JOIN `_feed` f ON f.category=c.id ' - . 'WHERE f.priority >= :priority_normal ' - . 'GROUP BY f.id, c_id ' - . 'ORDER BY c.name, f.name'; + . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.`cache_nbEntries`, f.`cache_nbUnreads`, f.ttl ') + . 'FROM `_category` c ' + . 'LEFT OUTER JOIN `_feed` f ON f.category=c.id ' + . 'WHERE f.priority >= :priority_normal ' + . 'GROUP BY f.id, c_id ' + . 'ORDER BY c.name, f.name'; $stm = $this->pdo->prepare($sql); $values = [ ':priority_normal' => FreshRSS_Feed::PRIORITY_NORMAL ]; if ($stm && $stm->execute($values)) { diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php index 75ff8be7b..75b01c90b 100644 --- a/app/Models/DatabaseDAOPGSQL.php +++ b/app/Models/DatabaseDAOPGSQL.php @@ -57,13 +57,15 @@ class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAOSQLite { $stm->bindParam(':base', $db['base']); $stm->execute(); } else { - $sql = "SELECT " - . "pg_total_relation_size('`{$this->pdo->prefix()}category`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}feed`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entry`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}tag`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entrytag`')"; + $sql = <<<SQL +SELECT +pg_total_relation_size('`{$this->pdo->prefix()}category`') +pg_total_relation_size('`{$this->pdo->prefix()}feed`') +pg_total_relation_size('`{$this->pdo->prefix()}entry`') +pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') +pg_total_relation_size('`{$this->pdo->prefix()}tag`') +pg_total_relation_size('`{$this->pdo->prefix()}entrytag`') +SQL; $stm = $this->pdo->query($sql); } if ($stm == false) { diff --git a/app/Models/Entry.php b/app/Models/Entry.php index b5b28c97a..6e14d43b7 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -23,7 +23,7 @@ class FreshRSS_Entry extends Minz_Model { private $tags; public function __construct($feedId = '', $guid = '', $title = '', $authors = '', $content = '', - $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { + $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { $this->_title($title); $this->_authors($authors); $this->_content($content); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 6f7a4b48f..a9bf5a49b 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -578,14 +578,14 @@ SQL; if (!empty($options['keep_min']) && $options['keep_min'] > 0) { //Double SELECT for MySQL workaround ERROR 1093 (HY000) $sql .= ' AND `lastSeen` < (SELECT `lastSeen`' - . ' FROM (SELECT e2.`lastSeen` FROM `_entry` e2 WHERE e2.id_feed = :id_feed2' - . ' ORDER BY e2.`lastSeen` DESC LIMIT 1 OFFSET :keep_min) last_seen2)'; + . ' FROM (SELECT e2.`lastSeen` FROM `_entry` e2 WHERE e2.id_feed = :id_feed2' + . ' ORDER BY e2.`lastSeen` DESC LIMIT 1 OFFSET :keep_min) last_seen2)'; $params[':id_feed2'] = $id_feed; $params[':keep_min'] = (int)$options['keep_min']; } //Keep at least the articles seen at the last refresh $sql .= ' AND `lastSeen` < (SELECT maxlastseen' - . ' FROM (SELECT MAX(e3.`lastSeen`) AS maxlastseen FROM `_entry` e3 WHERE e3.id_feed = :id_feed3) last_seen3)'; + . ' FROM (SELECT MAX(e3.`lastSeen`) AS maxlastseen FROM `_entry` e3 WHERE e3.id_feed = :id_feed3) last_seen3)'; $params[':id_feed3'] = $id_feed; //==Inclusions== @@ -598,8 +598,8 @@ SQL; } if (!empty($options['keep_max']) && $options['keep_max'] > 0) { $sql .= ' OR `lastSeen` <= (SELECT `lastSeen`' - . ' FROM (SELECT e4.`lastSeen` FROM `_entry` e4 WHERE e4.id_feed = :id_feed4' - . ' ORDER BY e4.`lastSeen` DESC LIMIT 1 OFFSET :keep_max) last_seen4)'; + . ' FROM (SELECT e4.`lastSeen` FROM `_entry` e4 WHERE e4.id_feed = :id_feed4' + . ' ORDER BY e4.`lastSeen` DESC LIMIT 1 OFFSET :keep_max) last_seen4)'; $params[':id_feed4'] = $id_feed; $params[':keep_max'] = (int)$options['keep_max']; } @@ -670,7 +670,8 @@ SQL; return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL } - protected function sqlListEntriesWhere($alias = '', $filters = null, $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $firstId = '', $date_min = 0) { + protected function sqlListEntriesWhere($alias = '', $filters = null, $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $firstId = '', $date_min = 0) { $search = ' '; $values = array(); if ($state & FreshRSS_Entry::STATE_NOT_READ) { @@ -831,13 +832,15 @@ SQL; if ($filter->getSearch()) { foreach ($filter->getSearch() as $search_value) { - $sub_search .= 'AND ' . $this->sqlConcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; + $sub_search .= 'AND ' . $this->sqlConcat($alias . 'title', + $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; $values[] = "%{$search_value}%"; } } if ($filter->getNotSearch()) { foreach ($filter->getNotSearch() as $search_value) { - $sub_search .= 'AND (NOT ' . $this->sqlConcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ?) '; + $sub_search .= 'AND (NOT ' . $this->sqlConcat($alias . 'title', + $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ?) '; $values[] = "%{$search_value}%"; } } @@ -859,7 +862,8 @@ SQL; return array($values, $search); } - private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { if (!$state) { $state = FreshRSS_Entry::STATE_ALL; } @@ -917,7 +921,8 @@ SQL; . ($limit > 0 ? ' LIMIT ' . intval($limit) : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ } - public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filters, $date_min); $sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, ' @@ -939,7 +944,8 @@ SQL; } } - public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filters, $date_min); if ($stm) { while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { @@ -969,7 +975,8 @@ SQL; } } - public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null) { //For API + public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null) { //For API list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filters); $stm = $this->pdo->prepare($sql); @@ -983,7 +990,8 @@ SQL; return array(); } $guids = array_unique($guids); - $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . + ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; $stm = $this->pdo->prepare($sql); $values = array($id_feed); $values = array_merge($values, $guids); diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index e53583654..82d7c099c 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -114,13 +114,13 @@ DROP TABLE IF EXISTS `tmp`; public function markRead($ids, $is_read = true) { FreshRSS_UserDAO::touch(); if (is_array($ids)) { //Many IDs at once (used by API) - if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) + //if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) $affected = 0; foreach ($ids as $id) { $affected += $this->markRead($id, $is_read); } return $affected; - } + //} } else { $this->pdo->beginTransaction(); $sql = 'UPDATE `_entry` SET is_read=? WHERE id=? AND is_read=?'; diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 2b2b3c0ec..43485451c 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -175,9 +175,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateLastUpdate($id, $inError = false, $mtime = 0) { //See also updateCachedValue() - $sql = 'UPDATE `_feed` ' - . 'SET `lastUpdate`=?, error=? ' - . 'WHERE id=?'; + $sql = 'UPDATE `_feed` SET `lastUpdate`=?, error=? WHERE id=?'; $values = array( $mtime <= 0 ? time() : $mtime, $inError ? 1 : 0, @@ -248,9 +246,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function selectAll() { - $sql = 'SELECT id, url, category, name, website, description, `lastUpdate`, priority, ' - . '`pathEntries`, `httpAuth`, error, ttl, attributes ' - . 'FROM `_feed`'; + $sql = <<<'SQL' +SELECT id, url, category, name, website, description, `lastUpdate`, + priority, `pathEntries`, `httpAuth`, error, ttl, attributes +FROM `_feed` +SQL; $stm = $this->pdo->query($sql); while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { yield $row; @@ -317,8 +317,10 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function arrayFeedCategoryNames() { //For API - $sql = 'SELECT f.id, f.name, c.name as c_name FROM `_feed` f ' - . 'INNER JOIN `_category` c ON c.id = f.category'; + $sql = <<<'SQL' +SELECT f.id, f.name, c.name as c_name FROM `_feed` f +INNER JOIN `_category` c ON c.id = f.category +SQL; $stm = $this->pdo->query($sql); $res = $stm->fetchAll(PDO::FETCH_ASSOC); $feedCategoryNames = array(); @@ -337,12 +339,12 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function listFeedsOrderUpdate($defaultCacheDuration = 3600, $limit = 0) { $this->updateTTL(); $sql = 'SELECT id, url, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, ttl, attributes ' - . 'FROM `_feed` ' - . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl >= ' . FreshRSS_Feed::TTL_DEFAULT - . ' AND `lastUpdate` < (' . (time() + 60) - . '-(CASE WHEN ttl=' . FreshRSS_Feed::TTL_DEFAULT . ' THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') - . 'ORDER BY `lastUpdate` ' - . ($limit < 1 ? '' : 'LIMIT ' . intval($limit)); + . 'FROM `_feed` ' + . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl >= ' . FreshRSS_Feed::TTL_DEFAULT + . ' AND `lastUpdate` < (' . (time() + 60) + . '-(CASE WHEN ttl=' . FreshRSS_Feed::TTL_DEFAULT . ' THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') + . 'ORDER BY `lastUpdate` ' + . ($limit < 1 ? '' : 'LIMIT ' . intval($limit)); $stm = $this->pdo->query($sql); if ($stm !== false) { return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); @@ -394,9 +396,9 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function updateCachedValues($id = null) { //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE $sql = 'UPDATE `_feed` ' - . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `_entry` e1 WHERE e1.id_feed=`_feed`.id),' - . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)' - . ($id != null ? ' WHERE id=:id' : ''); + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `_entry` e1 WHERE e1.id_feed=`_feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)' + . ($id != null ? ' WHERE id=:id' : ''); $stm = $this->pdo->prepare($sql); if ($id != null) { $stm->bindParam(':id', $id, PDO::PARAM_INT); diff --git a/app/Models/FormAuth.php b/app/Models/FormAuth.php index 1aca7c3d1..5211fd5d1 100644 --- a/app/Models/FormAuth.php +++ b/app/Models/FormAuth.php @@ -6,10 +6,7 @@ class FreshRSS_FormAuth { !ctype_graph($hash) || !ctype_graph($challenge) || !ctype_alnum($nonce)) { - Minz_Log::debug('Invalid credential parameters:' . - ' user=' . $username . - ' challenge=' . $challenge . - ' nonce=' . $nonce); + Minz_Log::debug("Invalid credential parameters: user={$username}, challenge={$challenge}, nonce={$nonce}"); return false; } diff --git a/app/Models/Share.php b/app/Models/Share.php index 218781dcc..7988a021f 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -97,8 +97,7 @@ class FreshRSS_Share { * @param $help_url is an optional url to give help on this option. * @param $method defines the sharing method (GET or POST) */ - private function __construct($type, $url_transform, $transform, - $form_type, $help_url, $method, $field) { + private function __construct($type, $url_transform, $transform, $form_type, $help_url, $method, $field) { $this->type = $type; $this->name = _t('gen.share.' . $type); $this->url_transform = $url_transform; diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index cbfa79c61..a73657e9a 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -15,8 +15,8 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { */ public function calculateEntryRepartition() { return array( - 'main_stream' => $this->calculateEntryRepartitionPerFeed(null, true), - 'all_feeds' => $this->calculateEntryRepartitionPerFeed(null, false), + 'main_stream' => $this->calculateEntryRepartitionPerFeed(null, true), + 'all_feeds' => $this->calculateEntryRepartitionPerFeed(null, false), ); } diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index a9aad519d..7f95e2ac2 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -42,9 +42,13 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function addTag($valuesTmp) { - $sql = 'INSERT INTO `_tag`(name, attributes) ' - . 'SELECT * FROM (SELECT TRIM(?) as name, TRIM(?) as attributes) t2 ' //TRIM() gives a text type hint to PostgreSQL - . 'WHERE NOT EXISTS (SELECT 1 FROM `_category` WHERE name = TRIM(?))'; //No category of the same name + // TRIM() gives a text type hint to PostgreSQL + // No category of the same name + $sql = <<<'SQL' +INSERT INTO `_tag`(name, attributes) +SELECT * FROM (SELECT TRIM(?) as name, TRIM(?) as attributes) t2 +WHERE NOT EXISTS (SELECT 1 FROM `_category` WHERE name = TRIM(?)) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, 63, 'UTF-8'); @@ -79,8 +83,12 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateTag($id, $valuesTmp) { - $sql = 'UPDATE `_tag` SET name=?, attributes=? WHERE id=? ' - . 'AND NOT EXISTS (SELECT 1 FROM `_category` WHERE name = ?)'; //No category of the same name + // No category of the same name + $sql = <<<'SQL' +UPDATE `_tag` SET name=?, attributes=? WHERE id=? +AND NOT EXISTS (SELECT 1 FROM `_category` WHERE name = ?) +SQL; + $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, 63, 'UTF-8'); @@ -149,7 +157,11 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateEntryTag($oldTagId, $newTagId) { - $sql = 'DELETE FROM `_entrytag` WHERE EXISTS (SELECT 1 FROM `_entrytag` AS e WHERE e.id_entry = `_entrytag`.id_entry AND e.id_tag = ? AND `_entrytag`.id_tag = ?)'; + $sql = <<<'SQL' +DELETE FROM `_entrytag` WHERE EXISTS ( + SELECT 1 FROM `_entrytag` AS e + WHERE e.id_entry = `_entrytag`.id_entry AND e.id_tag = ? AND `_entrytag`.id_tag = ?) +SQL; $stm = $this->pdo->prepare($sql); if (!($stm && $stm->execute([$newTagId, $oldTagId]))) { diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index a5a5a6ce2..88ddd3629 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -59,12 +59,12 @@ class FreshRSS_UserQuery { */ public function toArray() { return array_filter(array( - 'get' => $this->get, - 'name' => $this->name, - 'order' => $this->order, - 'search' => $this->search->__toString(), - 'state' => $this->state, - 'url' => $this->url, + 'get' => $this->get, + 'name' => $this->name, + 'order' => $this->order, + 'search' => $this->search->__toString(), + 'state' => $this->state, + 'url' => $this->url, )); } |
