MediaWiki REL1_37
NaiveImportTitleFactory Class Reference

A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local wiki (Title objects), using a default namespace mapping. More...

Inheritance diagram for NaiveImportTitleFactory:
Collaboration diagram for NaiveImportTitleFactory:

Public Member Functions

 __construct (Language $contentLanguage, NamespaceInfo $namespaceInfo, TitleFactory $titleFactory)
 
 createTitleFromForeignTitle (ForeignTitle $foreignTitle)
 Determines which local title best corresponds to the given foreign title.
 

Private Attributes

Language $contentLanguage
 
NamespaceInfo $namespaceInfo
 
TitleFactory $titleFactory
 

Detailed Description

A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local wiki (Title objects), using a default namespace mapping.

For built-in namespaces (0 <= ID < 100), we try to find a local namespace with the same namespace ID as the foreign page. If no such namespace exists, or the namespace ID is unknown or > 100, we look for a local namespace with a matching namespace name. If that can't be found, we dump the page in the main namespace as a last resort.

Definition at line 32 of file NaiveImportTitleFactory.php.

Constructor & Destructor Documentation

◆ __construct()

NaiveImportTitleFactory::__construct ( Language  $contentLanguage,
NamespaceInfo  $namespaceInfo,
TitleFactory  $titleFactory 
)
Parameters
Language$contentLanguage
NamespaceInfo$namespaceInfo
TitleFactory$titleFactory

Definition at line 47 of file NaiveImportTitleFactory.php.

References $contentLanguage, $namespaceInfo, and $titleFactory.

Member Function Documentation

◆ createTitleFromForeignTitle()

NaiveImportTitleFactory::createTitleFromForeignTitle ( ForeignTitle  $foreignTitle)

Determines which local title best corresponds to the given foreign title.

If such a title can't be found or would be locally invalid, null is returned.

Parameters
ForeignTitle$foreignTitleThe ForeignTitle to convert
Returns
Title|null

Implements ImportTitleFactory.

Definition at line 65 of file NaiveImportTitleFactory.php.

References ForeignTitle\getFullText(), ForeignTitle\getNamespaceId(), ForeignTitle\getNamespaceName(), ForeignTitle\getText(), and ForeignTitle\isNamespaceIdKnown().

Member Data Documentation

◆ $contentLanguage

Language NaiveImportTitleFactory::$contentLanguage
private

Definition at line 34 of file NaiveImportTitleFactory.php.

Referenced by __construct().

◆ $namespaceInfo

NamespaceInfo NaiveImportTitleFactory::$namespaceInfo
private

Definition at line 37 of file NaiveImportTitleFactory.php.

Referenced by __construct().

◆ $titleFactory

TitleFactory NaiveImportTitleFactory::$titleFactory
private

Definition at line 40 of file NaiveImportTitleFactory.php.

Referenced by __construct().


The documentation for this class was generated from the following file: