X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=blobdiff_plain;ds=sidebyside;f=includes%2FMediaWiki.php;h=99b1a786cebc83359bdac7e6574d410a62553ac6;hb=dcd0a3d53;hp=2a845565861633ee4d635f54d9243ac990a7ffc5;hpb=749a159cc93360272c62965445e0f8c0ee89f9a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 2a84556586..99b1a786ce 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -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 ); } @@ -499,18 +501,10 @@ class MediaWiki { $action->show(); return; } - // NOTE: deprecated hook. Add to $wgActions instead - if ( Hooks::run( - 'UnknownAction', - [ - $request->getVal( 'action', 'view' ), - $page - ], - '1.19' - ) ) { - $output->setStatusCode( 404 ); - $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); - } + + // If we've not found out which action it is by now, it's unknown + $output->setStatusCode( 404 ); + $output->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); } /** @@ -690,9 +684,10 @@ class MediaWiki { */ private static function getUrlDomainDistance( $url ) { $clusterWiki = WikiMap::getWikiFromUrl( $url ); - if ( $clusterWiki === wfWikiID() ) { + if ( WikiMap::isCurrentWikiId( $clusterWiki ) ) { return 'local'; // the current wiki - } elseif ( $clusterWiki !== false ) { + } + if ( $clusterWiki !== false ) { return 'remote'; // another wiki in this cluster/farm } @@ -1055,7 +1050,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" .