70 $base = $provided =
null;
71 if ( $subpage !==
null ) {
72 $provided = Title::newFromText( $subpage );
75 if ( $provided && strpos( $subpage,
'/' ) !==
false ) {
76 $pos = strrpos( $subpage,
'/' );
77 $basepage = substr( $subpage, 0, $pos );
78 $code = substr( $subpage, $pos + 1 );
79 if ( strlen( $code ) && Language::isKnownLanguageTag( $code ) ) {
80 $base = Title::newFromText( $basepage );
90 if (
$base->isRedirect() ) {
92 $base = $page->getRedirectTarget();
96 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
98 if ( $uiLang->equals( $contLang ) ) {
105 $proposed =
$base->getSubpage( $uiLang->getCode() );
106 if ( $proposed && $proposed->exists() ) {
110 if ( $provided !==
$base && $provided->exists() ) {
116 $possibilities = $uiLang->getFallbackLanguages();
117 foreach ( $possibilities as
$lang ) {
118 if (
$lang !== $contLang->getCode() ) {
120 if ( $proposed && $proposed->exists() ) {