/** * @brief mark all notifications with the given class id as read * @param $uid user id * @param $class class id or array with multiple class ids * @param $read the (boolean) value to set the read column to */ public static function markReadByClassId($uid = null, $class, $read = true) { if (is_null($uid)) { if (OCP\User::isLoggedIn()) { $uid = OCP\User::getUser(); } else { return 0; } } if (!isset(self::$readByClassIdStmt)) { self::$readByClassIdStmt = OCP\DB::prepare("UPDATE *PREFIX*notifications SET read = ? WHERE class = ? AND uid = ?"); } if (!is_array($class)) { if ($class === false) { return 0; } $class = array($class); } $return = 0; foreach ($class as $c) { self::$readByClassIdStmt->execute(array((int) $read, $c, $uid)); $return += self::$readByClassIdStmt->numRows(); } return $return; }