*
* @file
*/
+use MediaWiki\Block\DatabaseBlock;
use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\MutableRevisionRecord;
use MediaWiki\Revision\RevisionRecord;
} else {
$specificTarget = $titleText;
}
- if ( Block::newFromTarget( $specificTarget, $vagueTarget ) instanceof Block ) {
+ if ( DatabaseBlock::newFromTarget( $specificTarget, $vagueTarget ) instanceof DatabaseBlock ) {
return [
'index' => 'noindex',
'follow' => 'nofollow'
* [[MediaWiki:Talkpagetext]]. For Article::view().
*/
public function showNamespaceHeader() {
- if ( $this->getTitle()->isTalkPage() ) {
- if ( !wfMessage( 'talkpageheader' )->isDisabled() ) {
- $this->getContext()->getOutput()->wrapWikiMsg(
- "<div class=\"mw-talkpageheader\">\n$1\n</div>",
- [ 'talkpageheader' ]
- );
- }
+ if ( $this->getTitle()->isTalkPage() && !wfMessage( 'talkpageheader' )->isDisabled() ) {
+ $this->getContext()->getOutput()->wrapWikiMsg(
+ "<div class=\"mw-talkpageheader\">\n$1\n</div>",
+ [ 'talkpageheader' ]
+ );
}
}
$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
$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( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
[ '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
LogEventsList::showLogExtract(
$outputPage,
'block',
- MWNamespace::getCanonicalName( NS_USER ) . ':' . $block->getTarget(),
+ $services->getNamespaceInfo()->getCanonicalName( NS_USER ) . ':' .
+ $block->getTarget(),
'',
[
'lim' => 1,
# 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();