jenkins-bot has submitted this change and it was merged.

Change subject: die() with explanation when \Psr\Log\LoggerInterface is missing
......................................................................


die() with explanation when \Psr\Log\LoggerInterface is missing

Add an explicit check for the \Psr\Log\LoggerInterface in the source
file that declares MWLogger and `die()` with an explanation and links to
documentation if the interface is not present.

MediaWiki requires the PSR-3 logging library to be present in the PHP
search path or via an autoloader after I1e5596d. The composer.json for
MediaWiki requires the necessary library, but usage of Composer with
MediaWiki is not wide spread yet and users may be caught unaware by the
new dependency. The default log messages generated when PHP fails to
load the required interfaces and classes are not instructive as to how
to correct the problem.

Bug: 72777
Change-Id: I3db489702ed5d7973c6b5963eac22f181ca28c72
---
M includes/debug/logger/Logger.php
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Legoktm: Looks good to me, but someone else must approve
  Kaldari: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/debug/logger/Logger.php b/includes/debug/logger/Logger.php
index 7164bfa..f5d2445 100644
--- a/includes/debug/logger/Logger.php
+++ b/includes/debug/logger/Logger.php
@@ -19,6 +19,17 @@
  * @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.
  *

-- 
To view, visit https://gerrit.wikimedia.org/r/170274
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3db489702ed5d7973c6b5963eac22f181ca28c72
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to