r40529 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40528‎ | r40529 | r40530 >
Date:12:18, 6 September 2008
Author:vasilievvv
Status:old
Tags:
Comment:
* (bug 15492) list=recentchanges&rctype=log does't list log action
Patch by Roan Kattouw
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -180,6 +180,7 @@
181181 $this->fld_sizes = isset ($prop['sizes']);
182182 $this->fld_redirect = isset($prop['redirect']);
183183 $this->fld_patrolled = isset($prop['patrolled']);
 184+ $this->fld_loginfo = isset($prop['loginfo']);
184185
185186 global $wgUser;
186187 if($this->fld_patrolled && !$wgUser->isAllowed('patrol'))
@@ -198,6 +199,10 @@
199200 $this->addFieldsIf('rc_old_len', $this->fld_sizes);
200201 $this->addFieldsIf('rc_new_len', $this->fld_sizes);
201202 $this->addFieldsIf('rc_patrolled', $this->fld_patrolled);
 203+ $this->addFieldsIf('rc_logid', $this->fld_loginfo);
 204+ $this->addFieldsIf('rc_log_type', $this->fld_loginfo);
 205+ $this->addFieldsIf('rc_log_action', $this->fld_loginfo);
 206+ $this->addFieldsIf('rc_params', $this->fld_loginfo);
202207 if($this->fld_redirect || isset($show['redirect']) || isset($show['!redirect']))
203208 {
204209 $this->addTables('page');
@@ -326,6 +331,15 @@
327332 /* Add the patrolled flag */
328333 if ($this->fld_patrolled && $row->rc_patrolled == 1)
329334 $vals['patrolled'] = '';
 335+
 336+ if ($this->fld_loginfo && $row->rc_type == RC_LOG) {
 337+ $vals['logid'] = $row->rc_logid;
 338+ $vals['logtype'] = $row->rc_log_type;
 339+ $vals['logaction'] = $row->rc_log_action;
 340+ ApiQueryLogEvents::addLogParams($this->getResult(),
 341+ $vals, $row->rc_params,
 342+ $row->rc_log_type);
 343+ }
330344
331345 if(!is_null($this->token))
332346 {
@@ -395,7 +409,8 @@
396410 'ids',
397411 'sizes',
398412 'redirect',
399 - 'patrolled'
 413+ 'patrolled',
 414+ 'loginfo',
400415 )
401416 ),
402417 'token' => array(
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -134,6 +134,46 @@
135135 $this->getResult()->setIndexedTagName($data, 'item');
136136 $this->getResult()->addValue('query', $this->getModuleName(), $data);
137137 }
 138+
 139+ public static function addLogParams($result, &$vals, $params, $type) {
 140+ $params = explode("\n", $params);
 141+ switch ($type) {
 142+ case 'move':
 143+ if (isset ($params[0])) {
 144+ $title = Title :: newFromText($params[0]);
 145+ if ($title) {
 146+ $vals2 = array();
 147+ ApiQueryBase :: addTitleInfo($vals2, $title, "new_");
 148+ $vals[$type] = $vals2;
 149+ $params = null;
 150+ }
 151+ }
 152+ break;
 153+ case 'patrol':
 154+ $vals2 = array();
 155+ list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params;
 156+ $vals[$type] = $vals2;
 157+ $params = null;
 158+ break;
 159+ case 'rights':
 160+ $vals2 = array();
 161+ list( $vals2['old'], $vals2['new'] ) = $params;
 162+ $vals[$type] = $vals2;
 163+ $params = null;
 164+ break;
 165+ case 'block':
 166+ $vals2 = array();
 167+ list( $vals2['duration'], $vals2['flags'] ) = $params;
 168+ $vals[$type] = $vals2;
 169+ $params = null;
 170+ break;
 171+ }
 172+ if (!is_null($params)) {
 173+ $result->setIndexedTagName($params, 'param');
 174+ $vals = array_merge($vals, $params);
 175+ }
 176+ return $vals;
 177+ }
138178
139179 private function extractRowInfo($row) {
140180 $vals = array();
@@ -154,43 +194,8 @@
155195 }
156196
157197 if ($this->fld_details && $row->log_params !== '') {
158 - $params = explode("\n", $row->log_params);
159 - switch ($row->log_type) {
160 - case 'move':
161 - if (isset ($params[0])) {
162 - $title = Title :: newFromText($params[0]);
163 - if ($title) {
164 - $vals2 = array();
165 - ApiQueryBase :: addTitleInfo($vals2, $title, "new_");
166 - $vals[$row->log_type] = $vals2;
167 - $params = null;
168 - }
169 - }
170 - break;
171 - case 'patrol':
172 - $vals2 = array();
173 - list( $vals2['cur'], $vals2['prev'], $vals2['auto'] ) = $params;
174 - $vals[$row->log_type] = $vals2;
175 - $params = null;
176 - break;
177 - case 'rights':
178 - $vals2 = array();
179 - list( $vals2['old'], $vals2['new'] ) = $params;
180 - $vals[$row->log_type] = $vals2;
181 - $params = null;
182 - break;
183 - case 'block':
184 - $vals2 = array();
185 - list( $vals2['duration'], $vals2['flags'] ) = $params;
186 - $vals[$row->log_type] = $vals2;
187 - $params = null;
188 - break;
189 - }
190 -
191 - if (isset($params)) {
192 - $this->getResult()->setIndexedTagName($params, 'param');
193 - $vals = array_merge($vals, $params);
194 - }
 198+ self::addLogParams($this->getResult(), $vals,
 199+ $row->log_params, $row->log_type);
195200 }
196201
197202 if ($this->fld_user) {
Index: trunk/phase3/RELEASE-NOTES
@@ -220,6 +220,7 @@
221221 * (bug 15445) Added action=patrol
222222 * (bug 15466) Added action=purge
223223 * (bug 15486) action=block ignores autoblock parameter
 224+* (bug 15492) added rcprop=loginfo to list=recentchanges
224225
225226 === Languages updated in 1.14 ===
226227