示例#1
0
 public function move(Wall $dest, $user)
 {
     CommentsIndex::changeParent(0, $dest->getId(), $this->mThreadId);
     $wallHistory = new WallHistory($this->mCityId);
     $wallHistory->moveThread($this->mThreadId, $dest->getId());
     $main = $this->getThreadMainMsg();
     $main->load();
     // this is use to build a history in contribiution page
     $main->markAsMove($user);
     $this->invalidateCache();
 }
 /**
  * clean history after delete
  * @param $self
  * @param $user
  * @param $reason
  * @param $id
  * @return bool
  */
 public static function onArticleDeleteComplete(&$self, &$user, $reason, $id)
 {
     $title = $self->getTitle();
     $app = F::app();
     if ($title instanceof Title && $title->getNamespace() == NS_USER_WALL_MESSAGE) {
         $wh = new WallHistory($app->wg->CityId);
         $wh->remove($id);
     }
     return true;
 }
 public function index()
 {
     JSMessages::enqueuePackage('Wall', JSMessages::EXTERNAL);
     $title = $this->getContext()->getTitle();
     $this->isThreadLevel = $this->request->getVal('threadLevelHistory', false);
     $path = array();
     if ($this->isThreadLevel) {
         $threadId = intval($title->getDBkey());
         $title = Title::newFromId($threadId);
     }
     $this->historyPreExecute();
     $page = $this->request->getVal('page', 1);
     $page = ($page = intval($page)) === 0 ? 1 : $page;
     $this->response->setVal('sortingOptions', $this->getSortingOptions());
     $this->response->setVal('sortingSelected', $this->getSortingSelectedText());
     $this->response->setVal('wallHistoryMsg', $this->getHistoryMessagesArray());
     $this->response->setVal('currentPage', $page);
     $this->response->setVal('isThreadLevelHistory', $this->isThreadLevel);
     if (!$title instanceof Title || $this->isThreadLevel && !in_array(MWNamespace::getSubject($title->getNamespace()), $this->wg->WallNS)) {
         // paranoia -- why the message is not in DB
         $this->response->setVal('wallmessageNotFound', true);
         return;
     }
     if ($this->isThreadLevel) {
         $wallMessage = new WallMessage($title);
         $wallMessage->load();
         $perPage = 50;
         $wallHistory = new WallHistory();
         $wallHistory->setPage($page, $perPage);
         $count = $wallHistory->getCount(null, $threadId);
         $sort = $this->getSortingSelected();
         $history = $wallHistory->get(null, $sort, $threadId);
         $this->response->setVal('wallHistory', $this->getFormatedHistoryData($history, $threadId));
         $path[] = array('title' => $wallMessage->getMetatitle(), 'url' => $wallMessage->getMessagePageUrl());
         $wallUrl = $wallMessage->getArticleTitle()->getFullUrl();
         $wallOwnerName = $wallMessage->getArticleTitle()->getText();
         $this->response->setVal('wallHistoryUrl', $wallMessage->getMessagePageUrl(true) . '?action=history&sort=' . $sort);
     } else {
         $perPage = 100;
         $wallHistory = new WallHistory();
         $wallHistory->setPage($page, $perPage);
         $sort = $this->getSortingSelected();
         if ($title->exists()) {
             $count = $wallHistory->getCount($title->getArticleId(), null, false);
             $history = $wallHistory->get($title->getArticleId(), $sort, null, false);
         } else {
             $count = 0;
             $history = array();
         }
         $wallUrl = $title->getFullUrl();
         $wallOwnerName = $title->getText();
         $this->response->setVal('wallHistory', $this->getFormatedHistoryData($history));
         $this->response->setVal('wallHistoryUrl', $title->getFullURL(array('action' => 'history', 'sort' => $sort)));
     }
     $path = array_merge(array(array('title' => wfMessage('wall-message-elseswall', array($wallOwnerName))->escaped(), 'url' => $wallUrl)), $path);
     $this->response->setVal('wallOwnerName', $wallOwnerName);
     if ($this->isThreadLevel) {
         $this->response->setVal('pageTitle', wfMessage('wall-thread-history-title')->escaped());
         wfRunHooks('WallHistoryThreadHeader', array($title, $wallMessage, &$path, &$this->response, &$this->request));
     } else {
         $this->response->setVal('pageTitle', wfMessage('wall-history-title')->escaped());
         wfRunHooks('WallHistoryHeader', array($title, &$path, &$this->response, &$this->request));
     }
     $this->response->setVal('path', $path);
     $this->response->setVal('totalItems', $count);
     $this->response->setVal('itemsPerPage', $perPage);
     $this->response->setVal('showPager', $count > $perPage);
 }
示例#4
0
 public function moveAllThread(Wall $dest)
 {
     CommentsIndex::changeParent($this->getId(), $dest->getId());
     $wallHistory = new WallHistory($this->mCityId);
     $wallHistory->moveThreads($this->getId(), $dest->getId());
 }
示例#5
0
| post_user_id       | int(11)      | YES  |     | NULL              |                             |
| post_user_ip       | varchar(16)  | YES  |     | NULL              |                             |
| is_reply           | int(1)       | YES  |     | NULL              |                             |
| action             | int(3)       | YES  |     | NULL              |                             |
| metatitle          | varchar(201) | YES  |     | NULL              |                             |
| page_id            | int(11)      | YES  |     | NULL              |                             |
| parent_page_id     | int(11)      | YES  |     | NULL              |                             |
| event_date         | timestamp    | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| reason             | varchar(100) | YES  |     | NULL              |                             |
| revision_id        | int(11)      | YES  |     | NULL              |                             |
| deleted_or_removed | int(1)       | YES  |     | 0                 |                             |
| post_ns            | int(11)      | YES  |     | 1200              |                             |
| migrated           | int(1)       | YES  | MUL | 0                 |                             |
+--------------------+--------------+------+-----+-------------------+------------------------------
*/
$history = new WallHistory();
$dbw = $history->getDatawareDB();
$res = $dbw->select('wall_history', array('post_user_id', 'post_user_ip', 'is_reply', 'post_ns', 'page_id', 'parent_page_id', 'metatitle', 'deleted_or_removed', 'event_date', 'reason', 'action', 'revision_id', 'deleted_or_removed'), array('migrated' => 0, 'wiki_id' => $wgCityId), __METHOD__);
$in = array();
$db = $history->getDB(DB_MASTER);
$dir = dirname(__FILE__);
if (!$db->tableExists('wall_history')) {
    echo "Try to create table\\'n";
    $db->sourceFile($IP . "/extensions/wikia/Wall/sql/wall_history_local.sql");
}
while ($row = $dbw->fetchRow($res)) {
    if ($row['action'] == WH_NEW || $row['action'] == WH_EDIT) {
        $pagesRow = $db->selectRow('revision', array('rev_timestamp'), array('rev_id' => $row['revision_id']));
        $row['event_date'] = wfTimestamp(TS_DB, $pagesRow->rev_timestamp);
    }
    $mw = WallMessage::newFromId($row['page_id']);
示例#6
0
 public function restore($user, $reason = '')
 {
     $this->unMarkInProps(WPP_WALL_REMOVE);
     $this->unMarkInProps(WPP_WALL_ADMINDELETE);
     $this->unMarkInProps(WPP_WALL_MODERATORREMOVE);
     $this->customActionNotifyRC($user, 'wall_restore', $reason);
     $wne = $this->getAdminNotificationEntity($user, $reason);
     $wh = new WallHistory($this->cityId);
     $wh->add(WH_RESTORE, $wne, $user);
     $this->addWatch($user);
     $wn = new WallNotifications();
     if ($this->isMain()) {
         $wn->unhideNotificationsForUniqueID($this->cityId, $this->getId());
         $this->getWall()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForThread($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForThread($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     } else {
         $this->getThread()->invalidateCache();
         $wna = new WallNotificationsAdmin();
         $wna->removeForReply($this->cityId, $this->getId());
         $wno = new WallNotificationsOwner();
         $wno->removeForReply($this->cityId, $this->getWallOwner()->getId(), $this->getId());
     }
 }
示例#7
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);
     }
 }
 public function forumActivityModule()
 {
     $wallHistory = new WallHistory($this->app->wg->CityId);
     $out = $wallHistory->getLastPosts(NS_WIKIA_FORUM_BOARD);
     $this->response->setVal('posts', $out);
 }