Ensure block hooks keep user state consistent with realistic blocks
[lhc/web/wiklou.git] / includes / block / DatabaseBlock.php
index 0f19324..79286c5 100644 (file)
@@ -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 */
@@ -87,7 +93,6 @@ class DatabaseBlock extends AbstractBlock {
         *     anonOnly bool        Only disallow anonymous actions
         *     createAccount bool   Disallow creation of new accounts
         *     enableAutoblock bool Enable automatic blocking
-        *     hideName bool        Hide the target user name
         *     blockEmail bool      Disallow sending emails
         *     allowUsertalk bool   Allow the target to edit its own talk page
         *     sitewide bool        Disallow editing all pages and all contribution
@@ -106,7 +111,6 @@ class DatabaseBlock extends AbstractBlock {
                        'anonOnly'        => false,
                        'createAccount'   => false,
                        'enableAutoblock' => false,
-                       'hideName'        => false,
                        'blockEmail'      => false,
                        'allowUsertalk'   => false,
                        'sitewide'        => true,
@@ -123,7 +127,6 @@ class DatabaseBlock extends AbstractBlock {
 
                # Boolean settings
                $this->mAuto = (bool)$options['auto'];
-               $this->setHideName( (bool)$options['hideName'] );
                $this->isHardblock( !$options['anonOnly'] );
                $this->isAutoblocking( (bool)$options['enableAutoblock'] );
                $this->isSitewide( (bool)$options['sitewide'] );
@@ -265,7 +268,7 @@ class DatabaseBlock extends AbstractBlock {
         * Load blocks from the database which target the specific target exactly, or which cover the
         * vague target.
         *
-        * @param User|String|null $specificTarget
+        * @param User|string|null $specificTarget
         * @param int|null $specificType
         * @param bool $fromMaster
         * @param User|string|null $vagueTarget Also search for blocks affecting this target.  Doesn't
@@ -369,7 +372,7 @@ class DatabaseBlock extends AbstractBlock {
         * @param DatabaseBlock[] $blocks These should not include autoblocks or ID blocks
         * @return DatabaseBlock|null The block with the most specific target
         */
-       protected static function chooseMostSpecificBlock( $blocks ) {
+       protected static function chooseMostSpecificBlock( array $blocks ) {
                if ( count( $blocks ) === 1 ) {
                        return $blocks[0];
                }
@@ -535,7 +538,7 @@ class DatabaseBlock extends AbstractBlock {
         * @return bool|array False on failure, assoc array on success:
         *      ('id' => block ID, 'autoIds' => array of autoblock IDs)
         */
-       public function insert( $dbw = null ) {
+       public function insert( IDatabase $dbw = null ) {
                global $wgBlockDisablesLogin;
 
                if ( !$this->getBlocker() || $this->getBlocker()->getName() === '' ) {