}
}
+ $rl = MediaWikiServices::getInstance()->getRevisionLookup();
+ $oldRev = $this->mRevision ? $this->mRevision->getRevisionRecord() : null;
if ( $request->getVal( 'direction' ) == 'next' ) {
- $nextid = $this->getTitle()->getNextRevisionID( $oldid );
+ $nextid = 0;
+ if ( $oldRev ) {
+ $nextRev = $rl->getNextRevision( $oldRev );
+ if ( $nextRev ) {
+ $nextid = $nextRev->getId();
+ }
+ }
if ( $nextid ) {
$oldid = $nextid;
$this->mRevision = null;
$this->mRedirectUrl = $this->getTitle()->getFullURL( 'redirect=no' );
}
} elseif ( $request->getVal( 'direction' ) == 'prev' ) {
- $previd = $this->getTitle()->getPreviousRevisionID( $oldid );
+ $previd = 0;
+ if ( $oldRev ) {
+ $prevRev = $rl->getPreviousRevision( $oldRev );
+ if ( $prevRev ) {
+ $previd = $prevRev->getId();
+ }
+ }
if ( $previd ) {
$oldid = $previd;
$this->mRevision = null;
}
$outputPage->preventClickjacking();
- if ( $user->isAllowed( 'writeapi' ) ) {
+ if ( MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'writeapi' )
+ ) {
$outputPage->addModules( 'mediawiki.page.patrol.ajax' );
}
'oldid' => $oldid
] + $extraParams
);
- $prev = $this->getTitle()->getPreviousRevisionID( $oldid );
- $prevlink = $prev
+ $rl = MediaWikiServices::getInstance()->getRevisionLookup();
+ $prevExist = (bool)$rl->getPreviousRevision( $revision->getRevisionRecord() );
+ $prevlink = $prevExist
? Linker::linkKnown(
$this->getTitle(),
$context->msg( 'previousrevision' )->escaped(),
] + $extraParams
)
: $context->msg( 'previousrevision' )->escaped();
- $prevdiff = $prev
+ $prevdiff = $prevExist
? Linker::linkKnown(
$this->getTitle(),
$context->msg( 'diff' )->escaped(),
[ 'delete', $this->getTitle()->getPrefixedText() ] )
) {
# Flag to hide all contents of the archived revisions
- $suppress = $request->getCheck( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' );
+
+ $suppress = $request->getCheck( 'wpSuppress' ) && MediaWikiServices::getInstance()
+ ->getPermissionManager()
+ ->userHasRight( $user, 'suppressrevision' );
$this->doDelete( $reason, $suppress );
$outputPage->enableOOUI();
+ $fields = [];
+
$options = Xml::listDropDownOptions(
$ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(),
[ 'other' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text() ]
]
);
}
-
- if ( $user->isAllowed( 'suppressrevision' ) ) {
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+ if ( $permissionManager->userHasRight( $user, 'suppressrevision' ) ) {
$fields[] = new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => 'wpSuppress',
] )
);
- if ( $user->isAllowed( 'editinterface' ) ) {
+ if ( $permissionManager->userHasRight( $user, 'editinterface' ) ) {
$link = Linker::linkKnown(
$ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(),
wfMessage( 'delete-edit-reasonlist' )->escaped(),