MediaWiki  REL1_24
NewUsersLogFormatter.php
Go to the documentation of this file.
00001 <?php
00031 class NewUsersLogFormatter extends LogFormatter {
00032     protected function getMessageParameters() {
00033         $params = parent::getMessageParameters();
00034         $subtype = $this->entry->getSubtype();
00035         if ( $subtype === 'create2' || $subtype === 'byemail' ) {
00036             if ( isset( $params[3] ) ) {
00037                 $target = User::newFromId( $params[3] );
00038             } else {
00039                 $target = User::newFromName( $this->entry->getTarget()->getText(), false );
00040             }
00041             $params[2] = Message::rawParam( $this->makeUserLink( $target ) );
00042             $params[3] = $target->getName();
00043         }
00044 
00045         return $params;
00046     }
00047 
00048     public function getComment() {
00049         $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
00050         if ( $timestamp < '20080129000000' ) {
00051             # Suppress $comment from old entries (before 2008-01-29),
00052             # not needed and can contain incorrect links
00053             return '';
00054         }
00055 
00056         return parent::getComment();
00057     }
00058 
00059     public function getPreloadTitles() {
00060         $subtype = $this->entry->getSubtype();
00061         if ( $subtype === 'create2' || $subtype === 'byemail' ) {
00062             //add the user talk to LinkBatch for the userLink
00063             return array( Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) );
00064         }
00065 
00066         return array();
00067     }
00068 }