From 045ea2db0069d0af23c4a658d6c15dd9084add5f Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Sun, 17 Oct 2010 20:34:25 +0000 Subject: [PATCH] * Revert r69013 (Use `` instead of wfShellExec() like the old installer). This fails for people in safe_mode and for people with shell_exec in disable_functions. wfShellExec() handles these scenarios. For installation, we'll set $wgMaxShellMemory at 0 to disable the ulimit. * Make envCheckShellLocale() use wfShellExec() as well (also works on OSX :) --- includes/installer/CoreInstaller.php | 3 +++ includes/installer/Installer.php | 17 ++++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/includes/installer/CoreInstaller.php b/includes/installer/CoreInstaller.php index 7f72485754..f0422eb0b9 100644 --- a/includes/installer/CoreInstaller.php +++ b/includes/installer/CoreInstaller.php @@ -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; } /** diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 76108c264f..2138505067 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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; } } -- 2.20.1