Merge "Update weblinks in comments from HTTP to HTTPS"
[lhc/web/wiklou.git] / includes / user / User.php
index 6083db9..273d555 100644 (file)
@@ -26,6 +26,7 @@ use MediaWiki\Session\Token;
 use MediaWiki\Auth\AuthManager;
 use MediaWiki\Auth\AuthenticationResponse;
 use MediaWiki\Auth\AuthenticationRequest;
+use Wikimedia\ScopedCallback;
 
 /**
  * String Some punctuation to prevent editing from broken text-mangling proxies.
@@ -320,7 +321,7 @@ class User implements IDBAccessObject {
         * @return string
         */
        public function __toString() {
-               return $this->getName();
+               return (string)$this->getName();
        }
 
        /**
@@ -1657,7 +1658,6 @@ class User implements IDBAccessObject {
 
                // Extensions
                Hooks::run( 'GetBlockedStatus', [ &$this ] );
-
        }
 
        /**
@@ -1689,9 +1689,8 @@ class User implements IDBAccessObject {
         * @return bool True if blacklisted.
         */
        public function inDnsBlacklist( $ip, $bases ) {
-
                $found = false;
-               // @todo FIXME: IPv6 ???  (http://bugs.php.net/bug.php?id=33170)
+               // @todo FIXME: IPv6 ???  (https://bugs.php.net/bug.php?id=33170)
                if ( IP::isIPv4( $ip ) ) {
                        // Reverse IP, bug 21255
                        $ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) );
@@ -1802,12 +1801,16 @@ class User implements IDBAccessObject {
                        return false;
                }
 
+               $limits = array_merge(
+                       [ '&can-bypass' => true ],
+                       $wgRateLimits[$action]
+               );
+
                // Some groups shouldn't trigger the ping limiter, ever
-               if ( !$this->isPingLimitable() ) {
+               if ( $limits['&can-bypass'] && !$this->isPingLimitable() ) {
                        return false;
                }
 
-               $limits = $wgRateLimits[$action];
                $keys = [];
                $id = $this->getId();
                $userLimit = false;