From 1ddf98c50b2e0388c76386202bd8be3442640418 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 18 Nov 2019 19:46:38 +0100 Subject: Fix adding categories in MySQL 5.5 (#2672) Fix https://github.com/FreshRSS/FreshRSS/issues/2670 (from https://github.com/FreshRSS/FreshRSS/pull/2335 ) Tested with MySQL 5.5.40, the oldest version on Docker Hub Debian 8.0 Jessie ships MySQL 5.5.43 --- app/Models/CategoryDAO.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models') diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 08dc4eef0..4bba23d9c 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -81,7 +81,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable public function addCategory($valuesTmp) { $sql = 'INSERT INTO `_category`(name, attributes) ' - . 'SELECT * FROM (SELECT TRIM(?), ?) c2 ' //TRIM() to provide a type hint as text for PostgreSQL + . '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 $stm = $this->pdo->prepare($sql); -- cgit v1.2.3 From 131ad1014b05bf00e4c46acc54e3647353a2587f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 21 Nov 2019 15:22:52 +0100 Subject: Fix updateTagAttribute (#2682) --- app/Models/TagDAO.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/Models') diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index 5882eee76..09397c6a1 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -106,9 +106,9 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function updateTagAttribute($tag, $key, $value) { if ($tag instanceof FreshRSS_Tag) { $tag->_attributes($key, $value); - return $this->updateFeed( + return $this->updateTag( $tag->id(), - array('attributes' => $feed->attributes()) + [ 'attributes' => $tag->attributes() ] ); } return false; -- cgit v1.2.3