Remove Title::isNamespaceProtected

It has been deprecated since 1.34 and it is unused.

Change-Id: I3f375a8d3aceb3e31c27532c28b190c41e628edf
This commit is contained in:
Matěj Suchánek 2022-06-16 18:41:49 +02:00
parent b7dd016dbc
commit 8096e6a6e3
3 changed files with 1 additions and 46 deletions

View file

@ -251,6 +251,7 @@ because of Phabricator reports.
- mediawiki.legacy.commonPrint
* LogFormatter::styleRestricedElement(), deprecated since 1.37, has been
removed. Use ::styleRestrictedElement() instead.
* Title::isNamespaceProtected(), deprecated in 1.34, has been removed.
* …
=== Deprecations in 1.39 ===

View file

@ -2488,30 +2488,6 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
);
}
/**
* Determines if $user is unable to edit this page because it has been protected
* by $wgNamespaceProtection.
*
* @deprecated since 1.34, hard-deprecated since 1.37
* @param User $user User object to check permissions
* @return bool
*/
public function isNamespaceProtected( User $user ) {
global $wgNamespaceProtection;
wfDeprecated( __METHOD__, '1.34' );
if ( isset( $wgNamespaceProtection[$this->mNamespace] ) ) {
$permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
foreach ( (array)$wgNamespaceProtection[$this->mNamespace] as $right ) {
if ( !$permissionManager->userHasRight( $user, $right ) ) {
return true;
}
}
}
return false;
}
/**
* Cascading protection: Return true if cascading restrictions apply to this page, false if not.
*

View file

@ -2108,28 +2108,6 @@ class TitleTest extends MediaWikiIntegrationTestCase {
$this->assertFalse( $title->isProtected( 'edit' ) );
}
/**
* @covers Title::isNamespaceProtected
*/
public function testIsNamespaceProtected() {
$this->hideDeprecated( 'Title::isNamespaceProtected' );
$title = $this->getExistingTestPage( 'UTest1' )->getTitle();
$this->setMwGlobals( [
'wgNamespaceProtection' => []
] );
$this->assertFalse(
$title->isNamespaceProtected( $this->getTestUser()->getUser() )
);
$this->setMwGlobals( [
'wgNamespaceProtection' => [
NS_MAIN => [ 'edit-main' ]
]
] );
$this->assertTrue(
$title->isNamespaceProtected( $this->getTestUser()->getUser() )
);
}
/**
* @covers Title::isCascadeProtected
*/