MaxSem has uploaded a new change for review. https://gerrit.wikimedia.org/r/105357
Change subject: Add protection information to mobileview ...................................................................... Add protection information to mobileview Bug: 59240 Change-Id: If4b3d57e00a81735c5541abe28ec2dd1bef37b62 --- M includes/api/ApiMobileView.php 1 file changed, 25 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/57/105357/1 diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php index dc0ba72..7e1c0cb 100644 --- a/includes/api/ApiMobileView.php +++ b/includes/api/ApiMobileView.php @@ -122,6 +122,10 @@ $result[] = $section; } } + + if ( isset( $prop['protection'] ) ) { + $this->addProtection( $title ); + } // https://bugzilla.wikimedia.org/show_bug.cgi?id=51586 // Inform ppl if the page is infested with LiquidThreads but that's the only thing we support about it. if ( class_exists( 'LqtDispatch' ) && LqtDispatch::isLqtPage( $title ) ) { @@ -461,6 +465,25 @@ } } + /** + * Adds protection information + * @param Title $title + */ + private function addProtection( Title $title ) { + $result = $this->getResult(); + $protection = array(); + foreach ( $title->getRestrictionTypes() as $type ) { + $levels = $title->getRestrictions( $type ); + if ( $levels ) { + $protection[$type] = $levels; + $result->setIndexedTagName( $protection[$type], 'level' ); + } + } + $result->addValue( null, $this->getModuleName(), + array( 'protection' => $protection ) + ); + } + public function getAllowedParams() { $res = array( 'page' => array( @@ -481,6 +504,7 @@ 'normalizedtitle', 'lastmodified', 'lastmodifiedby', + 'protection', ) ), 'sectionprop' => array( @@ -543,6 +567,7 @@ ' normalizedtitle - normalized page title', ' lastmodified - MW timestamp for when the page was last modified, e.g. "20130730174438"', ' lastmodifiedby - information about the user who modified the page last', + ' protection - information about protection level', ), 'sectionprop' => 'What information about sections to get', 'variant' => "Convert content into this language variant", -- To view, visit https://gerrit.wikimedia.org/r/105357 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If4b3d57e00a81735c5541abe28ec2dd1bef37b62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits