These are unused outside the Parser and are so short it's not worth
renaming them to make them private; just hard-deprecate the methods
and inline the implementation in the small # of places they appear.
Code search:
https://codesearch.wmflabs.org/deployed/?q=areSubpagesAllowed%7CmaybeDoSubpageLink&i=nope&files=&repos=
Bug: T236810
Change-Id: Ia06c65409a3158b083bcc59c9f6e347945b375c0
(cherry picked from commit
dcae22c8fa46822148dc5fd87018acb385bf4c91)
reasons and have been deprecated: doMagicLinks, doDoubleUnderscore,
doHeadings, doAllQuotes, replaceExternalLinks, replaceInternalLinks,
replaceInternalLinks2, getVariableValue, initialiseVariables, formatHeadings,
reasons and have been deprecated: doMagicLinks, doDoubleUnderscore,
doHeadings, doAllQuotes, replaceExternalLinks, replaceInternalLinks,
replaceInternalLinks2, getVariableValue, initialiseVariables, formatHeadings,
- testPst, testPreprocess, testSrvus.
+ testPst, testPreprocess, testSrvus, areSubpagesAllowed, maybeDoSubpageLink.
=== Other changes in 1.34 ===
* Added option to specify "Various authors" as author in extension credits using
=== Other changes in 1.34 ===
* Added option to specify "Various authors" as author in extension credits using
- $useSubpages = $this->areSubpagesAllowed();
+ # Some namespaces don't allow subpages
+ $useSubpages = $this->nsInfo->hasSubpages(
+ $this->mTitle->getNamespace()
+ );
# Loop for each link
for ( ; $line !== false && $line !== null; $a->next(), $line = $a->current() ) {
# Loop for each link
for ( ; $line !== false && $line !== null; $a->next(), $line = $a->current() ) {
# Make subpage if necessary
if ( $useSubpages ) {
# Make subpage if necessary
if ( $useSubpages ) {
- $link = $this->maybeDoSubpageLink( $origLink, $text );
+ $link = Linker::normalizeSubpageLink(
+ $this->mTitle, $origLink, $text
+ );
} else {
$link = $origLink;
}
} else {
$link = $origLink;
}
/**
* Return true if subpage links should be expanded on this page.
* @return bool
/**
* Return true if subpage links should be expanded on this page.
* @return bool
+ * @deprecated since 1.34; should not be used outside parser class.
*/
public function areSubpagesAllowed() {
# Some namespaces don't allow subpages
*/
public function areSubpagesAllowed() {
# Some namespaces don't allow subpages
+ wfDeprecated( __METHOD__, '1.34' );
return $this->nsInfo->hasSubpages( $this->mTitle->getNamespace() );
}
return $this->nsInfo->hasSubpages( $this->mTitle->getNamespace() );
}
* @param string &$text The link text, modified as necessary
* @return string The full name of the link
* @private
* @param string &$text The link text, modified as necessary
* @return string The full name of the link
* @private
+ * @deprecated since 1.34; should not be used outside parser class.
*/
public function maybeDoSubpageLink( $target, &$text ) {
*/
public function maybeDoSubpageLink( $target, &$text ) {
+ wfDeprecated( __METHOD__, '1.34' );
return Linker::normalizeSubpageLink( $this->mTitle, $target, $text );
}
return Linker::normalizeSubpageLink( $this->mTitle, $target, $text );
}
$ns = NS_TEMPLATE;
# Split the title into page and subpage
$subpage = '';
$ns = NS_TEMPLATE;
# Split the title into page and subpage
$subpage = '';
- $relative = $this->maybeDoSubpageLink( $part1, $subpage );
+ $relative = Linker::normalizeSubpageLink(
+ $this->mTitle, $part1, $subpage
+ );
if ( $part1 !== $relative ) {
$part1 = $relative;
$ns = $this->mTitle->getNamespace();
if ( $part1 !== $relative ) {
$part1 = $relative;
$ns = $this->mTitle->getNamespace();