/** * 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; }
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']); } }