MediaWiki  REL1_22
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         return $params;
00045     }
00046 
00047     public function getComment() {
00048         $timestamp = wfTimestamp( TS_MW, $this->entry->getTimestamp() );
00049         if ( $timestamp < '20080129000000' ) {
00050             # Suppress $comment from old entries (before 2008-01-29),
00051             # not needed and can contain incorrect links
00052             return '';
00053         }
00054         return parent::getComment();
00055     }
00056 
00057     public function getPreloadTitles() {
00058         $subtype = $this->entry->getSubtype();
00059         if ( $subtype === 'create2' || $subtype === 'byemail' ) {
00060             //add the user talk to LinkBatch for the userLink
00061             return array( Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) );
00062         }
00063         return array();
00064     }
00065 }