X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FWebStart.php;h=fb6c3e6768dd0ff61e595f777e7433176612e54a;hp=b095577c74682178cfabd8464d74db3799ad46ad;hb=a2ea9f8b9289f197844e3282c2ac39e59c549996;hpb=9e6032545bfb638963ac999420942b60ef82e240 diff --git a/includes/WebStart.php b/includes/WebStart.php index b095577c74..fb6c3e6768 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -40,7 +40,6 @@ if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) { . 'for help on how to disable magic quotes.' ); } - # bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this # We're adding it here so that it's *always* set, even for alternate entry # points and when $wgOut gets disabled or overridden. @@ -91,7 +90,6 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) { require "$IP/StartProfiler.php"; } - # Load default settings require_once "$IP/includes/DefaultSettings.php"; @@ -103,6 +101,24 @@ if ( is_readable( "$IP/vendor/autoload.php" ) ) { require_once "$IP/vendor/autoload.php"; } +# Assert that composer dependencies were successfully loaded +# Purposely no leading \ due to it breaking HHVM RepoAuthorative mode +# PHP works fine with both versions +# See https://github.com/facebook/hhvm/issues/5833 +if ( !interface_exists( 'Psr\Log\LoggerInterface' ) ) { + $message = ( + 'MediaWiki requires the PSR-3 logging ' . + "library to be present. This library is not embedded directly in MediaWiki's " . + "git repository and must be installed separately by the end user.\n\n" . + 'Please see mediawiki.org for help on installing ' . + 'the required components.' + ); + echo $message; + trigger_error( $message, E_USER_ERROR ); + die( 1 ); +} + if ( defined( 'MW_CONFIG_CALLBACK' ) ) { # Use a callback function to configure MediaWiki call_user_func( MW_CONFIG_CALLBACK ); @@ -123,7 +139,6 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) { require_once MW_CONFIG_FILE; } - # Initialise output buffering # Check that there is no previous output or previously set up buffers, because # that would cause us to potentially mix gzip and non-gzip output, creating a @@ -141,3 +156,25 @@ if ( !defined( 'MW_NO_SETUP' ) ) { if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) { ignore_user_abort( true ); } + +if ( !defined( 'MW_API' ) && + RequestContext::getMain()->getRequest()->getHeader( 'Promise-Non-Write-API-Action' ) +) { + header( 'Cache-Control: no-cache' ); + header( 'Content-Type: text/html; charset=utf-8' ); + HttpStatus::header( 400 ); + $error = wfMessage( 'nonwrite-api-promise-error' )->escaped(); + $content = << + + + +$error + + + +EOT; + header( 'Content-Length: ' . strlen( $content ) ); + echo $content; + die(); +}