From: Thalia Date: Mon, 29 Jul 2019 20:10:27 +0000 (+0100) Subject: Deprecate several public properties on the block classes X-Git-Tag: 1.34.0-rc.0~847^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=f45359a0a9a0b2b133997f754e260118207d255a;p=lhc%2Fweb%2Fwiklou.git Deprecate several public properties on the block classes Public methods for checking and setting these properties already exist where needed. Also update the remaining direct uses of these properties in core. Change-Id: Icdef025c9700e625aeb2a07975e69f1b1cc2466c --- diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index 3e51f2ddcd..1610637f19 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -417,6 +417,11 @@ because of Phabricator reports. to be prevented. Modifying the $purgeBlobs parameter now has no effect. * SVGMetadataExtractor::getMetadata has been deprecated. Instead, you should use SVGReader->getMetadata() directly. +* The following public properties on AbstractBlock are deprecated: $mReason, + $mTimestamp, $mExpiry, $mHideName. Use the getters/setters instead. +* The following public properties on DatabaseBlock are deprecated: $mAuto, + $mParentBlockId. To check for an autoblock use DatabaseBlock::getType; to + check for the parent ID, use DatabaseBlock::getParentBlockId. === Other changes in 1.34 === * … diff --git a/includes/block/AbstractBlock.php b/includes/block/AbstractBlock.php index d24a2a5773..f6544040bb 100644 --- a/includes/block/AbstractBlock.php +++ b/includes/block/AbstractBlock.php @@ -31,13 +31,22 @@ use User; * @since 1.34 Factored out from DatabaseBlock (previously Block). */ abstract class AbstractBlock { - /** @var string */ + /** + * @deprecated since 1.34. Use getReason and setReason instead. + * @var string + */ public $mReason; - /** @var string */ + /** + * @deprecated since 1.34. Use getTimestamp and setTimestamp instead. + * @var string + */ public $mTimestamp; - /** @var string */ + /** + * @deprecated since 1.34. Use getExpiry and setExpiry instead. + * @var string + */ public $mExpiry = ''; /** @var bool */ @@ -49,7 +58,10 @@ abstract class AbstractBlock { /** @var bool */ protected $blockCreateAccount = false; - /** @var bool */ + /** + * @deprecated since 1.34. Use getHideName and setHideName instead. + * @var bool + */ public $mHideName = false; /** @var User|string */ diff --git a/includes/block/DatabaseBlock.php b/includes/block/DatabaseBlock.php index fbf9a073ca..2fd62ee332 100644 --- a/includes/block/DatabaseBlock.php +++ b/includes/block/DatabaseBlock.php @@ -53,10 +53,16 @@ use Wikimedia\Rdbms\IDatabase; * @since 1.34 Renamed from Block. */ class DatabaseBlock extends AbstractBlock { - /** @var bool */ + /** + * @deprecated since 1.34. Use getType to check whether a block is autoblocking. + * @var bool + */ public $mAuto; - /** @var int */ + /** + * @deprecated since 1.34. Use getParentBlockId instead. + * @var int + */ public $mParentBlockId; /** @var int */ diff --git a/tests/phpunit/includes/Permissions/PermissionManagerTest.php b/tests/phpunit/includes/Permissions/PermissionManagerTest.php index 8a98217326..8108639f21 100644 --- a/tests/phpunit/includes/Permissions/PermissionManagerTest.php +++ b/tests/phpunit/includes/Permissions/PermissionManagerTest.php @@ -1161,7 +1161,7 @@ class PermissionManagerTest extends MediaWikiLangTestCase { 'auto' => true, 'expiry' => 0 ] ); - $this->user->mBlock->mTimestamp = 0; + $this->user->mBlock->setTimestamp( 0 ); $this->assertEquals( [ [ 'autoblockedtext', "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1', "\u{202A}Useruser\u{202C}", null, 'infinite', '127.0.8.1',