Merge "Force $wgCategoryCollation to be uppercase in tests"
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 90bc891..cdd0ae9 100644 (file)
@@ -809,9 +809,14 @@ function wfParseUrl( $url ) {
        if ( !isset( $bits['host'] ) ) {
                $bits['host'] = '';
 
-               /* parse_url loses the third / for file:///c:/ urls (but not on variants) */
-               if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
-                       $bits['path'] = '/' . $bits['path'];
+               // bug 45069
+               if ( isset( $bits['path'] ) ) {
+                       /* parse_url loses the third / for file:///c:/ urls (but not on variants) */
+                       if ( substr( $bits['path'], 0, 1 ) !== '/' ) {
+                               $bits['path'] = '/' . $bits['path'];
+                       }
+               } else {
+                       $bits['path'] = '';
                }
        }
 
@@ -1381,9 +1386,13 @@ function wfUILang() {
 }
 
 /**
- * This is the new function for getting translated interface messages.
- * See the Message class for documentation how to use them.
- * The intention is that this function replaces all old wfMsg* functions.
+ * This is the function for getting translated interface messages.
+ *
+ * @see Message class for documentation how to use them.
+ * @see https://www.mediawiki.org/wiki/Manual:Messages_API
+ *
+ * This function replaces all old wfMsg* functions.
+ *
  * @param $key \string Message key.
  * Varargs: normal message parameters.
  * @return Message
@@ -2425,11 +2434,6 @@ define( 'TS_ORACLE', 6 );
  */
 define( 'TS_POSTGRES', 7 );
 
-/**
- * DB2 format time
- */
-define( 'TS_DB2', 8 );
-
 /**
  * ISO 8601 basic format with no timezone: 19860209T200000Z.  This is used by ResourceLoader
  */
@@ -2778,7 +2782,7 @@ function wfEscapeShellArg( ) {
  */
 function wfShellExec( $cmd, &$retval = null, $environ = array(), $limits = array() ) {
        global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime,
-               $wgMaxShellWallClockTime;
+               $wgMaxShellWallClockTime, $wgShellCgroup;
 
        static $disabled;
        if ( is_null( $disabled ) ) {
@@ -2837,8 +2841,15 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $limits = array
                $filesize = intval ( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize );
 
                if ( $time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0 ) {
-                       $cmd = '/bin/bash ' . escapeshellarg( "$IP/bin/ulimit5.sh" ) .
-                               " $time $mem $filesize $wallTime " . escapeshellarg( $cmd );
+                       $cmd = '/bin/bash ' . escapeshellarg( "$IP/includes/limit.sh" ) . ' ' .
+                               escapeshellarg( $cmd ) . ' ' .
+                               escapeshellarg(
+                                       "MW_CPU_LIMIT=$time; " .
+                                       'MW_CGROUP=' . escapeshellarg( $wgShellCgroup ) . '; ' .
+                                       "MW_MEM_LIMIT=$mem; " .
+                                       "MW_FILE_SIZE_LIMIT=$filesize; " .
+                                       "MW_WALL_CLOCK_LIMIT=$wallTime"
+                               );
                }
        }
        wfDebug( "wfShellExec: $cmd\n" );
@@ -3199,6 +3210,7 @@ function wfDoUpdates( $commit = '' ) {
  * @return string|bool The output number as a string, or false on error
  */
 function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $lowercase = true, $engine = 'auto' ) {
+       $input = (string)$input;
        if(
                $sourceBase < 2 ||
                $sourceBase > 36 ||