Пример #1
0
 /**
  * @brief mark the notification with the given id as read
  * @param $uid user id
  * @param $id notification id
  * @param $read the (boolean) value to set the read column to
  * @return number of affected rows
  * @fixme do we really need $uid here??
  */
 public static function markReadById($uid = null, $id, $read = true)
 {
     if (is_null($uid)) {
         if (OCP\User::isLoggedIn()) {
             $uid = OCP\User::getUser();
         } else {
             return 0;
         }
     }
     if (!isset(self::$readByIdStmt)) {
         self::$readByIdStmt = OCP\DB::prepare("UPDATE *PREFIX*notifications SET read = ? WHERE id = ? AND uid = ?");
     }
     self::$readByIdStmt->execute(array((int) $read, $id, $uid));
     return self::$readByIdStmt->numRows();
 }