/**
  * Dismisses notification
  *
  * @author Macbre
  */
 public static function dismissMessage()
 {
     wfProfileIn(__METHOD__);
     global $wgRequest;
     $result = false;
     // this request should be posted
     if ($wgRequest->wasPosted()) {
         CommunityMessages::dismissMessage();
         $result = true;
     }
     wfProfileOut(__METHOD__);
     return array('result' => $result);
 }
 /**
  * Dismisses notification about updated community message
  *
  * Moved from BeforePageDisplay into separate method by Macbre
  *
  * @author Maciej Błaszkowski <marooned at wikia-inc.com>
  */
 static function dismissMessage()
 {
     wfProfileIn(__METHOD__);
     global $wgUser, $wgMemc, $wgCityId, $wgExternalDatawareDB;
     $communityMessagesTimestamp = $wgMemc->get(wfMemcKey('CommunityMessagesTimestamp'));
     if (!$communityMessagesTimestamp) {
         //do not waste time on getting timestamp from 'community-corner' - `now` will be enough
         $communityMessagesTimestamp = time();
     }
     if ($wgUser->isLoggedIn()) {
         $userTimestamp = self::getUserTimestamp($wgUser);
         //we have newer message - update user's timestamp
         if (($userTimestamp === false || $communityMessagesTimestamp > $userTimestamp) && !wfReadOnly()) {
             $dbw = wfGetDB(DB_MASTER, array(), $wgExternalDatawareDB);
             $dbw->replace('user_flags', null, array('city_id' => $wgCityId, 'user_id' => $wgUser->getID(), 'type' => self::USER_FLAGS_COMMUNITY_MESSAGES, 'data' => wfTimestamp(TS_DB, $communityMessagesTimestamp)), __METHOD__);
             // fix for AJAX calls
             $dbw->commit();
         }
     } else {
         //anon
         $req = new WebRequest();
         $req->response()->setcookie('CommunityMessages', $communityMessagesTimestamp, time() + 86400);
     }
     //hide notice in this session [omit need to send cookie back (anon) or slave lag (logged in)]
     self::$messageSeen = true;
     wfDebug(__METHOD__ . " - message dismissed\n");
     wfProfileOut(__METHOD__);
 }