MediaWiki REL1_31
SubpageImportTitleFactory.php
Go to the documentation of this file.
1<?php
28 protected $rootPage;
29
34 public function __construct( Title $rootPage ) {
35 if ( !MWNamespace::hasSubpages( $rootPage->getNamespace() ) ) {
36 throw new MWException( "The root page you specified, $rootPage, is in a " .
37 "namespace where subpages are not allowed" );
38 }
39 $this->rootPage = $rootPage;
40 }
41
50 public function createTitleFromForeignTitle( ForeignTitle $foreignTitle ) {
51 return Title::newFromText( $this->rootPage->getPrefixedDBkey() . '/' .
52 $foreignTitle->getFullText() );
53 }
54}
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
MediaWiki exception.
A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...
createTitleFromForeignTitle(ForeignTitle $foreignTitle)
Determines which local title best corresponds to the given foreign title.
Represents a title within MediaWiki.
Definition Title.php:39
getNamespace()
Get the namespace index, i.e.
Definition Title.php:970
Represents an object that can convert page titles on a foreign wiki (ForeignTitle objects) into page ...