Merge "Api method documentation tweaks"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 1a21e20..35887a4 100644 (file)
@@ -1053,11 +1053,22 @@ function wfDebugLog( $logGroup, $text, $public = true ) {
  * @param $text String: database error message.
  */
 function wfLogDBError( $text ) {
-       global $wgDBerrorLog;
+       global $wgDBerrorLog, $wgDBerrorLogInUTC;
        if ( $wgDBerrorLog ) {
                $host = wfHostname();
                $wiki = wfWikiID();
-               $text = date( 'D M j G:i:s T Y' ) . "\t$host\t$wiki\t$text";
+
+               if( $wgDBerrorLogInUTC ) {
+                       $wikiTimezone = date_default_timezone_get();
+                       date_default_timezone_set( 'UTC' );
+               }
+               $date = date( 'D M j G:i:s T Y' );
+               if( $wgDBerrorLogInUTC ) {
+                       // Restore timezone
+                       date_default_timezone_set( $wikiTimezone );
+               }
+
+               $text = "$date\t$host\t$wiki\t$text";
                wfErrorLog( $text, $wgDBerrorLog );
        }
 }
@@ -2874,9 +2885,11 @@ function wfEscapeShellArg( ) {
  *                 (non-zero is usually failure)
  * @param $environ Array optional environment variables which should be
  *                 added to the executed command environment.
+ * @param $limits Array optional array with limits(filesize, memory, time)
+ *                 this overwrites the global wgShellMax* limits.
  * @return string collected stdout as a string (trailing newlines stripped)
  */
-function wfShellExec( $cmd, &$retval = null, $environ = array() ) {
+function wfShellExec( $cmd, &$retval = null, $environ = array(), $limits = array() ) {
        global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime;
 
        static $disabled;
@@ -2924,9 +2937,9 @@ function wfShellExec( $cmd, &$retval = null, $environ = array() ) {
        $cmd = $envcmd . $cmd;
 
        if ( php_uname( 's' ) == 'Linux' ) {
-               $time = intval( $wgMaxShellTime );
-               $mem = intval( $wgMaxShellMemory );
-               $filesize = intval( $wgMaxShellFileSize );
+               $time = intval ( isset($limits['time']) ? $limits['time'] : $wgMaxShellTime );
+               $mem = intval ( isset($limits['memory']) ? $limits['memory'] : $wgMaxShellMemory );
+               $filesize = intval ( isset($limits['filesize']) ? $limits['filesize'] : $wgMaxShellFileSize );
 
                if ( $time > 0 && $mem > 0 ) {
                        $script = "$IP/bin/ulimit4.sh";
@@ -3196,7 +3209,7 @@ function wfUseMW( $req_ver ) {
  * http://bugs.php.net/bug.php?id=33898
  *
  * PHP's basename() only considers '\' a pathchar on Windows and Netware.
- * We'll consider it so always, as we don't want \s in our Unix paths either.
+ * We'll consider it so always, as we don't want '\s' in our Unix paths either.
  *
  * @param $path String
  * @param $suffix String: to remove if present