Export information about external image settings via siteinfo API.
authorC. Scott Ananian <cscott@cscott.net>
Thu, 11 Jul 2013 17:56:35 +0000 (13:56 -0400)
committerAnomie <bjorsch@wikimedia.org>
Tue, 16 Jul 2013 14:06:32 +0000 (14:06 +0000)
This configuration information is needed in order for Parsoid to
appropriately parse external image URLs.

Bug: 51092
Change-Id: I17aae9512e0994222785c5edc9de644685b2498c

includes/api/ApiQuerySiteinfo.php

index 09a0f3d..eb4569f 100644 (file)
@@ -129,6 +129,21 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['dbtype'] = $GLOBALS['wgDBtype'];
                $data['dbversion'] = $this->getDB()->getServerVersion();
 
+               $allowFrom = array( '' );
+               $allowException = true;
+               if ( !$GLOBALS['wgAllowExternalImages'] ) {
+                       if ( $GLOBALS['wgEnableImageWhitelist'] ) {
+                               $data['imagewhitelistenabled'] = '';
+                       }
+                       $allowFrom = $GLOBALS['wgAllowExternalImagesFrom'];
+                       $allowException = !empty( $allowFrom );
+               }
+               if ( $allowException ) {
+                       $data['externalimages'] = (array) $allowFrom;
+                       $this->getResult()->setIndexedTagName( $data['externalimages'], 'prefix' );
+               }
+
+
                if ( !$wgDisableLangConversion ) {
                        $data['langconversion'] = '';
                }