Merge "Delete autoload.ide.php"
[lhc/web/wiklou.git] / includes / MediaWiki.php
index 7978727..3620047 100644 (file)
@@ -66,8 +66,6 @@ class MediaWiki {
         * @return Title Title object to be $wgTitle
         */
        private function parseTitle() {
-               global $wgContLang;
-
                $request = $this->context->getRequest();
                $curid = $request->getInt( 'curid' );
                $title = $request->getVal( 'title' );
@@ -88,12 +86,13 @@ class MediaWiki {
                        if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) {
                                $ret = Title::makeTitle( NS_FILE, $ret->getDBkey() );
                        }
+                       $contLang = MediaWikiServices::getInstance()->getContentLanguage();
                        // Check variant links so that interwiki links don't have to worry
                        // about the possible different language variants
-                       if ( count( $wgContLang->getVariants() ) > 1
-                               && !is_null( $ret ) && $ret->getArticleID() == 0
+                       if (
+                               $contLang->hasVariants() && !is_null( $ret ) && $ret->getArticleID() == 0
                        ) {
-                               $wgContLang->findVariantLink( $title, $ret );
+                               $contLang->findVariantLink( $title, $ret );
                        }
                }
 
@@ -104,7 +103,7 @@ class MediaWiki {
                if ( $ret === null || !$ret->isSpecialPage() ) {
                        // We can have urls with just ?diff=,?oldid= or even just ?diff=
                        $oldid = $request->getInt( 'oldid' );
-                       $oldid = $oldid ? $oldid : $request->getInt( 'diff' );
+                       $oldid = $oldid ?: $request->getInt( 'diff' );
                        // Allow oldid to override a changed or missing title
                        if ( $oldid ) {
                                $rev = Revision::newFromId( $oldid );
@@ -426,7 +425,7 @@ class MediaWiki {
                        // If $target is set, then a hook wanted to redirect.
                        if ( !$ignoreRedirect && ( $target || $page->isRedirect() ) ) {
                                // Is the target already set by an extension?
-                               $target = $target ? $target : $page->followRedirect();
+                               $target = $target ?: $page->followRedirect();
                                if ( is_string( $target ) ) {
                                        if ( !$this->config->get( 'DisableHardRedirects' ) ) {
                                                // we'll need to redirect
@@ -568,7 +567,7 @@ class MediaWiki {
 
        /**
         * @see MediaWiki::preOutputCommit()
-        * @param callable $postCommitWork [default: null]
+        * @param callable|null $postCommitWork [default: null]
         * @since 1.26
         */
        public function doPreOutputCommit( callable $postCommitWork = null ) {
@@ -580,7 +579,7 @@ class MediaWiki {
         * the user can receive a response (in case commit fails)
         *
         * @param IContextSource $context
-        * @param callable $postCommitWork [default: null]
+        * @param callable|null $postCommitWork [default: null]
         * @since 1.27
         */
        public static function preOutputCommit(
@@ -723,6 +722,9 @@ class MediaWiki {
                        MWExceptionHandler::rollbackMasterChangesAndLog( $e );
                }
 
+               // Disable WebResponse setters for post-send processing (T191537).
+               WebResponse::disableForPostSend();
+
                $blocksHttpClient = true;
                // Defer everything else if possible...
                $callback = function () use ( $mode, &$blocksHttpClient ) {