Add $wgUseInstantCommons support to installer, tweak help based on presumed access...
authorChad Horohoe <demon@users.mediawiki.org>
Sat, 10 Jul 2010 12:29:15 +0000 (12:29 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sat, 10 Jul 2010 12:29:15 +0000 (12:29 +0000)
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/WebInstaller.php

index 17bff64..909ae54 100644 (file)
@@ -398,6 +398,15 @@ Ideally, this should not be accessible from the web.',
 Upload an image of the appropriate size, and enter the URL here.
 
 If you do not want a logo, leave this box blank.",
+       'config-instantcommons'           => 'Enable Instant Commons',
+       'config-instantcommons-help'      => '[http://www.mediawiki.org/wiki/InstantCommons Instant Commons] is a feature that allows wikis
+to use images, sounds and other media found on the [http://commons.wikimedia.org/ Wikimedia Commons] site. In order to do this, MediaWiki requires
+access to the Internet. $1
+
+For more information on this feature, including instructions on how to set it up for
+wikis other than the Wikimedia Commons, consult [http://mediawiki.org/wiki/Manual:$wgForeignFileRepos the manual]',
+       'config-instantcommons-good'      => 'We were able to detect internet connectivity during the environment checks, so you should be able to enable this if you want to.',
+       'config-instantcommons-bad'       => '\'\'Unfortunately, we were unable to detect internet connectivity during the environment checks, so you might be unable to use this. If you are behind a proxy, see [http://www.mediawiki.org/wiki/Manual:$wgHTTPProxy this page]\'\'',
        'config-cc-error'                 => 'The Creative Commons license chooser gave no result.
 Enter the license name manually.',
        'config-cc-again'                 => 'Pick again...',
@@ -406,8 +415,7 @@ Enter the license name manually.',
        'config-cache-options'            => 'Settings for object caching:',
        'config-cache-help'               => 'Object caching is used to improve the speed of MediaWiki by caching frequently used data.
 Medium to large sites are highly encouraged to enable this, and small sites will see benefits as well.',
-       'config-cache-none'               => 'No caching.
-No functionality is removed, but speed may be impacted.',
+       'config-cache-none'               => 'No caching (no functionality is removed, but speed may be impacted on larger wiki sites)',
        'config-cache-accel'              => 'PHP object caching (APC, eAccelerator, XCache or WinCache)',
        'config-cache-memcached'          => 'Use Memcached (requires additional setup and configuration)',
        'config-memcached-servers'        => 'Memcached servers:',
index 510b8c6..2d2eec3 100644 (file)
@@ -37,6 +37,7 @@ abstract class Installer {
                'wgLogo',
                'wgShellLocale',
                'wgSecretKey',
+               'wgUseInstantCommons',
        );
 
        /**
@@ -69,6 +70,7 @@ abstract class Installer {
                '_CCDone' => false,
                '_Extensions' => array(),
                '_MemCachedServers' => '',
+               '_ExternalHTTP' => false,
        );
 
        /**
@@ -376,6 +378,7 @@ abstract class Installer {
                        $this->showMessage( 'config-env-latest-can-not-check', $latestInfoUrl );
                        return;
                }
+               $this->setVar( '_ExternalHTTP', true );
                $latestInfo = FormatJson::decode($latestInfo);
                if ($latestInfo === false || !isset( $latestInfo->mwreleases ) ) {
                        # For when the request is successful but there's e.g. some silly man in
index df25d5d..85ee858 100644 (file)
@@ -23,10 +23,10 @@ class LocalSettingsGenerator {
                        'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon',
                        'wgRightsText', 'wgRightsCode', 'wgMainCacheType', 'wgEnableUploads',
                        'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser',
-                       'wgDBpassword' ), $db->getGlobalNames() );
+                       'wgDBpassword', 'wgUseInstantCommons' ), $db->getGlobalNames() );
                $unescaped = array( 'wgRightsIcon' );
                $boolItems = array( 'wgEnableEmail', 'wgEnableUserEmail', 'wgEnotifUserTalk',
-                       'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads' );
+                       'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons' );
                foreach( $confItems as $c ) {
                        $val = $installer->getVar( $c );
                        if( in_array( $c, $boolItems ) ) {
@@ -216,6 +216,9 @@ if ( \$wgCommandLineMode ) {
 {$magic}\$wgUseImageMagick = true;
 {$magic}\$wgImageMagickConvertCommand = \"{$this->values['wgImageMagickConvertCommand']}\";
 
+# InstantCommons, allows wiki to use images from http://commons.wikimedia.org
+\$wgUseInstantCommons  = {$this->values['wgUseInstantCommons']};
+
 ## If you use ImageMagick (or any other shell command) on a
 ## Linux server, this will need to be set to the name of an
 ## available UTF-8 locale
index 96d4842..21eccd0 100644 (file)
@@ -1414,7 +1414,16 @@ class WebInstaller_Options extends WebInstallerPage {
                                'var' => 'wgLogo',
                                'label' => 'config-logo'
                        ) ) .
-                       $this->parent->getHelpBox( 'config-logo-help' ) .
+                       $this->parent->getHelpBox( 'config-logo-help' )
+               );
+               $canUse = $this->getVar( '_ExternalHTTP' ) ?
+                       'config-instantcommons-good' : 'config-instantcommons-bad';
+               $this->addHTML(
+                       $this->parent->getCheckBox( array(
+                               'var' => 'wgUseInstantCommons',
+                               'label' => 'config-instantcommons',
+                       ) ) .
+                       $this->parent->getHelpBox( 'config-instantcommons-help', wfMsgNoTrans( $canUse ) ) .
                        $this->parent->getFieldsetEnd()
                );
 
@@ -1533,7 +1542,8 @@ class WebInstaller_Options extends WebInstallerPage {
                $this->parent->setVarsFromRequest( array( '_RightsProfile', '_LicenseCode',
                        'wgEnableEmail', 'wgPasswordSender', 'wgEnableUpload', 'wgLogo',
                        'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist',
-                       'wgEmailAuthentication', 'wgMainCacheType', '_MemCachedServers' ) );
+                       'wgEmailAuthentication', 'wgMainCacheType', '_MemCachedServers',
+                       'wgUseInstantCommons' ) );
 
                if ( !in_array( $this->getVar( '_RightsProfile' ),
                        array_keys( $this->parent->rightsProfiles ) ) )