Ricordisamoa has uploaded a new change for review.

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

Change subject: Add applicable protections to the prop=info API
......................................................................

Add applicable protections to the prop=info API

Disabled by default, enabled with inprop=protections.
Also valid for non-existing titles.

Change-Id: I98604b60626b84bd8cb601a4149b80db1b6787b7
---
M includes/api/ApiQueryInfo.php
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/75/181875/1

diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index e6667b4..49c6e72 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -42,7 +42,7 @@
        private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
                $pageLatest, $pageLength;
 
-       private $protections, $watched, $watchers, $notificationtimestamps,
+       private $protections, $applicableProtections, $watched, $watchers, 
$notificationtimestamps,
                $talkids, $subjectids, $displaytitles;
        private $showZeroWatchers = false;
 
@@ -419,6 +419,13 @@
                                        $this->protections[$ns][$dbkey];
                        }
                        $this->getResult()->setIndexedTagName( 
$pageInfo['protection'], 'pr' );
+
+                       $pageInfo['applicable-protection'] = array();
+                       if ( isset( $this->applicableProtections[$ns][$dbkey] ) 
) {
+                               $pageInfo['applicable-protection'] =
+                                       
$this->applicableProtections[$ns][$dbkey];
+                       }
+                       $this->getResult()->setIndexedTagName( 
$pageInfo['applicable-protection'], 'pr' );
                }
 
                if ( $this->fld_watched && isset( $this->watched[$ns][$dbkey] ) 
) {
@@ -576,6 +583,9 @@
                        } else {
                                $others[] = $title;
                        }
+                       // Applicable protections
+                       
$this->applicableProtections[$title->getNamespace()][$title->getDBkey()] =
+                               array_values( $title->getRestrictionTypes() );
                }
 
                if ( count( $others ) ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98604b60626b84bd8cb601a4149b80db1b6787b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to