r61673 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61672‎ | r61673 | r61674 >
Date:18:39, 29 January 2010
Author:catrope
Status:ok
Tags:
Comment:
wmf-deployment: Merge r59908 (importImages.php fix) from trunk
Modified paths:
  • /branches/wmf-deployment/maintenance/importImages.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/maintenance/importImages.php
@@ -65,7 +65,7 @@
6666 if ( $limit ) $limit = (int)$limit;
6767
6868 # Get the upload comment
69 - $comment = 'Importing image file';
 69+ $comment = NULL;
7070
7171 if ( isset( $options['comment-file'] ) ) {
7272 $comment = file_get_contents( $options['comment-file'] );
@@ -107,7 +107,7 @@
108108 if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) {
109109 $user->clearInstanceCache( 'name' ); //reload from DB!
110110 if ( $user->isBlocked() ) {
111 - echo( $user->getName() . " was blocked! Aborting." );
 111+ echo( $user->getName() . " was blocked! Aborting.\n" );
112112 break;
113113 }
114114 }
@@ -147,23 +147,27 @@
148148 if ( $commentExt ) {
149149 $f = findAuxFile( $file, $commentExt );
150150 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;
152153 } else {
153154 $commentText = file_get_contents( $f );
154155 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 );
156160 }
157161 }
158 -
159 - if ( $commentText && $comment ) {
160 - $commentText = trim( $commentText ) . "\n\n" . trim( $comment );
161 - }
162162 }
163163
164164 if ( !$commentText ) {
165165 $commentText = $comment;
166166 }
167167
 168+ if ( !$commentText ) {
 169+ $commentText = 'Importing image file';
 170+ }
 171+
168172 # Import the file
169173 if ( isset( $options['dry'] ) ) {
170174 echo( " publishing {$file}... " );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r59908fix for different sources of upload commentsdaniel21:58, 9 December 2009

Status & tagging log