Index: trunk/extensions/Score/Score.i18n.php |
— | — | @@ -40,6 +40,8 @@ |
41 | 41 | 'score-compilererr' => 'Unable to compile LilyPond input file:', |
42 | 42 | 'score-desc' => 'MediaWiki tag extension for rendering musical scores with LilyPond', |
43 | 43 | 'score-getcwderr' => 'Unable to obtain current working directory', |
| 44 | + 'score-nooutput' => 'Failed to create LilyPond image dir', |
| 45 | + 'score-nofactory' => 'Failed to create LilyPond factory dir', |
44 | 46 | 'score-noinput' => 'Failed to create LilyPond input file', |
45 | 47 | 'score-page' => 'Page', |
46 | 48 | 'score-renameerr' => 'Error moving score files to upload directory', |
— | — | @@ -58,5 +60,3 @@ |
59 | 61 | 'score-renameerr' => 'Displayed if moving the resultant files from the working environment to the upload directory fails.', |
60 | 62 | 'score-trimerr' => 'Displayed if the extension failed to trim an output image.', |
61 | 63 | ); |
62 | | - |
63 | | -?> |
Index: trunk/extensions/Score/Score.php |
— | — | @@ -91,5 +91,3 @@ |
92 | 92 | |
93 | 93 | return true; |
94 | 94 | } |
95 | | - |
96 | | -?> |
Index: trunk/extensions/Score/Score.body.php |
— | — | @@ -119,7 +119,8 @@ |
120 | 120 | $factoryImageTrimmed = $factoryDirectory . "/file-trimmed.png"; |
121 | 121 | $factoryMultiFormat = $factoryDirectory . "/file-%d.png"; // for multi-page scores |
122 | 122 | $factoryMultiTrimmedFormat = $factoryDirectory . "/file-%d-trimmed.png"; |
123 | | - $rel = 'lilypond/' . md5( $lilypondCode ); // FIXME: Too many files in one directory? |
| 123 | + $lilypondDir = "lilypond"; |
| 124 | + $rel = $lilypondDir . "/" . md5( $lilypondCode ); // FIXME: Too many files in one directory? |
124 | 125 | $filePrefix = "$wgUploadDirectory/$rel"; |
125 | 126 | $pathPrefix = "$wgUploadPath/$rel"; |
126 | 127 | $midi = "$filePrefix.midi"; |
— | — | @@ -162,7 +163,15 @@ |
163 | 164 | } |
164 | 165 | |
165 | 166 | /* create working environment */ |
166 | | - $rc = mkdir( $factoryDirectory, 0700, true ); |
| 167 | + if ( !file_exists( "$wgUploadDirectory/$lilypondDir" ) ) { |
| 168 | + $rc = wfMkdirParents( "$wgUploadDirectory/$lilypondDir", null, __METHOD__ ); |
| 169 | + if ( !$rc ) { |
| 170 | + throw new ScoreException( 'score-nooutput' ); |
| 171 | + } |
| 172 | + } |
| 173 | + |
| 174 | + /* create working environment */ |
| 175 | + $rc = wfMkdirParents( $factoryDirectory, 0700, __METHOD__ ); |
167 | 176 | if ( !$rc ) { |
168 | 177 | throw new ScoreException( 'score-nofactory' ); |
169 | 178 | } |
— | — | @@ -222,7 +231,7 @@ |
223 | 232 | if ( file_exists( $factoryMidi ) ) { |
224 | 233 | $rc = $rc && rename( $factoryMidi, $midi ); |
225 | 234 | } |
226 | | - if ( file_exists( $factoryImage ) ) { |
| 235 | + if ( file_exists( $factoryImageTrimmed ) ) { |
227 | 236 | $rc = $rc && rename( $factoryImageTrimmed, $image ); |
228 | 237 | } |
229 | 238 | for ( $i = 1; file_exists( $f = sprintf( $factoryMultiTrimmedFormat, $i ) ); ++$i ) { |
— | — | @@ -319,5 +328,3 @@ |
320 | 329 | } |
321 | 330 | |
322 | 331 | } |
323 | | - |
324 | | -?> |