Index: branches/wmf-deployment/maintenance/importImages.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | if ( $limit ) $limit = (int)$limit; |
67 | 67 | |
68 | 68 | # Get the upload comment |
69 | | - $comment = 'Importing image file'; |
| 69 | + $comment = NULL; |
70 | 70 | |
71 | 71 | if ( isset( $options['comment-file'] ) ) { |
72 | 72 | $comment = file_get_contents( $options['comment-file'] ); |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) { |
109 | 109 | $user->clearInstanceCache( 'name' ); //reload from DB! |
110 | 110 | if ( $user->isBlocked() ) { |
111 | | - echo( $user->getName() . " was blocked! Aborting." ); |
| 111 | + echo( $user->getName() . " was blocked! Aborting.\n" ); |
112 | 112 | break; |
113 | 113 | } |
114 | 114 | } |
— | — | @@ -147,23 +147,27 @@ |
148 | 148 | if ( $commentExt ) { |
149 | 149 | $f = findAuxFile( $file, $commentExt ); |
150 | 150 | if ( !$f ) { |
151 | | - echo( " No comment file with extension {$commentExt} found for {$file}, using default comment. " ); |
| 151 | + echo( " No comment file with extension {$commentExt} found for {$file}. " ); |
| 152 | + $commentText = $comment; |
152 | 153 | } else { |
153 | 154 | $commentText = file_get_contents( $f ); |
154 | 155 | if ( !$f ) { |
155 | | - echo( " Failed to load comment file {$f}, using default comment. " ); |
| 156 | + echo( " Failed to load comment file {$f}. " ); |
| 157 | + $commentText = $comment; |
| 158 | + } else if ( $comment ) { |
| 159 | + $commentText = trim( $commentText ) . "\n\n" . trim( $comment ); |
156 | 160 | } |
157 | 161 | } |
158 | | - |
159 | | - if ( $commentText && $comment ) { |
160 | | - $commentText = trim( $commentText ) . "\n\n" . trim( $comment ); |
161 | | - } |
162 | 162 | } |
163 | 163 | |
164 | 164 | if ( !$commentText ) { |
165 | 165 | $commentText = $comment; |
166 | 166 | } |
167 | 167 | |
| 168 | + if ( !$commentText ) { |
| 169 | + $commentText = 'Importing image file'; |
| 170 | + } |
| 171 | + |
168 | 172 | # Import the file |
169 | 173 | if ( isset( $options['dry'] ) ) { |
170 | 174 | echo( " publishing {$file}... " ); |