r19900 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19899‎ | r19900 | r19901 >
Date:23:17, 12 February 2007
Author:brion
Status:old
Tags:
Comment:
fixes for image updates via harvester:
* set img_metadata field, leaving it out breaks on mysql strict mode
* use wfMkdirParents instead of assuming all image subdirs already exist
Modified paths:
  • /trunk/extensions/OAI/OAIHarvest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OAI/OAIHarvest.php
@@ -476,7 +476,8 @@
477477 'img_user_text' => isset( $upload['contributor']['username'] )
478478 ? strval( $upload['contributor']['username'] )
479479 : strval( $upload['contributor']['ip'] ),
480 - 'img_timestamp' => $dbw->timestamp( $this->getTimestamp( $upload['timestamp'] ) ) );
 480+ 'img_timestamp' => $dbw->timestamp( $this->getTimestamp( $upload['timestamp'] ) ),
 481+ 'img_metadata' => serialize( array() ) );
481482
482483 $dbw->begin();
483484 echo "REPLACING image row\n";
@@ -522,6 +523,7 @@
523524 if( file_exists( $filename ) ) {
524525 unlink( $filename );
525526 }
 527+ wfMkdirParents( dirname( $filename ) );
526528 if( !( $output = fopen( $filename, 'xb' ) ) ) {
527529 throw new OAIError( 'Could not create local image file "' . $filename . '" for writing.' );
528530 }