From: Roan Kattouw Date: Sat, 31 Jan 2009 15:56:52 +0000 (+0000) Subject: API: (bug 17224) Add siprop=rightsinfo to meta=siteinfo. Modified patch by Brianna... X-Git-Tag: 1.31.0-rc.0~43100 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=06b5d0f9d5db2e23195aa53f4ac839bf3ce3262c;p=lhc%2Fweb%2Fwiklou.git API: (bug 17224) Add siprop=rightsinfo to meta=siteinfo. Modified patch by Brianna Laugher --- diff --git a/CREDITS b/CREDITS index f21448aecc..9cb284a64f 100644 --- a/CREDITS +++ b/CREDITS @@ -58,6 +58,7 @@ following names for their contribution to the product. * Agbad * Brad Jorsch * Brent G +* Brianna Laugher * Daniel Arnold * Danny B. * FunPika diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0e50d55927..e111b80dab 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -138,6 +138,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN Building query properly now using makeList() * (bug 17182) Fix pretty printer so URLs with parentheses in them are autolinked correctly +* (bug 17224) Added siprop=rightsinfo to meta=siteinfo === Languages updated in 1.15 === diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index b4f7445769..49516fc894 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -79,6 +79,9 @@ class ApiQuerySiteinfo extends ApiQueryBase { case 'fileextensions': $this->appendFileExtensions( $p ); break; + case 'rightsinfo': + $this->appendRightsInfo( $p ); + break; default : ApiBase :: dieDebug( __METHOD__, "Unknown prop=$p" ); } @@ -335,6 +338,24 @@ class ApiQuerySiteinfo extends ApiQueryBase { } + protected function appendRightsInfo( $property ) { + global $wgRightsPage, $wgRightsUrl, $wgRightsText; + $title = Title::newFromText( $wgRightsPage ); + $url = $title ? $title->getFullURL() : $wgRightsUrl; + $text = $wgRightsText; + if( !$text && $title ) { + $text = $title->getPrefixedText(); + } + + $data = array( + 'url' => $url ? $url : '', + 'text' => $text ? $text : '' + ); + + $this->getResult()->addValue( 'query', $property, $data ); + } + + public function getAllowedParams() { return array( 'prop' => array( @@ -352,6 +373,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { 'usergroups', 'extensions', 'fileextensions', + 'rightsinfo', ) ), 'filteriw' => array( @@ -379,6 +401,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' "usergroups" - Returns user groups and the associated permissions', ' "extensions" - Returns extensions installed on the wiki', ' "fileextensions" - Returns list of file extensions allowed to be uploaded', + ' "rightsinfo" - Returns wiki rights (license) information if available', ), 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most',