MediaWiki r42136 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r42135‎ | r42136 (on ViewVC)‎ | r42137 >
Date:11:32, 16 October 2008
Author:tstarling
Status:old (Comments)
Tags:
Comment:
Use a variable for max shell time, don't use php.ini, like we do for memory and file size.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php	(revision 42135)
+++ trunk/phase3/includes/GlobalFunctions.php	(revision 42136)
@@ -2145,7 +2145,7 @@
  * @return collected stdout as a string (trailing newlines stripped)
  */
 function wfShellExec( $cmd, &$retval=null ) {
-	global $IP, $wgMaxShellMemory, $wgMaxShellFileSize;
+	global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime;
 
 	if( wfIniGetBool( 'safe_mode' ) ) {
 		wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" );
@@ -2155,7 +2155,7 @@
 	wfInitShellLocale();
 
 	if ( php_uname( 's' ) == 'Linux' ) {
-		$time = intval( ini_get( 'max_execution_time' ) );
+		$time = intval( $wgMaxShellTime );
 		$mem = intval( $wgMaxShellMemory );
 		$filesize = intval( $wgMaxShellFileSize );
 
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 42135)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 42136)
@@ -3257,6 +3257,11 @@
 $wgMaxShellFileSize = 102400;
 
 /**
+ * Maximum CPU time in seconds for shell processes under linux
+ */
+$wgMaxShellTime = 180;
+
+/**
 * Executable name of PHP cli client (php/php5)
 */
 $wgPhpCli = 'php';
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 42135)
+++ trunk/phase3/RELEASE-NOTES	(revision 42136)
@@ -166,6 +166,8 @@
 * Added a call to the 'UnwatchArticleComplete' hook to the watchlist editor.  This 
 	should make it so that ALL user-accessible methods of removing a page from a watchlist
   lead to this hook being called (it was previously only called from within Article.php
+* Maximum execution time for shell processes on linux is now configured with 
+  $wgMaxShellTime (180 seconds by default)
    
 === Bug fixes in 1.14 ===
 

Comments

#Comment by NerdyNSK (Talk | contribs)   21:07, 16 October 2008

The comment description refers to "linux", but I think we should change it to take into account that: first, the operating system is named "GNU/Linux", not "linux" (which is only the kernel); second, that this code may also apply to other operating systems not using the Linux kernel.

Status & tagging log

  • 15:36, 12 September 2011 Meno25 (Talk | contribs) changed the status of r42136 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox