r74918 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74917‎ | r74918 | r74919 >
Date:20:34, 17 October 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
* 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 :)
Modified paths:
  • /trunk/phase3/includes/installer/CoreInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/Installer.php
@@ -692,14 +692,8 @@
693693 * TODO: document
694694 */
695695 public function envCheckShellLocale() {
696 - # Give up now if we're in safe mode or open_basedir.
697 - # It's theoretically possible but tricky to work with.
698 - if ( wfIniGetBool( "safe_mode" ) || ini_get( 'open_basedir' ) || !function_exists( 'exec' ) ) {
699 - return true;
700 - }
701 -
702696 $os = php_uname( 's' );
703 - $supported = array( 'Linux', 'SunOS', 'HP-UX' ); # Tested these
 697+ $supported = array( 'Linux', 'SunOS', 'HP-UX', 'Darwin' ); # Tested these
704698
705699 if ( !in_array( $os, $supported ) ) {
706700 return true;
@@ -707,13 +701,13 @@
708702
709703 # Get a list of available locales.
710704 $lines = $ret = false;
711 - exec( '/usr/bin/locale -a', $lines, $ret );
 705+ $lines = wfShellExec( '/usr/bin/locale -a', $ret, true );
712706
713707 if ( $ret ) {
714708 return true;
715709 }
716710
717 - $lines = wfArrayMap( 'trim', $lines );
 711+ $lines = wfArrayMap( 'trim', explode( "\n", $lines ) );
718712 $candidatesByLocale = array();
719713 $candidatesByLang = array();
720714
@@ -905,10 +899,7 @@
906900 }
907901
908902 $file = str_replace( '$1', $command, $versionInfo[0] );
909 -
910 - # Should maybe be wfShellExec( $file), but runs into a ulimit, see
911 - # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
912 - if ( strstr( `$file`, $versionInfo[1]) !== false ) {
 903+ if ( strstr( wfShellExec( $file ), $versionInfo[1]) !== false ) {
913904 return $command;
914905 }
915906 }
Index: trunk/phase3/includes/installer/CoreInstaller.php
@@ -448,6 +448,9 @@
449449
450450 // Allow multiple ob_flush() calls
451451 $GLOBALS['wgDisableOutputCompression'] = true;
 452+
 453+ // Some of the environment checks make shell requests, remove limits
 454+ $GLOBALS['wgMaxShellMemory'] = 0;
452455 }
453456
454457 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r74919Followup r74918, rm leftover debuggingdemon20:36, 17 October 2010
r75080Backported r74918 to 1.16: installer should check whether it can exec safely ...maxsem09:56, 20 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69013new-installer: Use `` instead of wfShellExec() like the old installer...avar19:44, 4 July 2010

Comments

#Comment by Ævar Arnfjörð Bjarmason (talk | contribs)   20:35, 17 October 2010

I just read this over (didn't test), but this change and the rationale look better than mine in r69013.

Good work.

Status & tagging log