Return the number of affected rows
This commit is contained in:
		
					parent
					
						
							
								81925e3730
							
						
					
				
			
			
				commit
				
					
						bbd9d587c7
					
				
			
		
					 1 changed files with 9 additions and 2 deletions
				
			
		|  | @ -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; | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue