This solution is somewhat imperfect, as the logic being added here to
MediaWikiTitleCodec really belongs in the parser. However, given the
current state of this code, this is the cleanest possible solution at
the moment.
Modified the existing release note for this.
Bug: 68802
Change-Id: I38309186bdcad23f49e23beb26daaf3ef5bceea1
* (bug 66440) The MediaWiki web installer will now allow you to choose the skins
to enable (from the ones included in download tarball) and decide which one
should be the default.
* (bug 66440) The MediaWiki web installer will now allow you to choose the skins
to enable (from the ones included in download tarball) and decide which one
should be the default.
-* (bug 68085) Links of the form [[localInterwikiPrefix:languageCode:pageTitle]],
+* (bug 68085, 68802) Links like [[localInterwikiPrefix:languageCode:pageTitle]],
where localInterwikiPrefix is a member of the $wgLocalInterwikis array, will
where localInterwikiPrefix is a member of the $wgLocalInterwikis array, will
- no longer be displayed in the sidebar when $wgInterwikiMagic is true.
+ no longer be displayed in the sidebar when $wgInterwikiMagic is true. In a
+ similar way, links like [[localInterwikiPrefix:File:Image.png]] and
+ [[localInterwikiPrefix:Category:Hello]] will now render as regular links, and
+ will not include the file or add the page to the category.
* New special page, MyLanguages, to redirect users to subpages with localised
versions of a page. (Integrated from Extension:Translate)
* MediaWiki now supports multiple password types, including bcrypt and PBKDF2.
* New special page, MyLanguages, to redirect users to subpages with localised
versions of a page. (Integrated from Extension:Translate)
* MediaWiki now supports multiple password types, including bcrypt and PBKDF2.
/** @var string Interwiki prefix */
public $mInterwiki = '';
/** @var string Interwiki prefix */
public $mInterwiki = '';
+ /** @var bool Was this Title created from a string with a local interwiki prefix? */
+ private $mLocalInterwiki = false;
+
/** @var string Title fragment (i.e. the bit after the #) */
public $mFragment = '';
/** @var string Title fragment (i.e. the bit after the #) */
public $mFragment = '';
return $this->mInterwiki;
}
return $this->mInterwiki;
}
+ /**
+ * Was this a local interwiki link?
+ *
+ * @return bool
+ */
+ public function wasLocalInterwiki() {
+ return $this->mLocalInterwiki;
+ }
+
/**
* Determine whether the object refers to a page within
* this project and is transcludable.
/**
* Determine whether the object refers to a page within
* this project and is transcludable.
# Fill fields
$this->setFragment( '#' . $parts['fragment'] );
$this->mInterwiki = $parts['interwiki'];
# Fill fields
$this->setFragment( '#' . $parts['fragment'] );
$this->mInterwiki = $parts['interwiki'];
+ $this->mLocalInterwiki = $parts['local_interwiki'];
$this->mNamespace = $parts['namespace'];
$this->mUserCaseDBKey = $parts['user_case_dbkey'];
$this->mNamespace = $parts['namespace'];
$this->mUserCaseDBKey = $parts['user_case_dbkey'];
}
# Link not escaped by : , create the various objects
}
# Link not escaped by : , create the various objects
+ if ( $noforce && !$nt->wasLocalInterwiki() ) {
# Interwikis
wfProfileIn( __METHOD__ . "-interwiki" );
# Interwikis
wfProfileIn( __METHOD__ . "-interwiki" );
- # The final condition here is due to bug 68085
if (
$iw && $this->mOptions->getInterwikiMagic() && $nottalk && (
Language::fetchLanguageName( $iw, null, 'mw' ) ||
in_array( $iw, $wgExtraInterlanguageLinkPrefixes )
if (
$iw && $this->mOptions->getInterwikiMagic() && $nottalk && (
Language::fetchLanguageName( $iw, null, 'mw' ) ||
in_array( $iw, $wgExtraInterlanguageLinkPrefixes )
- ) && substr_compare( $this->getTargetLanguage()->lc( ltrim( $origLink ) ),
- $iw, 0, strlen( $iw ) ) === 0
) {
# Bug 24502: filter duplicates
if ( !isset( $this->mLangLinkLanguages[$iw] ) ) {
) {
# Bug 24502: filter duplicates
if ( !isset( $this->mLangLinkLanguages[$iw] ) ) {
# Initialisation
$parts = array(
'interwiki' => '',
# Initialisation
$parts = array(
'interwiki' => '',
+ 'local_interwiki' => false,
'fragment' => '',
'namespace' => $defaultNamespace,
'dbkey' => $dbkey,
'fragment' => '',
'namespace' => $defaultNamespace,
'dbkey' => $dbkey,
$mainPage = Title::newMainPage();
return array(
'interwiki' => $mainPage->getInterwiki(),
$mainPage = Title::newMainPage();
return array(
'interwiki' => $mainPage->getInterwiki(),
+ 'local_interwiki' => true,
'fragment' => $mainPage->getFragment(),
'namespace' => $mainPage->getNamespace(),
'dbkey' => $mainPage->getDBkey(),
'fragment' => $mainPage->getFragment(),
'namespace' => $mainPage->getNamespace(),
'dbkey' => $mainPage->getDBkey(),
);
}
$parts['interwiki'] = '';
);
}
$parts['interwiki'] = '';
+ # local interwikis should behave like initial-colon links
+ $parts['local_interwiki'] = true;
# Do another namespace split...
continue 2;
# Do another namespace split...
continue 2;