Merge "SpecialBlock: Hard-deprecate deprecated functions"
This commit is contained in:
commit
4e30474a7c
3 changed files with 25 additions and 4 deletions
|
|
@ -950,6 +950,10 @@ because of Phabricator reports.
|
|||
details, see <https://developer.mozilla.org/en-US/docs/Web/API/URL>.
|
||||
* The parameter $default in WebRequest::getRawVal() is deprecated. Use ??
|
||||
instead.
|
||||
* SpecialBlock::processForm(), SpecialBlock::parseExpiryInput() and
|
||||
SpecialBlock::canBlockEmail(), deprecated since 1.36, and
|
||||
SpecialBlock::getSuggestedDurations(), deprecated since 1.42, now emit
|
||||
deprecation warnings.
|
||||
* …
|
||||
|
||||
=== Other changes in 1.43 ===
|
||||
|
|
|
|||
|
|
@ -907,12 +907,14 @@ class SpecialBlock extends FormSpecialPage {
|
|||
/**
|
||||
* Given the form data, actually implement a block.
|
||||
*
|
||||
* @deprecated since 1.36, use BlockUserFactory service instead
|
||||
* @deprecated since 1.36, use BlockUserFactory service instead,
|
||||
* hard-deprecated since 1.43
|
||||
* @param array $data
|
||||
* @param IContextSource $context
|
||||
* @return bool|string|array|Status
|
||||
*/
|
||||
public static function processForm( array $data, IContextSource $context ) {
|
||||
wfDeprecated( __METHOD__, '1.36' );
|
||||
$services = MediaWikiServices::getInstance();
|
||||
return self::processFormInternal(
|
||||
$data,
|
||||
|
|
@ -1081,7 +1083,8 @@ class SpecialBlock extends FormSpecialPage {
|
|||
* Get an array of suggested block durations from MediaWiki:Ipboptions
|
||||
* @todo FIXME: This uses a rather odd syntax for the options, should it be converted
|
||||
* to the standard "**<duration>|<displayname>" format?
|
||||
* @deprecated since 1.42, use Language::getBlockDurations() instead.
|
||||
* @deprecated since 1.42, use Language::getBlockDurations() instead,
|
||||
* hard-deprecated since 1.43
|
||||
* @param Language|null $lang The language to get the durations in, or null to use
|
||||
* the wiki's content language
|
||||
* @param bool $includeOther Whether to include the 'other' option in the list of
|
||||
|
|
@ -1089,6 +1092,7 @@ class SpecialBlock extends FormSpecialPage {
|
|||
* @return string[]
|
||||
*/
|
||||
public static function getSuggestedDurations( Language $lang = null, $includeOther = true ) {
|
||||
wfDeprecated( __METHOD__, '1.42' );
|
||||
$lang ??= MediaWikiServices::getInstance()->getContentLanguage();
|
||||
return $lang->getBlockDurations( $includeOther );
|
||||
}
|
||||
|
|
@ -1097,23 +1101,27 @@ class SpecialBlock extends FormSpecialPage {
|
|||
* Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute
|
||||
* ("24 May 2034", etc), into an absolute timestamp we can put into the database.
|
||||
*
|
||||
* @deprecated since 1.36, use BlockUser::parseExpiryInput instead
|
||||
* @deprecated since 1.36, use BlockUser::parseExpiryInput instead,
|
||||
* hard-deprecated since 1.43
|
||||
*
|
||||
* @param string $expiry Whatever was typed into the form
|
||||
* @return string|bool Timestamp or 'infinity' or false on error.
|
||||
*/
|
||||
public static function parseExpiryInput( $expiry ) {
|
||||
wfDeprecated( __METHOD__, '1.36' );
|
||||
return BlockUser::parseExpiryInput( $expiry );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can we do an email block?
|
||||
*
|
||||
* @deprecated since 1.36, use BlockPermissionChecker service instead
|
||||
* @deprecated since 1.36, use BlockPermissionChecker service instead,
|
||||
* hard-deprecated since 1.43
|
||||
* @param UserIdentity $user The sysop wanting to make a block
|
||||
* @return bool
|
||||
*/
|
||||
public static function canBlockEmail( UserIdentity $user ) {
|
||||
wfDeprecated( __METHOD__, '1.36' );
|
||||
return MediaWikiServices::getInstance()
|
||||
->getBlockPermissionCheckerFactory()
|
||||
->newBlockPermissionChecker( null, User::newFromIdentity( $user ) )
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessForm() {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$badActor = $this->getTestUser()->getUserIdentity();
|
||||
$context = RequestContext::getMain();
|
||||
$context->setUser( $this->getTestSysop()->getUser() );
|
||||
|
|
@ -223,6 +224,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormExisting() {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$badActor = $this->getTestUser()->getUser();
|
||||
$sysop = $this->getTestSysop()->getUser();
|
||||
$context = RequestContext::getMain();
|
||||
|
|
@ -270,6 +272,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormRestrictions() {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$this->overrideConfigValue( MainConfigNames::EnablePartialActionBlocks, true );
|
||||
|
||||
$badActor = $this->getTestUser()->getUser();
|
||||
|
|
@ -326,6 +329,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormRestrictionsChange() {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$badActor = $this->getTestUser()->getUser();
|
||||
$context = RequestContext::getMain();
|
||||
$context->setUser( $this->getTestSysop()->getUser() );
|
||||
|
|
@ -430,6 +434,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormUserTalkEditFlag( $options, $expected ) {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$this->overrideConfigValue( MainConfigNames::BlockAllowsUTEdit, $options['configAllowsUserTalkEdit'] );
|
||||
|
||||
$performer = $this->getTestSysop()->getUser();
|
||||
|
|
@ -537,6 +542,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormErrors( $data, $expected, $options = [] ) {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$this->overrideConfigValue( MainConfigNames::BlockAllowsUTEdit, true );
|
||||
|
||||
$performer = $this->getTestSysop()->getUser();
|
||||
|
|
@ -645,6 +651,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormErrorsReblock( $data, $permissions, $expected ) {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$this->overrideConfigValue( MainConfigNames::BlockAllowsUTEdit, true );
|
||||
|
||||
$performer = $this->getTestSysop()->getUser();
|
||||
|
|
@ -728,6 +735,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormErrorsHideUser( $data, $permissions, $expected ) {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$performer = $this->getTestSysop()->getUser();
|
||||
$this->overrideUserPermissions( $performer, array_merge( $permissions, [ 'block' ] ) );
|
||||
|
||||
|
|
@ -789,6 +797,7 @@ class SpecialBlockTest extends SpecialPageTestBase {
|
|||
* @covers ::processForm
|
||||
*/
|
||||
public function testProcessFormErrorsHideUserProlific() {
|
||||
$this->hideDeprecated( SpecialBlock::class . '::processForm' );
|
||||
$this->overrideConfigValue( MainConfigNames::HideUserContribLimit, 0 );
|
||||
|
||||
$performer = $this->mockRegisteredUltimateAuthority();
|
||||
|
|
|
|||
Loading…
Reference in a new issue