wfShellExec fix, debug log tweak
authorTim Starling <tstarling@users.mediawiki.org>
Sat, 26 Nov 2005 02:57:18 +0000 (02:57 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sat, 26 Nov 2005 02:57:18 +0000 (02:57 +0000)
includes/GlobalFunctions.php

index 5666072..b4be648 100644 (file)
@@ -201,7 +201,8 @@ function wfDebugLog( $logGroup, $text, $public = true ) {
 function wfLogDBError( $text ) {
        global $wgDBerrorLog;
        if ( $wgDBerrorLog ) {
-               $text = date('D M j G:i:s T Y') . "\t".$text;
+               $host = trim(`hostname`);
+               $text = date('D M j G:i:s T Y') . "\t$host\t".$text;
                error_log( $text, 3, $wgDBerrorLog );
        }
 }
@@ -1585,8 +1586,11 @@ function wfShellExec( $cmd )
        global $IP;
        if ( php_uname( 's' ) == 'Linux' ) {
                $time = ini_get( 'max_execution_time' );
-               $memKB = intval( ini_get( 'memory_limit' ) / 1024 );
-               $cmd = escapeshellarg( "$IP/ulimit.sh" ) . " $time $memKB $cmd";
+               $mem = ini_get( 'memory_limit' );
+               if ( $time > 0 && $mem > 0 ) {
+                       $memKB = intval( $mem / 1024 );
+                       $cmd = escapeshellarg( "$IP/bin/ulimit.sh" ) . " $time $memKB $cmd";
+               }
        }
        return shell_exec( $cmd );
 }