(bug 15535) prop=info&inprop=protection doesn't list pre-1.10 protections if the...
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 9 Sep 2008 20:42:19 +0000 (20:42 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 9 Sep 2008 20:42:19 +0000 (20:42 +0000)
RELEASE-NOTES
includes/api/ApiQueryInfo.php

index 4d3fd6e..fb6bee0 100644 (file)
@@ -226,6 +226,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 15486) action=block ignores autoblock parameter
 * (bug 15492) added rcprop=loginfo to list=recentchanges
 * (bug 15527) action=rollback can now revert anonymous editors
+* (bug 15535) prop=info&inprop=protection doesn't list pre-1.10 protections
+  if the page is also protected otherwise (1.10+ style or cascading)
 
 === Languages updated in 1.14 ===
 
index 884473e..a8cc0c6 100644 (file)
@@ -412,40 +412,38 @@ class ApiQueryInfo extends ApiQueryBase {
                        }
 
                        if($fld_protection) {
+                               $pageInfo['protection'] = array();
                                if (isset($protections[$pageid])) {
                                        $pageInfo['protection'] = $protections[$pageid];
                                        $result->setIndexedTagName($pageInfo['protection'], 'pr');
-                               } else {
-                                       # Also check old restrictions
-                                       if( $pageRestrictions[$pageid] ) {
-                                               foreach( explode( ':', trim( $pageRestrictions[$pageid] ) ) as $restrict ) {
-                                                       $temp = explode( '=', trim( $restrict ) );
-                                                       if(count($temp) == 1) {
-                                                               // old old format should be treated as edit/move restriction
-                                                               $restriction = trim( $temp[0] );
-                                                               $pageInfo['protection'][] = array(
-                                                                       'type' => 'edit',
-                                                                       'level' => $restriction,
-                                                                       'expiry' => 'infinity',
-                                                               );
-                                                               $pageInfo['protection'][] = array(
-                                                                       'type' => 'move',
-                                                                       'level' => $restriction,
-                                                                       'expiry' => 'infinity',
-                                                               );
-                                                       } else {
-                                                               $restriction = trim( $temp[1] );
-                                                               $pageInfo['protection'][] = array(
-                                                                       'type' => $temp[0],
-                                                                       'level' => $restriction,
-                                                                       'expiry' => 'infinity',
-                                                               );
-                                                       }
+                               }
+                               # Also check old restrictions
+                               if( $pageRestrictions[$pageid] ) {
+                                       foreach( explode( ':', trim( $pageRestrictions[$pageid] ) ) as $restrict ) {
+                                               $temp = explode( '=', trim( $restrict ) );
+                                               if(count($temp) == 1) {
+                                                       // old old format should be treated as edit/move restriction
+                                                       $restriction = trim( $temp[0] );
+                                                       $pageInfo['protection'][] = array(
+                                                               'type' => 'edit',
+                                                               'level' => $restriction,
+                                                               'expiry' => 'infinity',
+                                                       );
+                                                       $pageInfo['protection'][] = array(
+                                                               'type' => 'move',
+                                                               'level' => $restriction,
+                                                               'expiry' => 'infinity',
+                                                       );
+                                               } else {
+                                                       $restriction = trim( $temp[1] );
+                                                       $pageInfo['protection'][] = array(
+                                                               'type' => $temp[0],
+                                                               'level' => $restriction,
+                                                               'expiry' => 'infinity',
+                                                       );
                                                }
-                                               $result->setIndexedTagName($pageInfo['protection'], 'pr');
-                                       } else {
-                                               $pageInfo['protection'] = array();
                                        }
+                                       $result->setIndexedTagName($pageInfo['protection'], 'pr');
                                }
                        }
                        if($fld_talkid && isset($talkids[$title->getNamespace()][$title->getDbKey()]))