Merge "Store page_id in logging table for deletions and make queryable"

This commit is contained in:
jenkins-bot 2014-05-23 23:15:55 +00:00 committed by Gerrit Code Review
commit 0ff9863073
3 changed files with 11 additions and 1 deletions

View file

@ -69,6 +69,8 @@ production.
* action=query&meta=siteinfo&siprop=interwikimap returns a new "protorel"
field which is true iff protocol-relative urls can be used to access
a particular interwiki map entry.
* ApiQueryLogEvents now provides logpage, which is the page ID from the
logging table, if ids are requested and the user has the permissions.
=== Languages updated in 1.24 ===

View file

@ -2831,6 +2831,9 @@ class WikiPage implements Page, IDBAccessObject {
$dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ );
}
// Clone the title, so we have the information we need when we log
$logTitle = clone $this->mTitle;
$this->doDeleteUpdates( $id, $content );
// Log the deletion, if the page was suppressed, log it at Oversight instead
@ -2838,7 +2841,7 @@ class WikiPage implements Page, IDBAccessObject {
$logEntry = new ManualLogEntry( $logtype, 'delete' );
$logEntry->setPerformer( $user );
$logEntry->setTarget( $this->mTitle );
$logEntry->setTarget( $logTitle );
$logEntry->setComment( $reason );
$logid = $logEntry->insert();
$logEntry->publish( $logid );

View file

@ -81,6 +81,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
) );
$this->addFieldsIf( 'page_id', $this->fld_ids );
// log_page is the page_id saved at log time, whereas page_id is from a
// join at query time. This leads to different results in various
// scenarios, e.g. deletion, recreation.
$this->addFieldsIf( 'log_page', $this->fld_ids );
$this->addFieldsIf( array( 'log_user', 'log_user_text', 'user_name' ), $this->fld_user );
$this->addFieldsIf( 'log_user', $this->fld_userid );
$this->addFieldsIf(
@ -364,6 +368,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
}
if ( $this->fld_ids ) {
$vals['pageid'] = intval( $row->page_id );
$vals['logpage'] = intval( $row->log_page );
}
if ( $this->fld_details && $row->log_params !== '' ) {
self::addLogParams(