コード例 #1
0
 /**
  * Create a new object from a Revision ID and a wikia ID.  If the wikia ID does not
  * match the current wikia, this will make an external call to the wikia that
  * owns the data.
  *
  * @param int $revId The revision ID for this notification entity
  * @param int $wikiId The wiki where this revision exists
  * @param bool $useMasterDB Whether to query the MASTER DB on Title lookup.
  *
  * @return WallNotificationEntity|null
  */
 public static function createFromRevId($revId, $wikiId, $useMasterDB = false)
 {
     $wn = new WallNotificationEntity();
     if ($wikiId == F::app()->wg->CityId) {
         $success = $wn->loadDataFromRevId($revId, $useMasterDB);
     } else {
         $success = $wn->loadDataFromRevIdOnWiki($revId, $wikiId, $useMasterDB);
     }
     if ($success) {
         $wn->saveToCache();
         return $wn;
     }
     return null;
 }
コード例 #2
0
 public function processEntities($userId, $entityKey)
 {
     if (!$this->getEntityProcessed($userId, $entityKey)) {
         $notification = WallNotificationEntity::createFromId($entityKey);
         if (!empty($notification)) {
             $wn = new WallNotifications();
             $wn->addNotificationLinks([$userId], $notification);
         }
         $this->setEntityProcessed($userId, $entityKey);
     }
 }
コード例 #3
0
 public function notifyEveryone()
 {
     $rev = $this->getArticleComment()->mLastRevision;
     if (empty($rev)) {
         return true;
     }
     $notif = WallNotificationEntity::createFromRev($rev);
     /*
      * experimental notfieverone
      */
     $wne = new WallNotificationsEveryone();
     $wne->addNotificationToQueue($notif);
 }
コード例 #4
0
 public function getEntityData()
 {
     $this->response->setFormat(WikiaResponse::FORMAT_JSON);
     $revId = $this->getVal('revId');
     $useMasterDB = $this->getVal('useMasterDB', false);
     $wn = new WallNotificationEntity();
     if ($wn->loadDataFromRevId($revId, $useMasterDB)) {
         $this->response->setData(['data' => $wn->data, 'parentTitleDbKey' => $wn->parentTitleDbKey, 'msgText' => $wn->msgText, 'threadTitleFull' => $wn->threadTitleFull, 'status' => 'ok']);
     } else {
         $this->response->setData(['status' => 'error']);
     }
 }
コード例 #5
0
 public function sendNotification($revOldId, $rcType = RC_NEW, $useMasterDB = false)
 {
     $app = F::App();
     $rev = Revision::newFromId($revOldId);
     $notif = WallNotificationEntity::createFromRev($rev, $useMasterDB);
     $wh = new WallHistory($app->wg->CityId);
     $wh->add($rcType == RC_NEW ? WH_NEW : WH_EDIT, $notif, $app->wg->User);
     if ($rcType == RC_NEW) {
         $wn = new WallNotifications();
         $wn->addNotification($notif);
     }
 }
コード例 #6
0
 protected function addNotificationLink($userId, WallNotificationEntity $notification)
 {
     $notifData = $notification->data;
     $this->addNotificationLinkInternal($userId, $notifData->wiki, ['unique_id' => $notification->getUniqueId(), 'entity_key' => $notification->id, 'author_id' => $notifData->msg_author_id, 'is_reply' => $notification->isReply(), 'notifyeveryone' => $notifData->notifyeveryone]);
 }