r107688 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107687‎ | r107688 | r107689 >
Date:01:33, 31 December 2011
Author:grafzahl
Status:deferred
Tags:score 
Comment:
Link to midi file only if explicitly requested even with vorbis rendering
Modified paths:
  • /trunk/extensions/Score/Score.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Score/Score.body.php
@@ -215,9 +215,7 @@
216216 }
217217
218218 /* Midi rendering? */
219 - if ( $options['vorbis'] ) {
220 - $options['midi'] = true;
221 - } elseif ( array_key_exists( 'midi', $args ) ) {
 219+ if ( array_key_exists( 'midi', $args ) ) {
222220 $options['midi'] = $args['midi'];
223221 } else {
224222 $options['midi'] = false;
@@ -288,7 +286,8 @@
289287
290288 try {
291289 /* Generate PNG and MIDI files if necessary */
292 - if ( ( !file_exists( $image ) && !file_exists( $multi1 ) ) || ( $options['midi'] && !file_exists( $midi ) ) ) {
 290+ if ( ( !file_exists( $image ) && !file_exists( $multi1 ) )
 291+ || ( ( $options['midi'] || $options['vorbis'] ) && !file_exists( $midi ) ) ) {
293292 self::generatePngAndMidi( $code, $options, $filePrefix, $factoryDirectory );
294293 }
295294
@@ -431,7 +430,7 @@
432431 if ( $rc2 != 0 ) {
433432 self::throwCallException( wfMessage( 'score-compilererr' ), $output );
434433 }
435 - if ( $options['midi'] && !file_exists( $factoryMidi ) ) {
 434+ if ( ( $options['midi'] || $options['vorbis'] ) && !file_exists( $factoryMidi ) ) {
436435 throw new ScoreException( wfMessage( 'score-nomidi' ) );
437436 }
438437
@@ -494,7 +493,7 @@
495494 . "\\score {\n"
496495 . $lilypondCode
497496 . "\t\\layout { }\n"
498 - . ( $options['midi'] ? "\t\\midi { }\n" : "" )
 497+ . ( ( $options['midi'] || $options['vorbis'] ) ? "\t\\midi { }\n" : "" )
499498 . "}\n";
500499 return $raw;
501500 }

Status & tagging log