From: Jan Gerber Date: Mon, 22 Apr 2013 09:36:51 +0000 (+0000) Subject: (bug 47483) update file metadata in importImages X-Git-Tag: 1.31.0-rc.0~19833^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=ce4639a938036456663def271cba0adca7f18954;p=lhc%2Fweb%2Fwiklou.git (bug 47483) update file metadata in importImages importImages maintenance script was not updating file metadata when overwriting files. Bring code in importImages in line with LocalFile::upload Bug: 47483 Change-Id: I0e879604ce76ed78708a36df46b58fb3b8a7d6d2 --- diff --git a/maintenance/importImages.php b/maintenance/importImages.php index abc1b8721b..7b340cc07b 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -228,7 +228,16 @@ if ( $count > 0 ) { if ( isset( $options['dry'] ) ) { echo( " publishing {$file} by '" . $wgUser->getName() . "', comment '$commentText'... " ); } else { - $archive = $image->publish( $file ); + $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() . @@ -245,7 +254,7 @@ if ( $count > 0 ) { if ( isset( $options['dry'] ) ) { echo( "done.\n" ); - } elseif ( $image->recordUpload2( $archive->value, $summary, $commentText, false, $timestamp ) ) { + } elseif ( $image->recordUpload2( $archive->value, $summary, $commentText, $props, $timestamp ) ) { # We're done! echo( "done.\n" );