[MediaWiki-commits] [Gerrit] mediawiki...Score[master]: Make image check precede MIDI check

2018-01-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399868 )

Change subject: Make image check precede MIDI check
..


Make image check precede MIDI check

`score-noimages` was in the HTML generation stage, while MIDI checking
was in the PNG generation stage. This meant that MIDI checking took
precedence, making the error message unhelpful to the real issue.

This change places the image checking before MIDI checking right after
engraving.

Bug: T116392
Change-Id: If01818ffc474865ebb6cc57b2dccc9f665d841f0
---
M includes/Score.php
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Brion VIBBER: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Score.php b/includes/Score.php
index 5d2597e..ca32ab4 100644
--- a/includes/Score.php
+++ b/includes/Score.php
@@ -502,9 +502,6 @@
'title' => $pageNumb
] );
}
-   } else {
-   /* No images; this may happen in raw mode or 
when the user omits the score code */
-   throw new ScoreException( wfMessage( 
'score-noimages' ) );
}
if ( $options['generate_audio'] ) {
$length = $metaData[basename( $audioPath 
)]['length'];
@@ -589,6 +586,7 @@
$factoryLy = "$factoryDirectory/file.ly";
$factoryMidi = "$factoryDirectory/file.midi";
$factoryImage = "$factoryDirectory/file.png";
+   $factoryPage1 = "$factoryDirectory/file-page1.png";
$factoryImageTrimmed = "$factoryDirectory/file-trimmed.png";
 
/* Generate LilyPond input file */
@@ -646,6 +644,11 @@
self::throwCallException( wfMessage( 
'score-compilererr' ), $output,
$options['factory_directory'] );
}
+
+   if ( !file_exists( $factoryImage ) && !file_exists( 
$factoryPage1 ) ) {
+   throw new ScoreException( wfMessage( 'score-noimages' ) 
);
+   }
+
$needMidi = false;
if ( !$options['raw'] || $options['generate_audio'] && 
!$options['override_midi'] ) {
$needMidi = true;

-- 
To view, visit https://gerrit.wikimedia.org/r/399868
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If01818ffc474865ebb6cc57b2dccc9f665d841f0
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: Ebe123 
Gerrit-Reviewer: Brion VIBBER 
Gerrit-Reviewer: Esanders 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...Score[master]: Make image check precede MIDI check

2017-12-22 Thread Ebe123 (Code Review)
Ebe123 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399868 )

Change subject: Make image check precede MIDI check
..

Make image check precede MIDI check

`score-noimages` was in the HTML generation stage, while MIDI checking
was in the PNG generation stage. This meant that MIDI checking took
precedence, making the error message unhelpful to the real issue.

This change places the image checking before MIDI checking right after
engraving.

Bug: T116392
Change-Id: If01818ffc474865ebb6cc57b2dccc9f665d841f0
---
M includes/Score.php
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score 
refs/changes/68/399868/1

diff --git a/includes/Score.php b/includes/Score.php
index e3b76c8..8d580ee 100644
--- a/includes/Score.php
+++ b/includes/Score.php
@@ -444,10 +444,8 @@
'title' => $pageNumb
] );
}
-   } else {
-   /* No images; this may happen in raw mode or 
when the user omits the score code */
-   throw new ScoreException( wfMessage( 
'score-noimages' ) );
}
+
if ( $options['link_midi'] ) {
if ( $options['override_midi'] ) {
$url = $options['midi_file']->getUrl();
@@ -510,6 +508,7 @@
$factoryLy = "$factoryDirectory/file.ly";
$factoryMidi = "$factoryDirectory/file.midi";
$factoryImage = "$factoryDirectory/file.png";
+   $factoryPage1 = "$factoryDirectory/file-page1.png";
$factoryImageTrimmed = "$factoryDirectory/file-trimmed.png";
 
/* Generate LilyPond input file */
@@ -567,6 +566,11 @@
self::throwCallException( wfMessage( 
'score-compilererr' ), $output,
$options['factory_directory'] );
}
+
+   if ( !file_exists( $factoryImage ) && !file_exists( 
$factoryPage1 ) ) {
+   throw new ScoreException( wfMessage( 'score-noimages' ) 
);
+   }
+
$needMidi = false;
if ( !$options['raw'] ||
( $options['generate_ogg'] || ( $options['link_midi'] 
&& !$options['override_midi'] ) )

-- 
To view, visit https://gerrit.wikimedia.org/r/399868
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If01818ffc474865ebb6cc57b2dccc9f665d841f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: master
Gerrit-Owner: Ebe123 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits