* (bug 17007) Added action=import
* BREAKING CHANGE: Removed rctitles parameter from list=recentchanges because of
performance concerns
+* Listing (semi-)deleted revisions and log entries as well in prop=revisions and
+ list=logevents
=== Languages updated in 1.15 ===
$pageids = array();
$remaining = array_flip($revids);
- $tables = array('revision','page');
- $fields = array('rev_id','rev_page');
- $where = array('rev_deleted' => 0, 'rev_id' => $revids,'rev_page = page_id');
+ $tables = array('revision', 'page');
+ $fields = array('rev_id', 'rev_page');
+ $where = array('rev_id' => $revids, 'rev_page = page_id');
// Get pageIDs data from the `page` table
$this->profileDBIn();
array( 'log_namespace=page_namespace',
'log_title=page_title'))));
$this->addWhere('user_id=log_user');
- $this->addOption('USE INDEX', array('logging' => 'times')); // default, may change
+ $index = 'times'; // default, may change
$this->addFields(array (
'log_type',
'log_action',
'log_timestamp',
+ 'log_deleted',
));
$this->addFieldsIf('log_id', $this->fld_ids);
$this->addFieldsIf('log_title', $this->fld_title);
$this->addFieldsIf('log_comment', $this->fld_comment);
$this->addFieldsIf('log_params', $this->fld_details);
-
- $this->addWhereFld('log_deleted', 0);
if( !is_null($params['type']) ) {
$this->addWhereFld('log_type', $params['type']);
- $this->addOption('USE INDEX', array('logging' => array('type_time')));
+ $index = 'type_time';
}
$this->addWhereRange('log_timestamp', $params['dir'], $params['start'], $params['end']);
if ( $index ) {
$this->addOption( 'USE INDEX', array( 'logging' => $index ) );
}
-
+ // Paranoia: avoid brute force searches (bug 17342)
+ if (!is_null($title) || !is_null($params['type'])) {
+ $this->addWhere('log_deleted & ' . LogPage::DELETED_ACTION . ' = 0');
+ }
+ if (!is_null($user)) {
+ $this->addWhere('log_deleted & ' . LogPage::DELETED_USER . ' = 0');
+ }
$data = array ();
$count = 0;
}
if ($this->fld_type) {
- $vals['type'] = $row->log_type;
- $vals['action'] = $row->log_action;
+ if (LogEventsList::isDeleted($row, LogPage::DELETED_ACTION)) {
+ $vals['actionhidden'] = '';
+ } else {
+ $vals['type'] = $row->log_type;
+ $vals['action'] = $row->log_action;
+ }
}
if ($this->fld_details && $row->log_params !== '') {
- self::addLogParams($this->getResult(), $vals,
- $row->log_params, $row->log_type,
- $row->log_timestamp);
+ if (LogEventsList::isDeleted($row, LogPage::DELETED_ACTION)) {
+ $vals['actionhidden'] = '';
+ } else {
+ self::addLogParams($this->getResult(), $vals,
+ $row->log_params, $row->log_type,
+ $row->log_timestamp);
+ }
}
if ($this->fld_user) {
- $vals['user'] = $row->user_name;
- if(!$row->log_user)
- $vals['anon'] = '';
+ if (LogEventsList::isDeleted($row, LogPage::DELETED_USER)) {
+ $vals['userhidden'] = '';
+ } else {
+ $vals['user'] = $row->user_name;
+ if(!$row->log_user)
+ $vals['anon'] = '';
+ }
}
if ($this->fld_timestamp) {
$vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->log_timestamp);
}
if ($this->fld_comment && isset($row->log_comment)) {
- $vals['comment'] = $row->log_comment;
+ if (LogEventsList::isDeleted($row, LogPage::DELETED_COMMENT)) {
+ $vals['commenthidden'] = '';
+ } else {
+ $vals['comment'] = $row->log_comment;
+ }
}
return $vals;
$this->dieUsage('titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.', 'multpages');
$this->addTables('revision');
- $this->addFields( Revision::selectFields() );
- $this->addTables( 'page' );
+ $this->addFields(Revision::selectFields());
+ $this->addTables('page');
$this->addWhere('page_id = rev_page');
$prop = array_flip($params['prop']);
$this->addTables('text');
$this->addWhere('rev_text_id=old_id');
$this->addFields('old_id');
- $this->addFields( Revision::selectTextFields() );
+ $this->addFields(Revision::selectTextFields());
$this->fld_content = true;
if(!is_null($params['user'])) {
$this->addWhereFld('rev_user_text', $params['user']);
- } elseif (!is_null( $params['excludeuser'])) {
+ } elseif (!is_null($params['excludeuser'])) {
$this->addWhere('rev_user_text != ' .
$this->getDB()->addQuotes($params['excludeuser']));
}
+ if(!is_null($params['user']) || !is_null($params['excludeuser'])) {
+ // Paranoia: avoid brute force searches (bug 17342)
+ $this->addWhere('rev_deleted & ' . Revision::DELETED_USER . ' = 0');
+ }
}
elseif ($revCount > 0) {
$max = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
$vals['minor'] = '';
if ($this->fld_user) {
- $vals['user'] = $revision->getUserText();
- if (!$revision->getUser())
- $vals['anon'] = '';
+ if ($revision->isDeleted(Revision::DELETED_USER)) {
+ $vals['userhidden'] = '';
+ } else {
+ $vals['user'] = $revision->getUserText();
+ if (!$revision->getUser())
+ $vals['anon'] = '';
+ }
}
if ($this->fld_timestamp) {
}
if ($this->fld_comment) {
- $comment = $revision->getComment();
- if (strval($comment) !== '')
- $vals['comment'] = $comment;
+ if ($revision->isDeleted(Revision::DELETED_COMMENT)) {
+ $vals['commenthidden'] = '';
+ } else {
+ $comment = $revision->getComment();
+ if (strval($comment) !== '')
+ $vals['comment'] = $comment;
+ }
}
if(!is_null($this->token) || ($this->fld_content && $this->expandTemplates))
$vals[$t . 'token'] = $val;
}
}
-
- if ($this->fld_content) {
+
+ if ($this->fld_content && !$revision->isDeleted(Revision::DELETED_TEXT)) {
global $wgParser;
$text = $revision->getText();
# Expand templates after getting section content because
$text = $wgParser->preprocess( $text, $title, new ParserOptions() );
}
ApiResult :: setContent($vals, $text);
+ } else if ($this->fld_content) {
+ $vals['texthidden'] = '';
}
return $vals;
}