+ $context = $this->context;
+ $action = $context->getRequest()->getVal( 'action', 'view' );
+ if (
+ $e instanceof DBConnectionError &&
+ $context->hasTitle() &&
+ $context->getTitle()->canExist() &&
+ in_array( $action, [ 'view', 'history' ], true ) &&
+ HTMLFileCache::useFileCache( $this->context, HTMLFileCache::MODE_OUTAGE )
+ ) {
+ // Try to use any (even stale) file during outages...
+ $cache = new HTMLFileCache( $context->getTitle(), 'view' );
+ if ( $cache->isCached() ) {
+ $cache->loadFromFileCache( $context, HTMLFileCache::MODE_OUTAGE );
+ print MWExceptionRenderer::getHTML( $e );
+ exit;
+ }
+
+ }
+