X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FMediaWiki.php;h=4df4d76f5366cc7a7ace050219771d167f6d822a;hp=2125c23499d0834bff280c895861fa699655b7e2;hb=12601ff7d2796752404bfb331fccc41083d31f9f;hpb=7f65646f35fca0544e6fc388f884bfedcb9a8948 diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 2125c23499..4df4d76f53 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -539,13 +539,12 @@ class MediaWiki { HTMLFileCache::useFileCache( $this->context, HTMLFileCache::MODE_OUTAGE ) ) { // Try to use any (even stale) file during outages... - $cache = new HTMLFileCache( $context->getTitle(), 'view' ); + $cache = new HTMLFileCache( $context->getTitle(), $action ); if ( $cache->isCached() ) { $cache->loadFromFileCache( $context, HTMLFileCache::MODE_OUTAGE ); print MWExceptionRenderer::getHTML( $e ); exit; } - } MWExceptionHandler::handleException( $e ); @@ -720,21 +719,28 @@ class MediaWiki { * @since 1.26 */ public function doPostOutputShutdown( $mode = 'normal' ) { - $timing = $this->context->getTiming(); - $timing->mark( 'requestShutdown' ); - - // Show visible profiling data if enabled (which cannot be post-send) - Profiler::instance()->logDataPageOutputOnly(); + // Perform the last synchronous operations... + try { + // Record backend request timing + $timing = $this->context->getTiming(); + $timing->mark( 'requestShutdown' ); + // Show visible profiling data if enabled (which cannot be post-send) + Profiler::instance()->logDataPageOutputOnly(); + } catch ( Exception $e ) { + // An error may already have been shown in run(), so just log it to be safe + MWExceptionHandler::rollbackMasterChangesAndLog( $e ); + } + // Defer everything else if possible... $callback = function () use ( $mode ) { try { $this->restInPeace( $mode ); } catch ( Exception $e ) { - MWExceptionHandler::handleException( $e ); + // If this is post-send, then displaying errors can cause broken HTML + MWExceptionHandler::rollbackMasterChangesAndLog( $e ); } }; - // Defer everything else... if ( function_exists( 'register_postsend_function' ) ) { // https://github.com/facebook/hhvm/issues/1230 register_postsend_function( $callback ); @@ -815,7 +821,6 @@ class MediaWiki { // ATTENTION: This hook is likely to be removed soon due to overall design of the system. if ( Hooks::run( 'BeforeHttpsRedirect', [ $this->context, &$redirUrl ] ) ) { - if ( $request->wasPosted() ) { // This is weird and we'd hope it almost never happens. This // means that a POST came in via HTTP and policy requires us @@ -898,9 +903,8 @@ class MediaWiki { __METHOD__ ); - // Push lazilly-pushed jobs // Important: this must be the last deferred update added (T100085, T154425) - DeferredUpdates::addCallableUpdate( [ 'JobQueueGroup', 'pushLazyJobs' ] ); + DeferredUpdates::addCallableUpdate( [ JobQueueGroup::class, 'pushLazyJobs' ] ); // Do any deferred jobs DeferredUpdates::doUpdates( 'enqueue' );