PleaseStand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86696


Change subject: Installer: remove dependency on JSON extension
......................................................................

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
---
M includes/installer/Installer.i18n.php
M includes/installer/Installer.php
M includes/installer/WebInstallerOutput.php
3 files changed, 20 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/96/86696/1

diff --git a/includes/installer/Installer.i18n.php 
b/includes/installer/Installer.i18n.php
index 190ecba..c16d141 100644
--- a/includes/installer/Installer.i18n.php
+++ b/includes/installer/Installer.i18n.php
@@ -134,6 +134,10 @@
 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 <code>/etc/php.ini</code> or 
<code>/etc/php.d/json.ini</code>.
+* Some Linux distributions released after May 2013 omit the PHP extension, 
instead packaging the PECL extension as <code>php5-json</code> or 
<code>php-pecl-jsonc</code>.",
        '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 @@
        'config-memory-bad' => 'Parameters:
 * $1 is the configured <code>memory_limit</code>.',
        '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 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 afd2e3d..1044f18 100644
--- a/includes/installer/Installer.php
+++ b/includes/installer/Installer.php
@@ -131,6 +131,7 @@
                'envCheckLibicu',
                'envCheckSuhosinMaxValueLength',
                'envCheckCtype',
+               'envCheckJSON',
        );
 
        /**
@@ -1182,6 +1183,17 @@
        }
 
        /**
+        * @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
         * (which should maybe make it work for Windows?)
diff --git a/includes/installer/WebInstallerOutput.php 
b/includes/installer/WebInstallerOutput.php
index 3e65eae..77e9a2c 100644
--- a/includes/installer/WebInstallerOutput.php
+++ b/includes/installer/WebInstallerOutput.php
@@ -239,7 +239,6 @@
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title><?php $this->outputTitle(); ?></title>
        <?php echo $this->getCssUrl() . "\n"; ?>
-       <?php echo Html::inlineScript( "var dbTypes = " . Xml::encodeJsVar( 
$dbTypes ) ) . "\n"; ?>
        <?php echo $this->getJQuery() . "\n"; ?>
        <?php echo Html::linkedScript( '../skins/common/config.js' ) . "\n"; ?>
 </head>

-- 
To view, visit https://gerrit.wikimedia.org/r/86696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb8859026b853ef3f328b796945a973c4add7eeb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to