Import PSR NullLogger instead of using absolute class references
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 28 Jun 2019 16:45:15 +0000 (09:45 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sun, 14 Jul 2019 06:35:52 +0000 (23:35 -0700)
Change-Id: Ie09170f51e203e0a4c9a780a53cc9f3829139c31

includes/libs/filebackend/FileBackend.php
includes/libs/lockmanager/LockManager.php
includes/libs/mime/MimeAnalyzer.php
includes/libs/redis/RedisConnectionPool.php
includes/session/PHPSessionHandler.php

index 53a0ca0..4ad48c7 100644 (file)
@@ -30,6 +30,7 @@
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
 use Wikimedia\ScopedCallback;
+use Psr\Log\NullLogger;
 
 /**
  * @brief Base class for all file backend classes (including multi-write backends).
@@ -190,7 +191,7 @@ abstract class FileBackend implements LoggerAwareInterface {
                if ( !is_callable( $this->profiler ) ) {
                        $this->profiler = null;
                }
-               $this->logger = $config['logger'] ?? new \Psr\Log\NullLogger();
+               $this->logger = $config['logger'] ?? new NullLogger();
                $this->statusWrapper = $config['statusWrapper'] ?? null;
                $this->tmpDirectory = $config['tmpDirectory'] ?? null;
        }
index d152c65..b8d3ad2 100644 (file)
@@ -4,6 +4,7 @@
  * @ingroup FileBackend
  */
 use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 use Wikimedia\WaitConditionLoop;
 
 /**
@@ -101,7 +102,7 @@ abstract class LockManager {
                }
                $this->session = md5( implode( '-', $random ) );
 
-               $this->logger = $config['logger'] ?? new \Psr\Log\NullLogger();
+               $this->logger = $config['logger'] ?? new NullLogger();
        }
 
        /**
index 42146f4..2462174 100644 (file)
@@ -21,6 +21,7 @@
  */
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 
 /**
  * Implements functions related to MIME types such as detection and mapping to file extension
@@ -199,7 +200,7 @@ EOT;
                $this->detectCallback = $params['detectCallback'] ?? null;
                $this->guessCallback = $params['guessCallback'] ?? null;
                $this->extCallback = $params['extCallback'] ?? null;
-               $this->logger = $params['logger'] ?? new \Psr\Log\NullLogger();
+               $this->logger = $params['logger'] ?? new NullLogger();
 
                $this->loadFiles();
        }
index 9a8086f..b477855 100644 (file)
@@ -23,6 +23,7 @@
 
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
 
 /**
  * Helper class to manage Redis connections.
@@ -81,7 +82,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
                                __CLASS__ . ' requires a Redis client library. ' .
                                'See https://www.mediawiki.org/wiki/Redis#Setup' );
                }
-               $this->logger = $options['logger'] ?? new \Psr\Log\NullLogger();
+               $this->logger = $options['logger'] ?? new NullLogger();
                $this->connectTimeout = $options['connectTimeout'];
                $this->readTimeout = $options['readTimeout'];
                $this->persistent = $options['persistent'];
index 4d447d3..64c2b84 100644 (file)
@@ -25,6 +25,7 @@ namespace MediaWiki\Session;
 
 use Psr\Log\LoggerInterface;
 use BagOStuff;
+use Psr\Log\NullLogger;
 
 /**
  * Adapter for PHP's session handling
@@ -299,7 +300,7 @@ class PHPSessionHandler implements \SessionHandlerInterface {
                }
                // Anything deleted in $_SESSION and unchanged in Session should be deleted too
                // (but not if $_SESSION can't represent it at all)
-               \Wikimedia\PhpSessionSerializer::setLogger( new \Psr\Log\NullLogger() );
+               \Wikimedia\PhpSessionSerializer::setLogger( new NullLogger() );
                foreach ( $cache as $key => $value ) {
                        if ( !array_key_exists( $key, $data ) && $session->exists( $key ) &&
                                \Wikimedia\PhpSessionSerializer::encode( [ $key => true ] )