* @ingroup SpecialPage
*/
+use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Permissions\PermissionManager;
+
/**
* Special page allowing users with the appropriate permissions to view
* and hide revisions. Log items can also be hidden.
/** @var string */
private $otherReason;
+ /** @var PermissionManager */
+ private $permissionManager;
+
/**
* UI labels for each type.
*/
],
];
- public function __construct() {
+ /**
+ * @inheritDoc
+ *
+ * @param PermissionManager $permissionManager
+ */
+ public function __construct( PermissionManager $permissionManager ) {
parent::__construct( 'Revisiondelete', 'deleterevision' );
+
+ $this->permissionManager = $permissionManager;
}
public function doesWrites() {
$output = $this->getOutput();
$user = $this->getUser();
- // Check blocks
- // @TODO Use PermissionManager::isBlockedFrom() instead.
- $block = $user->getBlock();
- if ( $block ) {
- throw new UserBlockedError( $block );
- }
-
$this->setHeaders();
$this->outputHeader();
$request = $this->getRequest();
return;
}
+ // Check blocks
+ if ( $this->permissionManager->isBlockedFrom( $user, $this->targetObj ) ) {
+ throw new UserBlockedError( $user->getBlock() );
+ }
+
$this->typeLabels = self::$UILabels[$this->typeName];
$list = $this->getList();
$list->reset();
[ $this->typeLabels['check-label'], 'wpHidePrimary',
RevisionDeleter::getRevdelConstant( $this->typeName )
],
- [ 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ],
- [ 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER ]
+ [ 'revdelete-hide-comment', 'wpHideComment', RevisionRecord::DELETED_COMMENT ],
+ [ 'revdelete-hide-user', 'wpHideUser', RevisionRecord::DELETED_USER ]
];
if ( $user->isAllowed( 'suppressrevision' ) ) {
$this->checks[] = [ 'revdelete-hide-restricted',
- 'wpHideRestricted', Revision::DELETED_RESTRICTED ];
+ 'wpHideRestricted', RevisionRecord::DELETED_RESTRICTED ];
}
# Either submit or create our form
$bitfield & $field
);
- if ( $field == Revision::DELETED_RESTRICTED ) {
+ if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
$innerHTML = "<b>$innerHTML</b>";
}
$line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
$line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
$label = $this->msg( $message )->escaped();
- if ( $field == Revision::DELETED_RESTRICTED ) {
+ if ( $field == RevisionRecord::DELETED_RESTRICTED ) {
$label = "<b>$label</b>";
}
$line .= "<td>$label</td>";
. $this->otherReason;
}
# Can the user set this field?
- if ( $bitParams[Revision::DELETED_RESTRICTED] == 1
+ if ( $bitParams[RevisionRecord::DELETED_RESTRICTED] == 1
&& !$this->getUser()->isAllowed( 'suppressrevision' )
) {
throw new PermissionsError( 'suppressrevision' );
}
$bitfield[$field] = $val;
}
- if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
- $bitfield[Revision::DELETED_RESTRICTED] = 0;
+ if ( !isset( $bitfield[RevisionRecord::DELETED_RESTRICTED] ) ) {
+ $bitfield[RevisionRecord::DELETED_RESTRICTED] = 0;
}
return $bitfield;