From: Michael Date: Tue, 9 Jan 2018 22:16:16 +0000 (+0000) Subject: Return the number of affected rows X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bbd9d587c72b672108446d89beb7f1e3bfe9c501;p=friendica.git Return the number of affected rows --- diff --git a/src/Model/Item.php b/src/Model/Item.php index c65e8f1aab..49cb499c30 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -21,7 +21,12 @@ class Item * @param array $fields The fields that are to be changed * @param array $condition The condition for finding the item entries * - * @return boolean success + * In the future we may have to change permissions as well. + * Then we had to add the user id as third parameter. + * + * A return value of "0" doesn't mean an error - but that 0 rows had been changed. + * + * @return integer|boolean number of affected rows - or "false" if there was an error */ public static function update(array $fields, array $condition) { @@ -35,6 +40,8 @@ class Item return false; } + $rows = dba::affected_rows(); + // We cannot simply expand the condition to check for origin entries // The condition needn't to be a simple array but could be a complex condition. $items = dba::select('item', ['id', 'origin'], $condition); @@ -51,6 +58,6 @@ class Item Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']); } - return true; + return $rows; } }