leucosticte has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/150969

Change subject: Make log_params contain null revision rev_id
......................................................................

Make log_params contain null revision rev_id

Make log_params contain the revision IDs of null revisions created by page
move events. These will be available via ApiQueryLogEvents.php. This also
fixes bug 68930.

Bug: 68950
Change-Id: I3694958a69cb80f9001348acd9baffdb457adac5
---
M includes/Title.php
M includes/api/ApiQueryLogEvents.php
2 files changed, 18 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/150969/1

diff --git a/includes/Title.php b/includes/Title.php
index ab55257..b17fd89 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -3887,14 +3887,18 @@
                        $redirectContent = null;
                }
 
+               $oldid = $this->getArticleID();
+
                $logEntry = new ManualLogEntry( 'move', $logType );
                $logEntry->setPerformer( $wgUser );
                $logEntry->setTarget( $this );
                $logEntry->setComment( $reason );
-               $logEntry->setParameters( array(
+               $logParams = array(
                        '4::target' => $nt->getPrefixedText(),
                        '5::noredir' => $redirectContent ? '0': '1',
-               ) );
+                       '6::pageid' => $oldid
+               );
+               $logEntry->setParameters( $logParams );
 
                $formatter = LogFormatter::newFromEntry( $logEntry );
                $formatter->setContext( RequestContext::newExtraneousContext( 
$this ) );
@@ -3904,8 +3908,6 @@
                }
                # Truncate for whole multibyte characters.
                $comment = $wgContLang->truncate( $comment, 255 );
-
-               $oldid = $this->getArticleID();
 
                $dbw = wfGetDB( DB_MASTER );
 
@@ -3930,7 +3932,10 @@
                        throw new MWException( 'No valid null revision produced 
in ' . __METHOD__ );
                }
 
-               $nullRevision->insertOn( $dbw );
+               $nullRevId = $nullRevision->insertOn( $dbw );
+
+               $logParams['7::nullrevid'] = $nullRevId;
+               $logEntry->setParameters( $logParams );
 
                # Change the name of the target page:
                $dbw->update( 'page',
diff --git a/includes/api/ApiQueryLogEvents.php 
b/includes/api/ApiQueryLogEvents.php
index 7cd8aac..8f81de5 100644
--- a/includes/api/ApiQueryLogEvents.php
+++ b/includes/api/ApiQueryLogEvents.php
@@ -264,6 +264,8 @@
                                } else {
                                        $targetKey = '4::target';
                                        $noredirKey = '5::noredir';
+                                       $pageidKey = '6::pageid';
+                                       $nullrevidKey = '7::nullrevid';
                                }
 
                                if ( isset( $params[$targetKey] ) ) {
@@ -277,6 +279,12 @@
                                if ( isset( $params[$noredirKey] ) && 
$params[$noredirKey] ) {
                                        $vals[$type]['suppressedredirect'] = '';
                                }
+                               if ( isset( $params[$pageidKey] ) ) {
+                                       $vals[$type]['pageid'] = 
$params[$pageidKey];
+                               }
+                               if ( isset( $params[$nullrevidKey] ) ) {
+                                       $vals[$type]['nullrevid'] = 
$params[$nullrevidKey];
+                               }
                                $params = null;
                                break;
                        case 'patrol':

-- 
To view, visit https://gerrit.wikimedia.org/r/150969
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3694958a69cb80f9001348acd9baffdb457adac5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: leucosticte <nathanlarson3...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to