r107183 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107182‎ | r107183 | r107184 >
Date:21:18, 23 December 2011
Author:grafzahl
Status:ok
Tags:
Comment:
Don't create dead MIDI links, display error message instead
Modified paths:
  • /trunk/extensions/Score/Score.body.php (modified) (history)
  • /trunk/extensions/Score/Score.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Score/Score.i18n.php
@@ -40,6 +40,7 @@
4141 'score-noabcinput' => 'ABC source file $1 could not be created.',
4242 'score-nofactory' => 'Failed to create LilyPond factory directory.',
4343 'score-noinput' => 'Failed to create LilyPond input file $1.',
 44+ 'score-nomidi' => 'No MIDI file generated despite being requested. If you are working in raw LilyPond mode, make sure to provide a proper \midi block.',
4445 'score-nooutput' => 'Failed to create LilyPond image directory $1.',
4546 'score-notexecutable' => 'Could not execute LilyPond: $1 is not an executable file. Make sure <code>$wgLilyPond</code> is set correctly.',
4647 'score-page' => 'Page $1',
@@ -66,6 +67,7 @@
6768 'score-noabcinput' => 'Displayed if an ABC source file could not be created for lang="ABC". $1 is the path to the file that could not be created.',
6869 'score-nofactory' => 'Displayed if the LilyPond/ImageMagick working directory cannot be created.',
6970 'score-noinput' => 'Displayed if the LilyPond input file cannot be created. $1 is the path to the input file.',
 71+ 'score-nomidi' => 'Displayed if MIDI file generation was requested but no MIDI file was generated.',
7072 'score-nooutput' => 'Displayed if the LilyPond image/midi dir cannot be created. $1 is the name of the directory.',
7173 'score-notexecutable' => 'Displayed if LilyPond binary cannot be executed. $1 is the path to the LilyPond binary.',
7274 'score-page' => 'The word "Page" as used in pagination. $1 is the page number',
Index: trunk/extensions/Score/Score.body.php
@@ -351,6 +351,9 @@
352352 if ( $rc2 != 0 ) {
353353 self::throwCallException( wfMessage( 'score-compilererr' ), $output );
354354 }
 355+ if ( $options['midi'] && !file_exists( $factoryMidi ) ) {
 356+ throw new ScoreException( wfMessage( 'score-nomidi' ) );
 357+ }
355358
356359 /* trim output images if wanted */
357360 if ( $wgScoreTrim ) {

Status & tagging log