r106665 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106664‎ | r106665 | r106666 >
Date:17:59, 19 December 2011
Author:mah
Status:ok
Tags:
Comment:
* Added information about $wgMaxShellMemory to README
* Escape zeroth shell arg as well, just to be safe

Author: Alexander Klauer
Modified paths:
  • /trunk/extensions/Score/README (modified) (history)
  • /trunk/extensions/Score/Score.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Score/README
@@ -28,9 +28,14 @@
2929 $wgLilyPond = '/path/to/your/lilypond/executable'; /* required */
3030 $wgScoreTrim = true; /* Set to false if you don't want score trimming */
3131
32 - to your LocalSettings.php file.
 32+ to your LocalSettings.php file. If you get unexpected out-of-memory errors,
 33+ you may also have to increase $wgMaxShellMemory (see
3334
 35+ https://www.mediawiki.org/wiki/Manual:$wgMaxShellMemory
3436
 37+ for more information.
 38+
 39+
3540 Usage
3641 =====
3742
Index: trunk/extensions/Score/Score.body.php
@@ -194,10 +194,10 @@
195195 if ( !is_executable( $wgLilyPond ) ) {
196196 throw new ScoreException( 'score-notexecutable' );
197197 }
198 - $cmd = $wgLilyPond
 198+ $cmd = wfEscapeShellArg( $wgLilyPond )
199199 . " -dsafe='#t' -dbackend=eps --png --header=texidoc "
200200 . wfEscapeShellArg( $lilypondFile )
201 - . " 2>&1"; // FIXME: This last bit is probably not portable
 201+ . ' 2>&1'; // FIXME: This last bit is probably not portable
202202 $output = wfShellExec( $cmd, $rc2 );
203203 $rc = chdir( $oldcwd );
204204 if ( !$rc ) {
@@ -314,7 +314,8 @@
315315 private static function trimImage( $source, $dest ) {
316316 global $wgImageMagickConvertCommand;
317317
318 - $cmd = "$wgImageMagickConvertCommand -trim "
 318+ $cmd = wfEscapeShellArg( $wgImageMagickConvertCommand )
 319+ . ' -trim '
319320 . wfEscapeShellArg( $source ) . ' '
320321 . wfEscapeShellArg( $dest );
321322 wfShellExec( $cmd, $rc );

Status & tagging log