X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiComparePages.php;h=6e788d550dcdff93f2f492a5bbb38ce7849719e0;hb=cc6e850520b79758fd791204d4b49715ee235c6b;hp=1eb5e8da5e4c55d50354762c8cd987b34da65a12;hpb=7f2f49ad2368ae27f2d4db69b44c5f997197725e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiComparePages.php b/includes/api/ApiComparePages.php index 1eb5e8da5e..6e788d550d 100644 --- a/includes/api/ApiComparePages.php +++ b/includes/api/ApiComparePages.php @@ -26,6 +26,9 @@ use MediaWiki\Revision\RevisionArchiveRecord; use MediaWiki\Revision\RevisionStore; use MediaWiki\Revision\SlotRecord; +/** + * @ingroup API + */ class ApiComparePages extends ApiBase { /** @var RevisionStore */ @@ -231,7 +234,9 @@ class ApiComparePages extends ApiBase { */ private function getRevisionById( $id ) { $rev = $this->revisionStore->getRevisionById( $id ); - if ( !$rev && $this->getUser()->isAllowedAny( 'deletedtext', 'undelete' ) ) { + if ( !$rev && $this->getPermissionManager() + ->userHasAnyRight( $this->getUser(), 'deletedtext', 'undelete' ) + ) { // Try the 'archive' table $arQuery = $this->revisionStore->getArchiveQueryInfo(); $row = $this->getDB()->selectRow( @@ -247,6 +252,7 @@ class ApiComparePages extends ApiBase { ); if ( $row ) { $rev = $this->revisionStore->newRevisionFromArchiveRow( $row ); + // @phan-suppress-next-line PhanUndeclaredProperty $rev->isArchive = true; } } @@ -562,7 +568,7 @@ class ApiComparePages extends ApiBase { */ private function setVals( &$vals, $prefix, $rev ) { if ( $rev ) { - $title = $rev->getPageAsLinkTarget(); + $title = Title::newFromLinkTarget( $rev->getPageAsLinkTarget() ); if ( isset( $this->props['ids'] ) ) { $vals["{$prefix}id"] = $title->getArticleID(); $vals["{$prefix}revid"] = $rev->getId(); @@ -603,7 +609,7 @@ class ApiComparePages extends ApiBase { $vals["{$prefix}comment"] = $comment->text; } $vals["{$prefix}parsedcomment"] = Linker::formatComment( - $comment->text, Title::newFromLinkTarget( $title ) + $comment->text, $title ); } } @@ -615,6 +621,7 @@ class ApiComparePages extends ApiBase { } } + // @phan-suppress-next-line PhanUndeclaredProperty if ( !empty( $rev->isArchive ) ) { $this->getMain()->setCacheMode( 'private' ); $vals["{$prefix}archive"] = true;