*/
use MediaWiki\MediaWikiServices;
+use MediaWiki\Revision\RevisionRecord;
/**
* @ingroup Pager
* @return string HTML output
*/
protected function getStartBody() {
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$this->lastRow = false;
$this->counter = 1;
$this->oldIdChecked = 0;
$user = $this->getUser();
$actionButtons = '';
- if ( $user->isAllowed( 'deleterevision' ) ) {
+ if ( $permissionManager->userHasRight( $user, 'deleterevision' ) ) {
$actionButtons .= $this->getRevisionButton(
'revisiondelete', 'showhideselectedversions' );
}
'mw-history-revisionactions' ], $actionButtons );
}
- if ( $user->isAllowed( 'deleterevision' ) || $this->showTagEditUI ) {
+ if ( $permissionManager->userHasRight( $user, 'deleterevision' ) || $this->showTagEditUI ) {
$this->buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML();
}
*/
function historyLine( $row, $next, $notificationtimestamp = false,
$dummy = false, $firstInList = false ) {
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
$rev = new Revision( $row, 0, $this->getTitle() );
if ( is_object( $next ) ) {
$del = '';
$user = $this->getUser();
- $canRevDelete = $user->isAllowed( 'deleterevision' );
+ $canRevDelete = $permissionManager->userHasRight( $user, 'deleterevision' );
// Show checkboxes for each revision, to allow for revision deletion and
// change tags
if ( $canRevDelete || $this->showTagEditUI ) {
$this->preventClickjacking();
// If revision was hidden from sysops and we don't need the checkbox
// for anything else, disable it
- if ( !$this->showTagEditUI && !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
+ if ( !$this->showTagEditUI
+ && !$rev->userCan( RevisionRecord::DELETED_RESTRICTED, $user )
+ ) {
$del = Xml::check( 'deleterevisions', false, [ 'disabled' => 'disabled' ] );
// Otherwise, enable the checkbox...
} else {
[ 'name' => 'ids[' . $rev->getId() . ']' ] );
}
// User can only view deleted revisions...
- } elseif ( $rev->getVisibility() && $user->isAllowed( 'deletedhistory' ) ) {
+ } elseif ( $rev->getVisibility() &&
+ $permissionManager->userHasRight( $user, 'deletedhistory' ) ) {
// If revision was hidden from sysops, disable the link
- if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
+ if ( !$rev->userCan( RevisionRecord::DELETED_RESTRICTED, $user ) ) {
$del = Linker::revDeleteLinkDisabled( false );
// Otherwise, show the link...
} else {
$query = [ 'type' => 'revision',
'target' => $this->getTitle()->getPrefixedDBkey(), 'ids' => $rev->getId() ];
$del .= Linker::revDeleteLink( $query,
- $rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
+ $rev->isDeleted( RevisionRecord::DELETED_RESTRICTED ), false );
}
}
if ( $del ) {
}
}
- if ( !$rev->isDeleted( Revision::DELETED_TEXT )
- && !$prevRev->isDeleted( Revision::DELETED_TEXT )
+ if ( !$rev->isDeleted( RevisionRecord::DELETED_TEXT )
+ && !$prevRev->isDeleted( RevisionRecord::DELETED_TEXT )
) {
# Create undo tooltip for the first (=latest) line only
$undoTooltip = $latest
function curLink( $rev ) {
$cur = $this->historyPage->message['cur'];
$latest = $this->getWikiPage()->getLatest();
- if ( $latest === $rev->getId() || !$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
+ if ( $latest === $rev->getId()
+ || !$rev->userCan( RevisionRecord::DELETED_TEXT, $this->getUser() )
+ ) {
return $cur;
} else {
return MediaWikiServices::getInstance()->getLinkRenderer()->makeKnownLink(
$nextRev = new Revision( $next, 0, $this->getTitle() );
- if ( !$prevRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
- || !$nextRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
+ if ( !$prevRev->userCan( RevisionRecord::DELETED_TEXT, $this->getUser() )
+ || !$nextRev->userCan( RevisionRecord::DELETED_TEXT, $this->getUser() )
) {
return $last;
}
$checkmark = [ 'checked' => 'checked' ];
} else {
# Check visibility of old revisions
- if ( !$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
+ if ( !$rev->userCan( RevisionRecord::DELETED_TEXT, $this->getUser() ) ) {
$radio['disabled'] = 'disabled';
$checkmark = []; // We will check the next possible one
} elseif ( !$this->oldIdChecked ) {