Also do not include revdeleted entries in search results when
filtering by action if user cannot view that info.
Bug: 72222
Change-Id: I359ce3c67b1a7c24b76a8bade62ce0c77ff5efb0
}
// Paranoia: avoid brute force searches (bug 17342)
}
// Paranoia: avoid brute force searches (bug 17342)
- if ( $params['namespace'] !== null || !is_null( $title ) || !is_null( $user ) ) {
+ $hideActions = $params['namespace'] !== null || !is_null( $title ) || !is_null( $params['action'] );
+ if ( $hideActions || !is_null( $user ) ) {
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$titleBits = LogPage::DELETED_ACTION;
$userBits = LogPage::DELETED_USER;
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$titleBits = LogPage::DELETED_ACTION;
$userBits = LogPage::DELETED_USER;
$titleBits = 0;
$userBits = 0;
}
$titleBits = 0;
$userBits = 0;
}
- if ( ( $params['namespace'] !== null || !is_null( $title ) ) && $titleBits ) {
+ if ( $hideActions && $titleBits ) {
$this->addWhere( $db->bitAnd( 'log_deleted', $titleBits ) . " != $titleBits" );
}
if ( !is_null( $user ) && $userBits ) {
$this->addWhere( $db->bitAnd( 'log_deleted', $titleBits ) . " != $titleBits" );
}
if ( !is_null( $user ) && $userBits ) {
$title = Title::makeTitle( $row->log_namespace, $row->log_title );
}
$title = Title::makeTitle( $row->log_namespace, $row->log_title );
}
- if ( $this->fld_title || $this->fld_ids || $this->fld_details && $row->log_params !== '' ) {
+ if ( $this->fld_title || $this->fld_ids || $this->fld_type
+ || $this->fld_details && $row->log_params !== ''
+ ) {
if ( LogEventsList::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
$vals['actionhidden'] = '';
$anyHidden = true;
}
if ( LogEventsList::userCan( $row, LogPage::DELETED_ACTION, $user ) ) {
if ( LogEventsList::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
$vals['actionhidden'] = '';
$anyHidden = true;
}
if ( LogEventsList::userCan( $row, LogPage::DELETED_ACTION, $user ) ) {
+
+ if ( $this->fld_type ) {
+ $vals['action'] = $row->log_action;
+ }
if ( $this->fld_title ) {
ApiQueryBase::addTitleInfo( $vals, $title );
}
if ( $this->fld_title ) {
ApiQueryBase::addTitleInfo( $vals, $title );
}
- if ( $this->fld_type || $this->fld_action ) {
+ if ( $this->fld_type ) {
$vals['type'] = $row->log_type;
$vals['type'] = $row->log_type;
- $vals['action'] = $row->log_action;
}
if ( $this->fld_user || $this->fld_userid ) {
}
if ( $this->fld_user || $this->fld_userid ) {