X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=6aeb038251eeaa6b5a06ab68b5999800ebf59787;hp=535aeffeb3cb5bf600cb361ab752941600ab0a56;hb=a1ef77b2d80830fbcb617a83961d78cff9d6e384;hpb=d18e76dbef35efeb1f735bb070e54be5dc629e4b diff --git a/includes/page/Article.php b/includes/page/Article.php index 535aeffeb3..6aeb038251 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -363,8 +363,16 @@ class Article implements Page { } } + $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; @@ -372,7 +380,13 @@ class Article implements Page { $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; @@ -1310,7 +1324,10 @@ class Article implements Page { } $outputPage->preventClickjacking(); - if ( $user->isAllowed( 'writeapi' ) ) { + if ( MediaWikiServices::getInstance() + ->getPermissionManager() + ->userHasRight( $user, 'writeapi' ) + ) { $outputPage->addModules( 'mediawiki.page.patrol.ajax' ); } @@ -1596,8 +1613,9 @@ class Article implements Page { '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(), @@ -1608,7 +1626,7 @@ class Article implements Page { ] + $extraParams ) : $context->msg( 'previousrevision' )->escaped(); - $prevdiff = $prev + $prevdiff = $prevExist ? Linker::linkKnown( $this->getTitle(), $context->msg( 'diff' )->escaped(), @@ -1827,7 +1845,10 @@ class Article implements Page { [ '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 ); @@ -1929,6 +1950,8 @@ class Article implements Page { $outputPage->enableOOUI(); + $fields = []; + $options = Xml::listDropDownOptions( $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(), [ 'other' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text() ] @@ -1984,8 +2007,8 @@ class Article implements Page { ] ); } - - if ( $user->isAllowed( 'suppressrevision' ) ) { + $permissionManager = MediaWikiServices::getInstance()->getPermissionManager(); + if ( $permissionManager->userHasRight( $user, 'suppressrevision' ) ) { $fields[] = new OOUI\FieldLayout( new OOUI\CheckboxInputWidget( [ 'name' => 'wpSuppress', @@ -2043,7 +2066,7 @@ class Article implements Page { ] ) ); - if ( $user->isAllowed( 'editinterface' ) ) { + if ( $permissionManager->userHasRight( $user, 'editinterface' ) ) { $link = Linker::linkKnown( $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(), wfMessage( 'delete-edit-reasonlist' )->escaped(),