API: (bug 17224) Add siprop=rightsinfo to meta=siteinfo. Modified patch by Brianna...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sat, 31 Jan 2009 15:56:52 +0000 (15:56 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sat, 31 Jan 2009 15:56:52 +0000 (15:56 +0000)
CREDITS
RELEASE-NOTES
includes/api/ApiQuerySiteinfo.php

diff --git a/CREDITS b/CREDITS
index f21448a..9cb284a 100644 (file)
--- 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
index 0e50d55..e111b80 100644 (file)
@@ -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 ===
 
index b4f7445..49516fc 100644 (file)
@@ -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',