Merge "Break long lines in OutputPage::sendCacheControl()"
[lhc/web/wiklou.git] / includes / MediaWiki.php
index 2fce08c..f7e57fc 100644 (file)
@@ -529,11 +529,12 @@ class MediaWiki {
                        }
                } catch ( Exception $e ) {
                        $context = $this->context;
+                       $action = $context->getRequest()->getVal( 'action', 'view' );
                        if (
                                $e instanceof DBConnectionError &&
                                $context->hasTitle() &&
                                $context->getTitle()->canExist() &&
-                               $context->getRequest()->getVal( 'action', 'view' ) === 'view' &&
+                               in_array( $action, [ 'view', 'history' ], true ) &&
                                HTMLFileCache::useFileCache( $this->context, HTMLFileCache::MODE_OUTAGE )
                        ) {
                                // Try to use any (even stale) file during outages...
@@ -675,14 +676,14 @@ class MediaWiki {
        /**
         * @param string $url
         * @param IContextSource $context
-        * @return string|bool Either "local" or "remote" if in the farm, false otherwise
+        * @return string Either "local", "remote" if in the farm, "external" otherwise
         */
-       private function getUrlDomainDistance( $url, IContextSource $context ) {
+       private static function getUrlDomainDistance( $url, IContextSource $context ) {
                static $relevantKeys = [ 'host' => true, 'port' => true ];
 
                $infoCandidate = wfParseUrl( $url );
                if ( $infoCandidate === false ) {
-                       return false;
+                       return 'external';
                }
 
                $infoCandidate = array_intersect_key( $infoCandidate, $relevantKeys );
@@ -704,7 +705,7 @@ class MediaWiki {
                        }
                }
 
-               return false;
+               return 'external';
        }
 
        /**
@@ -898,6 +899,7 @@ class MediaWiki {
 
                // Do any deferred jobs
                DeferredUpdates::doUpdates( 'enqueue' );
+               DeferredUpdates::setImmediateMode( true );
 
                // Make sure any lazy jobs are pushed
                JobQueueGroup::pushLazyJobs();