Ejemplo n.º 1
0
 /**
  * @brief Adjusting recent changes for Wall
  *
  * @desc This method creates comment about revision deletion of a message on message wall
  *
  * @param ChangesList $list
  * @param RecentChange $rc
  * @param String $s
  * @param Formatter $formatter
  * @param string $mark
  *
  * @return true because this is a hook
  *
  * @author Andrzej 'nAndy' Lukaszewski
  */
 public function onChangesListInsertLogEntry($list, $rc, &$s, $formatter, &$mark)
 {
     $app = F::app();
     if ($rc->getAttribute('rc_type') == RC_LOG && in_array(MWNamespace::getSubject($rc->getAttribute('rc_namespace')), $app->wg->WallNS) && in_array($rc->getAttribute('rc_log_action'), $this->rcWallActionTypes)) {
         $actionText = '';
         $wfMsgOptsBase = $this->getMessageOptions($rc);
         $wfMsgOpts = array($wfMsgOptsBase['articleUrl'], $wfMsgOptsBase['articleTitleTxt'], $wfMsgOptsBase['wallPageUrl'], $wfMsgOptsBase['wallPageName'], $wfMsgOptsBase['actionUser']);
         $msgType = $wfMsgOptsBase['isThread'] ? 'thread' : 'reply';
         //created in WallHooksHelper::getMessageOptions()
         //and there is not needed to be passed to wfMsg()
         unset($wfMsgOpts['isThread'], $wfMsgOpts['isNew']);
         switch ($rc->getAttribute('rc_log_action')) {
             case 'wall_remove':
                 $actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-removed-' . $msgType, array('parseinline'), $wfMsgOpts);
                 break;
             case 'wall_restore':
                 $actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-restored-' . $msgType, array('parseinline'), $wfMsgOpts);
                 break;
             case 'wall_admindelete':
                 $actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-deleted-' . $msgType, array('parseinline'), $wfMsgOpts);
                 break;
             case 'wall_archive':
                 $actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-closed-thread', array('parseinline'), $wfMsgOpts);
                 break;
             case 'wall_reopen':
                 $actionText = wfMsgExt($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-reopened-thread', array('parseinline'), $wfMsgOpts);
                 break;
             default:
                 $actionText = wfMsg($this->getMessagePrefix($rc->getAttribute('rc_namespace')) . '-unrecognized-log-action', $wfMsgOpts);
                 break;
         }
         $s = '';
         $list->insertUserRelatedLinks($s, $rc);
         $s .= ' ' . $actionText . ' ' . $list->insertComment($rc);
     }
     return true;
 }