Merge "Log DNS blacklist matches with info level, non-matches with debug level"
[lhc/web/wiklou.git] / includes / block / BlockManager.php
index 0cf5eb4..4c2f27e 100644 (file)
@@ -29,6 +29,7 @@ use MediaWiki\Config\ServiceOptions;
 use MediaWiki\Permissions\PermissionManager;
 use MediaWiki\User\UserIdentity;
 use MWCryptHash;
+use Psr\Log\LoggerInterface;
 use User;
 use WebRequest;
 use WebResponse;
@@ -65,17 +66,23 @@ class BlockManager {
                'SoftBlockRanges',
        ];
 
+       /** @var LoggerInterface */
+       private $logger;
+
        /**
         * @param ServiceOptions $options
         * @param PermissionManager $permissionManager
+        * @param LoggerInterface $logger
         */
        public function __construct(
                ServiceOptions $options,
-               PermissionManager $permissionManager
+               PermissionManager $permissionManager,
+               LoggerInterface $logger
        ) {
                $options->assertRequiredOptions( self::$constructorOptions );
                $this->options = $options;
                $this->permissionManager = $permissionManager;
+               $this->logger = $logger;
        }
 
        /**
@@ -398,15 +405,14 @@ class BlockManager {
                                $ipList = $this->checkHost( $hostname );
 
                                if ( $ipList ) {
-                                       wfDebugLog(
-                                               'dnsblacklist',
+                                       $this->logger->info(
                                                "Hostname $hostname is {$ipList[0]}, it's a proxy says $basename!"
                                        );
                                        $found = true;
                                        break;
                                }
 
-                               wfDebugLog( 'dnsblacklist', "Requested $hostname, not found in $basename." );
+                               $this->logger->debug( "Requested $hostname, not found in $basename." );
                        }
                }