From: Kevin Israel Date: Mon, 30 Sep 2013 17:36:59 +0000 (-0400) Subject: Installer: remove dependency on JSON extension X-Git-Tag: 1.31.0-rc.0~18627^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=ea60cd90a63dd7da3e957acfa97f5c5831310aab;p=lhc%2Fweb%2Fwiklou.git Installer: remove dependency on JSON extension * Remove one of the two uses of Xml::encodeJsVar(): to encode an unused JS variable dbTypes. The remaining use is only after installation is complete. * Add an environmental check to ensure the JSON functions are available before attempting installation. Bug: 54774 Change-Id: Ifb8859026b853ef3f328b796945a973c4add7eeb --- diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index 190ecba942..1d5bb28a5e 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -134,6 +134,10 @@ MediaWiki requires UTF-8 support to function correctly.", This is probably too low. The installation may fail!", 'config-ctype' => "'''Fatal:''' PHP must be compiled with support for the [http://www.php.net/manual/en/ctype.installation.php Ctype extension].", + 'config-json' => "'''Fatal:''' PHP was compiled without JSON support. +You must install either the PHP JSON extension or the [http://pecl.php.net/package/jsonc PECL jsonc] extension before installing MediaWiki. +* The PHP extension is included in Red Hat Enterprise Linux (CentOS) 5 and 6, though must be enabled in /etc/php.ini or /etc/php.d/json.ini. +* Some Linux distributions released after May 2013 omit the PHP extension, instead packaging the PECL extension as php5-json or php-pecl-jsonc.", 'config-xcache' => '[http://xcache.lighttpd.net/ XCache] is installed', 'config-apc' => '[http://www.php.net/apc APC] is installed', 'config-wincache' => '[http://www.iis.net/download/WinCacheForPhp WinCache] is installed', @@ -656,6 +660,10 @@ Parameters: 'config-memory-bad' => 'Parameters: * $1 is the configured memory_limit.', 'config-ctype' => 'Message if support for [http://www.php.net/manual/en/ctype.installation.php Ctype] is missing from PHP', + 'config-json' => 'Message if support for [[wikipedia:JSON|JSON]] is missing from PHP. +* "[[wikipedia:Red Hat Enterprise Linux|Red Hat Enterprise Linux]]" (RHEL) and "[[wikipedia:CentOS|CentOS]]" refer to two almost-identical Linux distributions. "5 and 6" refers to version 5 or 6 of either distribution. Because RHEL 7 likely will not include the PHP extension, do not translate as "5 or newer". +* "The [http://www.php.net/json PHP extension]" is the JSON extension included with PHP 5.2 and newer. +* "The [http://pecl.php.net/package/jsonc PECL extension]" is based on the PHP extension, though excludes code some distributions have found unacceptable (see [[bugzilla:47431]]).', 'config-xcache' => 'Message indicates if this program is available', 'config-apc' => 'Message indicates if this program is available', 'config-wincache' => 'Message indicates if this program is available', diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index afd2e3dbaf..1044f18fd6 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -131,6 +131,7 @@ abstract class Installer { 'envCheckLibicu', 'envCheckSuhosinMaxValueLength', 'envCheckCtype', + 'envCheckJSON', ); /** @@ -1181,6 +1182,17 @@ abstract class Installer { return true; } + /** + * @return bool + */ + protected function envCheckJSON() { + if ( !function_exists( 'json_decode' ) ) { + $this->showError( 'config-json' ); + return false; + } + return true; + } + /** * Get an array of likely places we can find executables. Check a bunch * of known Unix-like defaults, as well as the PATH environment variable diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 3e65eae350..77e9a2cb04 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -239,7 +239,6 @@ class WebInstallerOutput { <?php $this->outputTitle(); ?> getCssUrl() . "\n"; ?> - getJQuery() . "\n"; ?>