r45675 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45674‎ | r45675 | r45676 >
Date:14:27, 12 January 2009
Author:catrope
Status:ok
Tags:
Comment:
API: (bug 16629) "edit=:move=" in page.page_restrictions was interpreted incorrectly. Also moved up the code checking for legacy protections to right after the code checking for 'new' protections.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryInfo.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryInfo.php
@@ -212,6 +212,38 @@
213213 if($row->pr_cascade)
214214 $a['cascade'] = '';
215215 $protections[$row->pr_page][] = $a;
 216+
 217+ # Also check old restrictions
 218+ if($pageRestrictions[$row->pr_page]) {
 219+ foreach(explode(':', trim($pageRestrictions[$pageid])) as $restrict) {
 220+ $temp = explode('=', trim($restrict));
 221+ if(count($temp) == 1) {
 222+ // old old format should be treated as edit/move restriction
 223+ $restriction = trim( $temp[0] );
 224+ if($restriction == '')
 225+ continue;
 226+ $protections[$row->pr_page][] = array(
 227+ 'type' => 'edit',
 228+ 'level' => $restriction,
 229+ 'expiry' => 'infinity',
 230+ );
 231+ $protections[$row->pr_page][] = array(
 232+ 'type' => 'move',
 233+ 'level' => $restriction,
 234+ 'expiry' => 'infinity',
 235+ );
 236+ } else {
 237+ $restriction = trim( $temp[1] );
 238+ if($restriction == '')
 239+ continue;
 240+ $protections[$row->pr_page][] = array(
 241+ 'type' => $temp[0],
 242+ 'level' => $restriction,
 243+ 'expiry' => 'infinity',
 244+ );
 245+ }
 246+ }
 247+ }
216248 }
217249 $db->freeResult($res);
218250
@@ -420,34 +452,6 @@
421453 $pageInfo['protection'] = $protections[$pageid];
422454 $result->setIndexedTagName($pageInfo['protection'], 'pr');
423455 }
424 - # Also check old restrictions
425 - if( $pageRestrictions[$pageid] ) {
426 - foreach( explode( ':', trim( $pageRestrictions[$pageid] ) ) as $restrict ) {
427 - $temp = explode( '=', trim( $restrict ) );
428 - if(count($temp) == 1) {
429 - // old old format should be treated as edit/move restriction
430 - $restriction = trim( $temp[0] );
431 - $pageInfo['protection'][] = array(
432 - 'type' => 'edit',
433 - 'level' => $restriction,
434 - 'expiry' => 'infinity',
435 - );
436 - $pageInfo['protection'][] = array(
437 - 'type' => 'move',
438 - 'level' => $restriction,
439 - 'expiry' => 'infinity',
440 - );
441 - } else {
442 - $restriction = trim( $temp[1] );
443 - $pageInfo['protection'][] = array(
444 - 'type' => $temp[0],
445 - 'level' => $restriction,
446 - 'expiry' => 'infinity',
447 - );
448 - }
449 - }
450 - $result->setIndexedTagName($pageInfo['protection'], 'pr');
451 - }
452456 }
453457 if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDBKey()]))
454458 $pageInfo['talkid'] = $talkids[$title->getNamespace()][$title->getDBKey()];
Index: trunk/phase3/RELEASE-NOTES
@@ -41,6 +41,8 @@
4242
4343 == API changes in 1.15 ==
4444 * (bug 16798) JSON encoding errors for some characters outside the BMP
 45+* (bug 16629) prop=info&inprop=protection lists empty legacy protections
 46+ incorrectly
4547
4648 === Languages updated in 1.15 ===
4749

Follow-up revisions

RevisionCommit summaryAuthorDate
r45683Backport r45675:...raymond19:10, 12 January 2009

Status & tagging log