Merge "Deprecate Block::isValid method"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 28 Mar 2019 03:56:20 +0000 (03:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 28 Mar 2019 03:56:20 +0000 (03:56 +0000)
1  2 
RELEASE-NOTES-1.33
includes/Block.php

diff --combined RELEASE-NOTES-1.33
@@@ -117,7 -117,7 +117,7 @@@ For notes on 1.32.x and older releases
  * Added jakub-onderka/php-console-highlighter 0.3.2 explicitly (dev-only).
  
  ==== Changed external libraries ====
 -* Updated OOUI from v0.29.2 to v0.31.1.
 +* Updated OOUI from v0.29.2 to v0.31.2.
  * Updated OOjs Router from pre-release to v0.2.0.
  * Updated moment from v2.19.3 to v2.24.0.
  * Updated wikimedia/xmp-reader from 0.6.0 to 0.6.2.
@@@ -341,9 -341,6 +341,9 @@@ because of Phabricator reports
    Use CdnCacheUpdate::newFromTitles() instead.
  * Handling of multiple arguments by the Block constructor, deprecated in 1.26,
    has been removed.
 +* The translation of main page in Sardinian (sc) was changed from "Pàgina Base"
 +  to "Pàgina printzipale". Existing wikis using this content language need to
 +  move the main page or change the name through MediaWiki:Mainpage page.
  
  === Deprecations in 1.33 ===
  * The configuration option $wgUseESI has been deprecated, and is expected
  * ManualLogEntry::setTags() is deprecated, use ManualLogEntry::addTags()
    instead. The setTags() method was overriding the tags, addTags() doesn't
    override, only adds new tags.
+ * Block::isValid is deprecated, since it is no longer needed in core.
  
  === Other changes in 1.33 ===
  * (T201747) Html::openElement() warns if given an element name with a space
    changed to explicitly cast. Subclasses relying on the base-class
    implementation should check whether they need to override it now.
  * BagOStuff::add is now abstract and must explicitly be defined in subclasses.
 +* LinksDeletionUpdate is now a subclass of LinksUpdate. As a consequence,
 +  the following hooks will now be triggered upon page deletion in addition
 +  to page updates: LinksUpdateConstructed, LinksUpdate, LinksUpdateComplete.
 +  LinksUpdateAfterInsert is not triggered since deletions do not cause
 +  insertions into links tables.
  
  == Compatibility ==
  MediaWiki 1.33 requires PHP 7.0.13 or later. Although HHVM 3.18.5 or later is
diff --combined includes/Block.php
@@@ -964,9 -964,12 +964,12 @@@ class Block 
  
        /**
         * Is the block address valid (i.e. not a null string?)
+        *
+        * @deprecated since 1.33 No longer needed in core.
         * @return bool
         */
        public function isValid() {
+               wfDeprecated( __METHOD__, '1.33' );
                return $this->getTarget() != null;
        }
  
  
                return null;
        }
 +
 +      /**
 +       * Check if the block should be tracked with a cookie.
 +       *
 +       * @since 1.33
 +       * @param bool $isIpUser The user is logged out
 +       * @return bool The block should be tracked with a cookie
 +       */
 +      public function shouldTrackWithCookie( $isIpUser ) {
 +              $config = RequestContext::getMain()->getConfig();
 +              switch ( $this->getType() ) {
 +                      case self::TYPE_IP:
 +                      case self::TYPE_RANGE:
 +                              return $isIpUser && $config->get( 'CookieSetOnIpBlock' );
 +                      case self::TYPE_USER:
 +                              return !$isIpUser && $config->get( 'CookieSetOnAutoblock' ) && $this->isAutoblocking();
 +                      default:
 +                              return false;
 +              }
 +      }
 +
 +      /**
 +       * Check if the block prevents a user from resetting their password
 +       *
 +       * @since 1.33
 +       * @return bool|null The block blocks password reset
 +       */
 +      public function appliesToPasswordReset() {
 +              switch ( $this->getSystemBlockType() ) {
 +                      case null:
 +                      case 'global-block':
 +                              return $this->isCreateAccountBlocked();
 +                      case 'proxy':
 +                              return true;
 +                      case 'dnsbl':
 +                      case 'wgSoftBlockRanges':
 +                              return false;
 +                      default:
 +                              return false;
 +              }
 +      }
 +
  }