* @since 1.22
*/
+use MediaWiki\MediaWikiServices;
+use MediaWiki\Storage\RevisionRecord;
+
/**
* This class formats delete log entries.
*
public function getActionLinks() {
$user = $this->context->getUser();
$linkRenderer = $this->getLinkRenderer();
- if ( !$user->isAllowed( 'deletedhistory' )
+ $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+ if ( !$permissionManager->userHasRight( $user, 'deletedhistory' )
|| $this->entry->isDeleted( LogPage::DELETED_ACTION )
) {
return '';
switch ( $this->entry->getSubtype() ) {
case 'delete': // Show undelete link
case 'delete_redir':
- if ( $user->isAllowed( 'undelete' ) ) {
+ if ( $permissionManager->userHasRight( $user, 'undelete' ) ) {
$message = 'undeletelink';
} else {
$message = 'undeleteviewlink';
}
}
- $old = $this->parseBitField( $rawParams['6::ofield'] );
- $new = $this->parseBitField( $rawParams['7::nfield'] );
if ( !is_array( $rawParams['5::ids'] ) ) {
$rawParams['5::ids'] = explode( ',', $rawParams['5::ids'] );
}
$params = [
'::type' => $rawParams['4::type'],
':array:ids' => $rawParams['5::ids'],
- ':assoc:old' => [ 'bitmask' => $old ],
- ':assoc:new' => [ 'bitmask' => $new ],
];
static $fields = [
- Revision::DELETED_TEXT => 'content',
- Revision::DELETED_COMMENT => 'comment',
- Revision::DELETED_USER => 'user',
- Revision::DELETED_RESTRICTED => 'restricted',
+ RevisionRecord::DELETED_TEXT => 'content',
+ RevisionRecord::DELETED_COMMENT => 'comment',
+ RevisionRecord::DELETED_USER => 'user',
+ RevisionRecord::DELETED_RESTRICTED => 'restricted',
];
- foreach ( $fields as $bit => $key ) {
- $params[':assoc:old'][$key] = (bool)( $old & $bit );
- $params[':assoc:new'][$key] = (bool)( $new & $bit );
+
+ if ( isset( $rawParams['6::ofield'] ) ) {
+ $old = $this->parseBitField( $rawParams['6::ofield'] );
+ $params[':assoc:old'] = [ 'bitmask' => $old ];
+ foreach ( $fields as $bit => $key ) {
+ $params[':assoc:old'][$key] = (bool)( $old & $bit );
+ }
+ }
+ if ( isset( $rawParams['7::nfield'] ) ) {
+ $new = $this->parseBitField( $rawParams['7::nfield'] );
+ $params[':assoc:new'] = [ 'bitmask' => $new ];
+ foreach ( $fields as $bit => $key ) {
+ $params[':assoc:new'][$key] = (bool)( $new & $bit );
+ }
}
} elseif ( $subtype === 'restore' ) {
$rawParams = $entry->getParameters();