MediaWiki  REL1_22
MoveLogFormatter.php
Go to the documentation of this file.
00001 <?php
00031 class MoveLogFormatter extends LogFormatter {
00032     public function getPreloadTitles() {
00033         $params = $this->extractParameters();
00034         return array( Title::newFromText( $params[3] ) );
00035     }
00036 
00037     protected function getMessageKey() {
00038         $key = parent::getMessageKey();
00039         $params = $this->getMessageParameters();
00040         if ( isset( $params[4] ) && $params[4] === '1' ) {
00041             $key .= '-noredirect';
00042         }
00043         return $key;
00044     }
00045 
00046     protected function getMessageParameters() {
00047         $params = parent::getMessageParameters();
00048         $oldname = $this->makePageLink( $this->entry->getTarget(), array( 'redirect' => 'no' ) );
00049         $newname = $this->makePageLink( Title::newFromText( $params[3] ) );
00050         $params[2] = Message::rawParam( $oldname );
00051         $params[3] = Message::rawParam( $newname );
00052         return $params;
00053     }
00054 
00055     public function getActionLinks() {
00056         if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
00057             || $this->entry->getSubtype() !== 'move'
00058             || !$this->context->getUser()->isAllowed( 'move' ) )
00059         {
00060             return '';
00061         }
00062 
00063         $params = $this->extractParameters();
00064         $destTitle = Title::newFromText( $params[3] );
00065         if ( !$destTitle ) {
00066             return '';
00067         }
00068 
00069         $revert = Linker::linkKnown(
00070             SpecialPage::getTitleFor( 'Movepage' ),
00071             $this->msg( 'revertmove' )->escaped(),
00072             array(),
00073             array(
00074                 'wpOldTitle' => $destTitle->getPrefixedDBkey(),
00075                 'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
00076                 'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(),
00077                 'wpMovetalk' => 0
00078             )
00079         );
00080         return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
00081     }
00082 }