Merge "(bug 38152) jquery.tablesorter: Use .data() instead of .attr()"
[lhc/web/wiklou.git] / includes / api / ApiQuerySiteinfo.php
index 4f22f53..38e37c0 100644 (file)
  * @file
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       // Eclipse helper - will be ignored in production
-       require_once( 'ApiQueryBase.php' );
-}
-
 /**
  * A query action to return meta information about the wiki site.
  *
@@ -126,9 +121,14 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['dbtype'] = $GLOBALS['wgDBtype'];
                $data['dbversion'] = $this->getDB()->getServerVersion();
 
-               $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
-               if ( $svn ) {
-                       $data['rev'] = $svn;
+               $git = SpecialVersion::getGitHeadSha1( $GLOBALS['IP'] );
+               if ( $git ) {
+                       $data['git-hash'] = $git;
+               } else {
+                       $svn = SpecialVersion::getSvnRevision( $GLOBALS['IP'] );
+                       if ( $svn ) {
+                               $data['rev'] = $svn;
+                       }
                }
 
                // 'case-insensitive' option is reserved for future
@@ -147,6 +147,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['fallback'] = $fallbacks;
                $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
 
+               if( $wgContLang->hasVariants() ) {
+                       $variants = array();
+                       foreach( $wgContLang->getVariants() as $code ) {
+                               $variants[] = array( 'code' => $code );
+                       }
+                       $data['variants'] = $variants;
+                       $this->getResult()->setIndexedTagName( $data['variants'], 'lang' );
+               }
+
                if ( $wgContLang->isRTL() ) {
                        $data['rtl'] = '';
                }
@@ -182,6 +191,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        $data['misermode'] = '';
                }
 
+               $data['maxuploadsize'] = UploadBase::getMaxUploadSize();
+
                wfRunHooks( 'APIQuerySiteInfoGeneralInfo', array( $this, &$data ) );
 
                return $this->getResult()->addValue( 'query', $property, $data );
@@ -209,6 +220,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        if ( MWNamespace::isContent( $ns ) ) {
                                $data[$ns]['content'] = '';
                        }
+
+                       if ( MWNamespace::isNonincludable( $ns ) ) {
+                               $data[$ns]['nonincludable'] = '';
+                       }
                }
 
                $this->getResult()->setIndexedTagName( $data, 'ns' );
@@ -275,13 +290,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                }
 
                $params = $this->extractRequestParams();
-               $langCode = isset( $params['inlanguagecode '] ) ? $params['inlanguagecode '] : '';
-
-               if( $langCode ) {
-                       $langNames = Language::getTranslatedLanguageNames( $langCode );
-               } else {
-                       $langNames = Language::getLanguageNames();
-               }
+               $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
+               $langNames = Language::fetchLanguageNames( $langCode );
 
                $getPrefixes = Interwiki::getAllPrefixes( $local );
                $data = array();
@@ -481,13 +491,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
        public function appendLanguages( $property ) {
                $params = $this->extractRequestParams();
-               $langCode = isset( $params['inlanguagecode '] ) ? $params['inlanguagecode '] : '';
-
-               if( $langCode ) {
-                       $langNames = Language::getTranslatedLanguageNames( $langCode );
-               } else {
-                       $langNames = Language::getLanguageNames();
-               }
+               $langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
+               $langNames = Language::fetchLanguageNames( $langCode );
 
                $data = array();
 
@@ -588,7 +593,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        ),
                        'showalldb' => false,
                        'numberingroup' => false,
-                       'inlanguagecode ' => null,
+                       'inlanguagecode' => null,
                );
        }
 
@@ -618,7 +623,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        'filteriw' =>  'Return only local or only nonlocal entries of the interwiki map',
                        'showalldb' => 'List all database servers, not just the one lagging the most',
                        'numberingroup' => 'Lists the number of users in user groups',
-                       'inlanguagecode ' => 'Language code for localised language names (best effort, use CLDR extension)',
+                       'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)',
                );
        }
 
@@ -641,7 +646,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
        }
 
        public function getHelpUrls() {
-               return 'http://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';
+               return 'https://www.mediawiki.org/wiki/API:Meta#siteinfo_.2F_si';
        }
 
        public function getVersion() {