X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=aa38d1f7872af058fee73b376a5f08383ebbf810;hp=d71cdcb5f42f47d7352dc133af621fa763c6d2f6;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=e895217711438e8ba84ec8232daf90b9c0d6cf1d diff --git a/includes/page/Article.php b/includes/page/Article.php index d71cdcb5f4..aa38d1f787 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -19,6 +19,7 @@ * * @file */ +use MediaWiki\Block\DatabaseBlock; use MediaWiki\MediaWikiServices; use MediaWiki\Revision\MutableRevisionRecord; use MediaWiki\Revision\RevisionRecord; @@ -959,7 +960,7 @@ class Article implements Page { } else { $specificTarget = $titleText; } - if ( Block::newFromTarget( $specificTarget, $vagueTarget ) instanceof Block ) { + if ( DatabaseBlock::newFromTarget( $specificTarget, $vagueTarget ) instanceof DatabaseBlock ) { return [ 'index' => 'noindex', 'follow' => 'nofollow' @@ -1131,13 +1132,11 @@ class Article implements Page { * [[MediaWiki:Talkpagetext]]. For Article::view(). */ public function showNamespaceHeader() { - if ( $this->getTitle()->isTalkPage() ) { - if ( !wfMessage( 'talkpageheader' )->isDisabled() ) { - $this->getContext()->getOutput()->wrapWikiMsg( - "
\n$1\n
", - [ 'talkpageheader' ] - ); - } + if ( $this->getTitle()->isTalkPage() && !wfMessage( 'talkpageheader' )->isDisabled() ) { + $this->getContext()->getOutput()->wrapWikiMsg( + "
\n$1\n
", + [ 'talkpageheader' ] + ); } } @@ -1354,6 +1353,8 @@ class Article implements Page { $title = $this->getTitle(); + $services = MediaWikiServices::getInstance(); + # Show info in user (talk) namespace. Does the user exist? Is he blocked? if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK @@ -1361,14 +1362,14 @@ class Article implements Page { $rootPart = explode( '/', $title->getText() )[0]; $user = User::newFromName( $rootPart, false /* allow IP users */ ); $ip = User::isIP( $rootPart ); - $block = Block::newFromTarget( $user, $user ); + $block = DatabaseBlock::newFromTarget( $user, $user ); if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist $outputPage->wrapWikiMsg( "
\n\$1\n
", [ 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ] ); } elseif ( !is_null( $block ) && - $block->getType() != Block::TYPE_AUTO && + $block->getType() != DatabaseBlock::TYPE_AUTO && ( $block->isSitewide() || $user->isBlockedFrom( $title ) ) ) { // Show log extract if the user is sitewide blocked or is partially @@ -1376,7 +1377,8 @@ class Article implements Page { LogEventsList::showLogExtract( $outputPage, 'block', - MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(), + $services->getNamespaceInfo()->getCanonicalName( NS_USER ) . ':' . + $block->getTarget(), '', [ 'lim' => 1, @@ -1398,7 +1400,7 @@ class Article implements Page { # Show delete and move logs if there were any such events. # The logging query can DOS the site when bots/crawlers cause 404 floods, # so be careful showing this. 404 pages must be cheap as they are hard to cache. - $cache = MediaWikiServices::getInstance()->getMainObjectStash(); + $cache = $services->getMainObjectStash(); $key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) ); $loggedIn = $this->getContext()->getUser()->isLoggedIn(); $sessionExists = $this->getContext()->getRequest()->getSession()->isPersistent(); @@ -2733,7 +2735,7 @@ class Article implements Page { * @see WikiPage::setTimestamp */ public function setTimestamp( $ts ) { - return $this->mPage->setTimestamp( $ts ); + $this->mPage->setTimestamp( $ts ); } /**