Index: trunk/phase3/includes/media/Bitmap.php |
— | — | @@ -147,16 +147,13 @@ |
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
| 151 | + // Use one thread only, to avoid deadlock bugs on OOM |
| 152 | + $tempEnv = 'OMP_NUM_THREADS=1 '; |
151 | 153 | if ( strval( $wgImageMagickTempDir ) !== '' ) { |
152 | | - $tempEnv = 'MAGICK_TMPDIR=' . wfEscapeShellArg( $wgImageMagickTempDir ) . ' '; |
153 | | - } else { |
154 | | - $tempEnv = ''; |
| 154 | + $tempEnv .= 'MAGICK_TMPDIR=' . wfEscapeShellArg( $wgImageMagickTempDir ) . ' '; |
155 | 155 | } |
156 | 156 | |
157 | 157 | $cmd = |
158 | | - $tempEnv . |
159 | | - // Use one thread only, to avoid deadlock bugs on OOM |
160 | | - 'OMP_NUM_THREADS=1 ' . |
161 | 158 | wfEscapeShellArg( $wgImageMagickConvertCommand ) . |
162 | 159 | // Specify white background color, will be used for transparent images |
163 | 160 | // in Internet Explorer/Windows instead of default black. |
— | — | @@ -173,6 +170,12 @@ |
174 | 171 | " -depth 8 $sharpen" . |
175 | 172 | " {$animation_post} " . |
176 | 173 | wfEscapeShellArg( $this->escapeMagickOutput( $dstPath ) ) . " 2>&1"; |
| 174 | + |
| 175 | + if ( !wfIsWindows() ) { |
| 176 | + // Assume we have a POSIX compliant shell which accepts variable assignments preceding the command |
| 177 | + $cmd = $tempEnv . $cmd; |
| 178 | + } |
| 179 | + |
177 | 180 | wfDebug( __METHOD__.": running ImageMagick: $cmd\n" ); |
178 | 181 | wfProfileIn( 'convert' ); |
179 | 182 | $err = wfShellExec( $cmd, $retval ); |