Page MenuHomePhabricator

15492.patch

Authored By
bzimport
Nov 21 2014, 10:21 PM
Size
4 KB
Referenced Files
None
Subscribers
None

15492.patch

Index: includes/api/ApiQueryLogEvents.php
===================================================================
--- includes/api/ApiQueryLogEvents.php (revision 40526)
+++ includes/api/ApiQueryLogEvents.php (working copy)
@@ -134,6 +134,46 @@
$this->getResult()->setIndexedTagName($data, 'item');
$this->getResult()->addValue('query', $this->getModuleName(), $data);
}
+
+ public static function addLogParams($result, &$vals, $params, $type) {
+ $params = explode("\n", $params);
+ switch ($type) {
+ case 'move':
+ if (isset ($params[0])) {
+ $title = Title :: newFromText($params[0]);
+ if ($title) {
+ $vals2 = array();
+ ApiQueryBase :: addTitleInfo($vals2, $title, "new_");
+ $vals[$type] = $vals2;
+ $params = null;
+ }
+ }
+ break;
+ case 'patrol':
+ $vals2 = array();
+ list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params;
+ $vals[$type] = $vals2;
+ $params = null;
+ break;
+ case 'rights':
+ $vals2 = array();
+ list( $vals2['old'], $vals2['new'] ) = $params;
+ $vals[$type] = $vals2;
+ $params = null;
+ break;
+ case 'block':
+ $vals2 = array();
+ list( $vals2['duration'], $vals2['flags'] ) = $params;
+ $vals[$type] = $vals2;
+ $params = null;
+ break;
+ }
+ if (!is_null($params)) {
+ $result->setIndexedTagName($params, 'param');
+ $vals = array_merge($vals, $params);
+ }
+ return $vals;
+ }
private function extractRowInfo($row) {
$vals = array();
@@ -154,43 +194,8 @@
}
if ($this->fld_details && $row->log_params !== '') {
- $params = explode("\n", $row->log_params);
- switch ($row->log_type) {
- case 'move':
- if (isset ($params[0])) {
- $title = Title :: newFromText($params[0]);
- if ($title) {
- $vals2 = array();
- ApiQueryBase :: addTitleInfo($vals2, $title, "new_");
- $vals[$row->log_type] = $vals2;
- $params = null;
- }
- }
- break;
- case 'patrol':
- $vals2 = array();
- list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params;
- $vals[$row->log_type] = $vals2;
- $params = null;
- break;
- case 'rights':
- $vals2 = array();
- list( $vals2['old'], $vals2['new'] ) = $params;
- $vals[$row->log_type] = $vals2;
- $params = null;
- break;
- case 'block':
- $vals2 = array();
- list( $vals2['duration'], $vals2['flags'] ) = $params;
- $vals[$row->log_type] = $vals2;
- $params = null;
- break;
- }
-
- if (isset($params)) {
- $this->getResult()->setIndexedTagName($params, 'param');
- $vals = array_merge($vals, $params);
- }
+ self::addLogParams($this->getResult(), $vals,
+ $row->log_params, $row->log_type);
}
if ($this->fld_user) {
Index: includes/api/ApiQueryRecentChanges.php
===================================================================
--- includes/api/ApiQueryRecentChanges.php (revision 40526)
+++ includes/api/ApiQueryRecentChanges.php (working copy)
@@ -180,6 +180,7 @@
$this->fld_sizes = isset ($prop['sizes']);
$this->fld_redirect = isset($prop['redirect']);
$this->fld_patrolled = isset($prop['patrolled']);
+ $this->fld_loginfo = isset($prop['loginfo']);
global $wgUser;
if($this->fld_patrolled && !$wgUser->isAllowed('patrol'))
@@ -198,6 +199,10 @@
$this->addFieldsIf('rc_old_len', $this->fld_sizes);
$this->addFieldsIf('rc_new_len', $this->fld_sizes);
$this->addFieldsIf('rc_patrolled', $this->fld_patrolled);
+ $this->addFieldsIf('rc_logid', $this->fld_loginfo);
+ $this->addFieldsIf('rc_log_type', $this->fld_loginfo);
+ $this->addFieldsIf('rc_log_action', $this->fld_loginfo);
+ $this->addFieldsIf('rc_params', $this->fld_loginfo);
if($this->fld_redirect || isset($show['redirect']) || isset($show['!redirect']))
{
$this->addTables('page');
@@ -326,6 +331,15 @@
/* Add the patrolled flag */
if ($this->fld_patrolled && $row->rc_patrolled == 1)
$vals['patrolled'] = '';
+
+ if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
+ $vals['logid'] = $row->rc_logid;
+ $vals['logtype'] = $row->rc_log_type;
+ $vals['logaction'] = $row->rc_log_action;
+ ApiQueryLogEvents::addLogParams($this->getResult(),
+ $vals, $row->rc_params,
+ $row->rc_log_type);
+ }
if(!is_null($this->token))
{
@@ -395,7 +409,8 @@
'ids',
'sizes',
'redirect',
- 'patrolled'
+ 'patrolled',
+ 'loginfo',
)
),
'token' => array(
Index: RELEASE-NOTES
===================================================================
--- RELEASE-NOTES (revision 40526)
+++ RELEASE-NOTES (working copy)
@@ -220,6 +220,7 @@
* (bug 15445) Added action=patrol
* (bug 15466) Added action=purge
* (bug 15486) action=block ignores autoblock parameter
+* (bug 15492) added rcprop=loginfo to list=recentchanges
=== Languages updated in 1.14 ===

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4759
Default Alt Text
15492.patch (4 KB)

Event Timeline