Hard-deprecate remaining MWNamespace methods

MWNamespace has been deprecated in favor of the NamespaceInfo
service in 1.34 and should no longer be used.

All methods are unused in wikimedia-deployed extensions.

Bug: T291389
Change-Id: Ibe2069dea1af983d8fda53e734396c5a7a8b7321
This commit is contained in:
Alexander Vorwerk 2021-10-10 21:39:37 +02:00
parent f0123b83b5
commit ec2cd3dc37
3 changed files with 31 additions and 10 deletions

View file

@ -240,6 +240,18 @@ because of Phabricator reports.
- ImageHistoryPseudoPager::preventClickjacking()
- ContribsPager::preventClickjacking()
* Collation::singleton() and ::factory() now trigger deprecation warnings.
* The following methods in MWNamespace, all deprecated since 1.34, now emit
deprecation warnings:
- isTalk()
- exists()
- subjectEquals()
- getCanonicalNamespaces()
- getCanonicalName()
- getCanonicalIndex()
- getValidNamespaces()
- isContent()
- hasSubpages()
- getContentNamespaces()
* Return values in the parameter $pageLang of the hook PageContentLanguage
with other types than a Language object, deprecated since 1.33, now emmits
deprecation warnings.

View file

@ -55,12 +55,13 @@ class MWNamespace {
/**
* Is the given namespace a talk namespace?
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @param int $index Namespace index
* @return bool
*/
public static function isTalk( $index ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->isTalk( $index );
}
@ -113,9 +114,10 @@ class MWNamespace {
*
* @return bool
* @since 1.19
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*/
public static function exists( $index ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->exists( $index );
}
@ -165,21 +167,23 @@ class MWNamespace {
*
* @return array
* @since 1.17
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*/
public static function getCanonicalNamespaces() {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalNamespaces();
}
/**
* Returns the canonical (English) name for a given index
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @param int $index Namespace index
* @return string|bool If no canonical definition.
*/
public static function getCanonicalName( $index ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalName( $index );
}
@ -187,12 +191,13 @@ class MWNamespace {
* Returns the index for a given canonical name, or NULL
* The input *must* be converted to lower case first
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @param string $name Namespace name
* @return int
*/
public static function getCanonicalIndex( $name ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalIndex( $name );
}
@ -200,11 +205,12 @@ class MWNamespace {
* Returns an array of the namespaces (by integer id) that exist on the
* wiki. Used primarily by the api in help documentation.
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @return array
*/
public static function getValidNamespaces() {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces();
}
@ -226,12 +232,13 @@ class MWNamespace {
* Does this namespace contain content, for the purposes of calculating
* statistics, etc?
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @param int $index Index to check
* @return bool
*/
public static function isContent( $index ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->isContent( $index );
}
@ -265,23 +272,25 @@ class MWNamespace {
/**
* Does the namespace allow subpages?
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @param int $index Index to check
* @return bool
*/
public static function hasSubpages( $index ) {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->hasSubpages( $index );
}
/**
* Get a list of all namespace indices which are considered to contain content
*
* @deprecated since 1.34
* @deprecated since 1.34, hard deprecated since 1.38
*
* @return int[] Array of namespace indices
*/
public static function getContentNamespaces() {
wfDeprecated( __METHOD__, '1.38' );
return MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces();
}

View file

@ -611,7 +611,7 @@ Title.newFromImg = function ( img ) {
/**
* Check if a given namespace is a talk namespace
*
* See MWNamespace::isTalk in PHP
* See NamespaceInfo::isTalk in PHP
*
* @param {number} namespaceId Namespace ID
* @return {boolean} Namespace is a talk namespace