Page MenuHomeWickedGov Phorge

GlobalRenameLogFormatter.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

GlobalRenameLogFormatter.php

<?php
namespace MediaWiki\Extension\CentralAuth\GlobalRename;
use LogFormatter;
use MediaWiki\Message\Message;
use MediaWiki\SpecialPage\SpecialPage;
use MediaWiki\WikiMap\WikiMap;
/**
* Handles the following log types:
* - gblrename/rename
* - gblrename/promote
*
* phan-taint-check gets very confused by $this->plaintext changing expected taint types everywhere,
* so manual annotations are needed. They should be correct for the non-plaintext mode (HTML output).
*/
class GlobalRenameLogFormatter extends LogFormatter {
/** @inheritDoc */
protected function getMessageParameters() {
parent::getMessageParameters();
$params = $this->extractParameters();
if ( $this->entry->getSubtype() === 'promote' ) {
$this->parsedParameters[3] = Message::rawParam( $this->getLocalWikiLink( $params[3], $params[5] ) );
} else {
// rename
$this->parsedParameters[3] = Message::rawParam( $this->getCentralAuthLink( $params[3] ) );
}
$this->parsedParameters[4] = Message::rawParam( $this->getCentralAuthLink( $params[4] ) );
ksort( $this->parsedParameters );
return $this->parsedParameters;
}
/**
* @param string $name
* @param-taint $name none
* @return string wikitext or html
* @return-taint onlysafefor_html
*/
protected function getCentralAuthLink( $name ) {
$title = SpecialPage::getTitleFor( 'CentralAuth', $name );
if ( $this->plaintext ) {
return '[[' . $title->getPrefixedText() . ']]';
}
return $this->getLinkRenderer()->makeLink( $title, $name );
}
/**
* @param string $name
* @param string $wiki
* @return string wikitext or html
* @return-taint onlysafefor_html
*/
protected function getLocalWikiLink( $name, $wiki ) {
$text = "User:$name@$wiki";
if ( $this->plaintext ) {
return "[[$text]]";
}
return WikiMap::foreignUserLink( $wiki, $name, $text );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, May 16, 21:04 (1 d, 20 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d6/a0/13d4c42e6bf6a363f37d70c6fc57
Default Alt Text
GlobalRenameLogFormatter.php (1 KB)

Event Timeline