Last modified: 2013-10-18 17:46:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57883, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55883 - When using importImages.php to overwrite multiple existing files, only the first is overwritten
When using importImages.php to overwrite multiple existing files, only the fi...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Maintenance scripts (Other open bugs)
1.22.0
All All
: Unprioritized normal (vote)
: ---
Assigned To: Sam Reed (reedy)
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-18 17:07 UTC by Sam Reed (reedy)
Modified: 2013-10-18 17:46 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2013-10-18 17:07:01 UTC
reedy@terbium:/media/external/keepers$ sudo -u apache mwscript importImages.php --wiki=commonswiki --comment-ext=txt --user=LSHuploadBot /media/external/keepers/reupload/ --overwrite
Import Images

Vas_med_frostblommor_-_Hallwylska_museet_-_87149.tif exists, overwriting...done.
Älghudskyller,_Sverige_1600-talets_början_-_Livrustkammaren_-_43603.tif exists, skipping

Found: 2
Skipped: 1
Overwritten: 1
reedy@terbium:/media/external/keepers$ rm reupload/Vas_med_frostblommor_-_Hallwylska_museet_-_87149.t*
reedy@terbium:/media/external/keepers$ sudo -u apache mwscript importImages.php --wiki=commonswiki --comment-ext=txt --user=LSHuploadBot /media/external/keepers/reupload/ --overwrite
Import Images

Älghudskyller,_Sverige_1600-talets_början_-_Livrustkammaren_-_43603.tif exists, overwriting...done.

Found: 1
Overwritten: 1
Comment 1 Sam Reed (reedy) 2013-10-18 17:17:58 UTC
Looks like it's because $options is blindly overwritten

		# Import the file
		if ( isset( $options['dry'] ) ) {
			echo " publishing {$file} by '" . $wgUser->getName() . "', comment '$commentText'... ";
		} else {
			$props = FSFile::getPropsFromPath( $file );
			$flags = 0;
			$options = array();
			$handler = MediaHandler::getHandler( $props['mime'] );
			if ( $handler ) {
				$options['headers'] = $handler->getStreamHeaders( $props['metadata'] );
			} else {
				$options['headers'] = array();
			}
			$archive = $image->publish( $file, $flags, $options );
			if ( !$archive->isGood() ) {
				echo "failed. (" .
					$archive->getWikiText() .
					")\n";
				$failed++;
				continue;
			}
		}


Some parameters are variablised, some aren't. Any that aren't won't be carried forward...
Comment 2 Gerrit Notification Bot 2013-10-18 17:33:57 UTC
Change 90573 had a related patch set uploaded by Reedy:
Don't blindly overwrite $options in importImages.php

https://gerrit.wikimedia.org/r/90573
Comment 3 Gerrit Notification Bot 2013-10-18 17:43:59 UTC
Change 90573 merged by jenkins-bot:
Don't blindly overwrite $options in importImages.php

https://gerrit.wikimedia.org/r/90573

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links