Remove '@section LICENSE'
[lhc/web/wiklou.git] / includes / debug / logger / Logger.php
index f5dd1cf..7417c6b 100644 (file)
@@ -1,6 +1,5 @@
 <?php
 /**
- * @section LICENSE
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * @file
  */
 
+if ( !interface_exists( '\Psr\Log\LoggerInterface' ) ) {
+       $message = <<<TXT
+MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging library</a> to be present. This library is not embedded directly in MediaWiki's git repository and must be installed separately by the end user.
+
+Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries">mediawiki.org</a> for help on installing the required components.
+TXT;
+       echo $message;
+       trigger_error( $message, E_USER_ERROR );
+       die( 1 );
+}
+
 /**
  * PSR-3 logging service.
  *
@@ -198,11 +208,9 @@ class MWLogger implements \Psr\Log\LoggerInterface {
        public static function getInstance( $channel ) {
                if ( self::$spi === null ) {
                        global $wgMWLoggerDefaultSpi;
-                       if ( is_callable( $wgMWLoggerDefaultSpi ) ) {
-                               $provider = $wgMWLoggerDefaultSpi();
-                       } else {
-                               $provider = new $wgMWLoggerDefaultSpi();
-                       }
+                       $provider = ObjectFactory::getObjectFromSpec(
+                               $wgMWLoggerDefaultSpi
+                       );
                        self::registerProvider( $provider );
                }