* Revert r69013 (Use `` instead of wfShellExec() like the old installer). This fails...
authorChad Horohoe <demon@users.mediawiki.org>
Sun, 17 Oct 2010 20:34:25 +0000 (20:34 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Sun, 17 Oct 2010 20:34:25 +0000 (20:34 +0000)
* Make envCheckShellLocale() use wfShellExec() as well (also works on OSX :)

includes/installer/CoreInstaller.php
includes/installer/Installer.php

index 7f72485..f0422eb 100644 (file)
@@ -448,6 +448,9 @@ abstract class CoreInstaller extends Installer {
 
                // Allow multiple ob_flush() calls
                $GLOBALS['wgDisableOutputCompression'] = true;
+
+               // Some of the environment checks make shell requests, remove limits
+               $GLOBALS['wgMaxShellMemory'] = 0;
        }
 
        /**
index 76108c2..2138505 100644 (file)
@@ -692,14 +692,8 @@ abstract class Installer {
         * TODO: document
         */
        public function envCheckShellLocale() {
-               # Give up now if we're in safe mode or open_basedir.
-               # It's theoretically possible but tricky to work with.
-               if ( wfIniGetBool( "safe_mode" ) || ini_get( 'open_basedir' ) || !function_exists( 'exec' ) ) {
-                       return true;
-               }
-
                $os = php_uname( 's' );
-               $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
+               $supported = array( 'Linux', 'SunOS', 'HP-UX', 'Darwin' ); # Tested these
 
                if ( !in_array( $os, $supported ) ) {
                        return true;
@@ -707,13 +701,13 @@ abstract class Installer {
 
                # Get a list of available locales.
                $lines = $ret = false;
-               exec( '/usr/bin/locale -a', $lines, $ret );
+               $lines = wfShellExec( '/usr/bin/locale -a', $ret, true );
 
                if ( $ret ) {
                        return true;
                }
 
-               $lines = wfArrayMap( 'trim', $lines );
+               $lines = wfArrayMap( 'trim', explode( "\n", $lines ) );
                $candidatesByLocale = array();
                $candidatesByLang = array();
 
@@ -905,10 +899,7 @@ abstract class Installer {
                                }
 
                                $file = str_replace( '$1', $command, $versionInfo[0] );
-
-                               # Should maybe be wfShellExec( $file), but runs into a ulimit, see
-                               # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
-                               if ( strstr( `$file`, $versionInfo[1]) !== false ) {
+                               if ( strstr( wfShellExec( $file ), $versionInfo[1]) !== false ) {
                                        return $command;
                                }
                        }