MediaWiki
1.34.0
NamespaceImportTitleFactory.php
Go to the documentation of this file.
1
<?php
21
use
MediaWiki\MediaWikiServices
;
22
28
class
NamespaceImportTitleFactory
implements
ImportTitleFactory
{
30
protected
$ns
;
31
35
public
function
__construct
(
$ns
) {
36
if
( !MediaWikiServices::getInstance()->getNamespaceInfo()->exists(
$ns
) ) {
37
throw
new
MWException
(
"Namespace $ns doesn't exist on this wiki"
);
38
}
39
$this->ns =
$ns
;
40
}
41
50
public
function
createTitleFromForeignTitle
(
ForeignTitle
$foreignTitle ) {
51
return
Title::makeTitleSafe
( $this->ns, $foreignTitle->
getText
() );
52
}
53
}
NamespaceImportTitleFactory\__construct
__construct( $ns)
Definition:
NamespaceImportTitleFactory.php:35
NamespaceImportTitleFactory\createTitleFromForeignTitle
createTitleFromForeignTitle(ForeignTitle $foreignTitle)
Determines which local title best corresponds to the given foreign title.
Definition:
NamespaceImportTitleFactory.php:50
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition:
MediaWikiServices.php:117
ForeignTitle\getText
getText()
Definition:
ForeignTitle.php:84
NamespaceImportTitleFactory
A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...
Definition:
NamespaceImportTitleFactory.php:28
NamespaceImportTitleFactory\$ns
int $ns
Definition:
NamespaceImportTitleFactory.php:30
MWException
MediaWiki exception.
Definition:
MWException.php:26
ImportTitleFactory
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...
Definition:
ImportTitleFactory.php:25
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition:
Title.php:613
ForeignTitle
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
Definition:
ForeignTitle.php:28
includes
title
NamespaceImportTitleFactory.php
Generated on Thu Dec 19 2019 14:55:03 for MediaWiki by
1.8.16