44 parent::__construct(
$type );
55 return str_replace(
' ',
'_',
$title );
83 public function normalizePageName( $pageName, $followRedirect = MediaWikiPageNameNormalizer::FOLLOW_REDIRECT ) {
84 if ( defined(
'MW_PHPUNIT_TEST' ) || defined(
'MW_DEV_ENV' ) ) {
90 $t = Title::newFromText( $pageName );
91 return $t->getPrefixedText();
93 static $mediaWikiPageNameNormalizer =
null;
95 if ( $mediaWikiPageNameNormalizer ===
null ) {
99 return $mediaWikiPageNameNormalizer->normalizePageName(
118 return self::PATH_PAGE;
128 return parse_url( $this->
getPath( self::PATH_PAGE ), PHP_URL_PATH );
138 return parse_url( $this->
getPath( self::PATH_FILE ), PHP_URL_PATH );
177 if ( $url ===
null ) {
181 if ( $pageName !==
false ) {
182 $pageName = $this->
toDBKey( trim( $pageName ) );
183 $url = str_replace(
'$1',
wfUrlencode( $pageName ), $url );
202 $filePath = $this->
getPath( self::PATH_FILE );
203 if ( $filePath ===
null ) {
204 throw new RuntimeException(
"getFileUrl called for {$this->getGlobalId()} while PATH_FILE is unset" );
207 if (
$path !==
false ) {
208 $filePath = str_replace(
'$1',
$path, $filePath );
210 wfDeprecatedMsg( __METHOD__ .
': omitting $path is deprecated',
'1.40' );
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
Service for normalizing a page name via a MediaWiki action API.
Represents a single site.
getPath( $pathType)
Returns the path of the provided type or null if there is no such path.
setPath( $pathType, string $fullUrl)
Set the path used to construct links with.
getLinkPath()
Returns the path used to construct links with or false if there is no such path.