From 1da6a4770d0036aa4cd154f8dd496930667f46d0 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Sat, 10 Jul 2010 12:29:15 +0000 Subject: [PATCH] Add $wgUseInstantCommons support to installer, tweak help based on presumed access to it --- includes/installer/Installer.i18n.php | 12 ++++++++++-- includes/installer/Installer.php | 3 +++ includes/installer/LocalSettingsGenerator.php | 7 +++++-- includes/installer/WebInstaller.php | 14 ++++++++++++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index 17bff64e51..909ae54dff 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -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:', diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 510b8c621e..2d2eec33d6 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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 diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index df25d5d4c3..85ee85877d 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -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 diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 96d4842736..21eccd0014 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -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 ) ) ) -- 2.20.1