public function imageHistoryLine( $iscur, $file ) {
$user = $this->getUser();
$lang = $this->getLanguage();
+ $pm = MediaWikiServices::getInstance()->getPermissionManager();
$timestamp = wfTimestamp( TS_MW, $file->getTimestamp() );
+ // @phan-suppress-next-line PhanUndeclaredMethod
$img = $iscur ? $file->getName() : $file->getArchiveName();
$userId = $file->getUser( 'id' );
$userText = $file->getUser( 'text' );
$row = $selected = '';
// Deletion link
- if ( $local && ( MediaWikiServices::getInstance()
- ->getPermissionManager()
- ->userHasAnyRight( $user, 'delete', 'deletedhistory' ) )
- ) {
+ if ( $local && ( $pm->userHasAnyRight( $user, 'delete', 'deletedhistory' ) ) ) {
$row .= '<td>';
# Link to remove from history
- if ( $user->isAllowed( 'delete' ) ) {
+ if ( $pm->userHasRight( $user, 'delete' ) ) {
$q = [ 'action' => 'delete' ];
if ( !$iscur ) {
$q['oldimage'] = $img;
);
}
# Link to hide content. Don't show useless link to people who cannot hide revisions.
- $canHide = $user->isAllowed( 'deleterevision' );
- if ( $canHide || ( $user->isAllowed( 'deletedhistory' ) && $file->getVisibility() ) ) {
- if ( $user->isAllowed( 'delete' ) ) {
+ $canHide = $pm->userHasRight( $user, 'deleterevision' );
+ if ( $canHide || ( $pm->userHasRight( $user, 'deletedhistory' )
+ && $file->getVisibility() ) ) {
+ if ( $pm->userHasRight( $user, 'delete' ) ) {
$row .= '<br />';
}
// If file is top revision or locked from this user, don't link
$row .= '<td>';
if ( $iscur ) {
$row .= $this->msg( 'filehist-current' )->escaped();
- } elseif ( $local && $this->title->quickUserCan( 'edit', $user )
- && $this->title->quickUserCan( 'upload', $user )
+ } elseif ( $local && $pm->quickUserCan( 'edit', $user, $this->title )
+ && $pm->quickUserCan( 'upload', $user, $this->title )
) {
if ( $file->isDeleted( File::DELETED_FILE ) ) {
$row .= $this->msg( 'filehist-revert' )->escaped();