Merge "Use <div> wrappers instead of <p> in ProtectionForm"
[lhc/web/wiklou.git] / includes / MediaWiki.php
index 3620047..e10a530 100644 (file)
@@ -250,14 +250,15 @@ class MediaWiki {
                // Redirect loops, titleless URL, $wgUsePathInfo URLs, and URLs with a variant
                } elseif ( !$this->tryNormaliseRedirect( $title ) ) {
                        // Prevent information leak via Special:MyPage et al (T109724)
+                       $spFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
                        if ( $title->isSpecialPage() ) {
-                               $specialPage = SpecialPageFactory::getPage( $title->getDBkey() );
+                               $specialPage = $spFactory->getPage( $title->getDBkey() );
                                if ( $specialPage instanceof RedirectSpecialPage ) {
                                        $specialPage->setContext( $this->context );
                                        if ( $this->config->get( 'HideIdentifiableRedirects' )
                                                && $specialPage->personallyIdentifiableTarget()
                                        ) {
-                                               list( , $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
+                                               list( , $subpage ) = $spFactory->resolveAlias( $title->getDBkey() );
                                                $target = $specialPage->getRedirect( $subpage );
                                                // target can also be true. We let that case fall through to normal processing.
                                                if ( $target instanceof Title ) {
@@ -284,7 +285,7 @@ class MediaWiki {
                        // Special pages ($title may have changed since if statement above)
                        if ( $title->isSpecialPage() ) {
                                // Actions that need to be made when we have a special pages
-                               SpecialPageFactory::executePath( $title, $this->context );
+                               $spFactory->executePath( $title, $this->context );
                        } else {
                                // ...otherwise treat it as an article view. The article
                                // may still be a wikipage redirect to another article or URL.
@@ -338,7 +339,8 @@ class MediaWiki {
                }
 
                if ( $title->isSpecialPage() ) {
-                       list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
+                       list( $name, $subpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
+                               resolveAlias( $title->getDBkey() );
                        if ( $name ) {
                                $title = SpecialPage::getTitleFor( $name, $subpage );
                        }
@@ -367,6 +369,11 @@ class MediaWiki {
                        }
                        throw new HttpError( 500, $message );
                }
+               // Protect against redirects to NS_MEDIA namespace
+               // when the user probably wants NS_FILE
+               if ( $title->inNamespace( NS_MEDIA ) ) {
+                       $title->mNamespace = NS_FILE;
+               }
                $output->setCdnMaxage( 1200 );
                $output->redirect( $targetUrl, '301' );
                return true;
@@ -866,7 +873,7 @@ class MediaWiki {
                $this->performRequest();
 
                // GUI-ify and stash the page output in MediaWiki::doPreOutputCommit() while
-               // ChronologyProtector synchronizes DB positions or replicas accross all datacenters.
+               // ChronologyProtector synchronizes DB positions or replicas across all datacenters.
                $buffer = null;
                $outputWork = function () use ( $output, &$buffer ) {
                        if ( $buffer === null ) {
@@ -1055,7 +1062,8 @@ class MediaWiki {
 
                $invokedWithSuccess = true;
                if ( $sock ) {
-                       $special = SpecialPageFactory::getPage( 'RunJobs' );
+                       $special = MediaWikiServices::getInstance()->getSpecialPageFactory()->
+                               getPage( 'RunJobs' );
                        $url = $special->getPageTitle()->getCanonicalURL( $query );
                        $req = (
                                "POST $url HTTP/1.1\r\n" .