r25141 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r25140‎ | r25141 | r25142 >
Date:20:18, 25 August 2007
Author:brion
Status:old
Tags:
Comment:
Fix for restore of image data where oldimage rows hadn't contained the various new metadata fields.
When missing on restore, metadata is re-fetched from the file and inserted into the new record in place of the empty fields.
Modified paths:
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -1430,6 +1430,21 @@
14311431 if ( strlen( $sha1 ) == 32 && $sha1[0] == '0' ) {
14321432 $sha1 = substr( $sha1, 1 );
14331433 }
 1434+
 1435+ if( is_null( $row->fa_major_mime ) || $row->fa_major_mime == 'unknown'
 1436+ || is_null( $row->fa_minor_mime ) || $row->fa_minor_mime == 'unknown'
 1437+ || is_null( $row->fa_media_type ) || $row->fa_media_type == 'UNKNOWN'
 1438+ || is_null( $row->fa_metadata ) ) {
 1439+ // Refresh our metadata
 1440+ // Required for a new current revision; nice for older ones too. :)
 1441+ $props = RepoGroup::singleton()->getFileProps( $deletedUrl );
 1442+ } else {
 1443+ $props = array(
 1444+ 'minor_mime' => $row->fa_minor_mime,
 1445+ 'major_mime' => $row->fa_major_mime,
 1446+ 'media_type' => $row->fa_media_type,
 1447+ 'metadata' => $row->fa_metadata );
 1448+ }
14341449
14351450 if ( $first && !$exists ) {
14361451 // This revision will be published as the new current version
@@ -1439,11 +1454,11 @@
14401455 'img_size' => $row->fa_size,
14411456 'img_width' => $row->fa_width,
14421457 'img_height' => $row->fa_height,
1443 - 'img_metadata' => $row->fa_metadata,
 1458+ 'img_metadata' => $props['metadata'],
14441459 'img_bits' => $row->fa_bits,
1445 - 'img_media_type' => $row->fa_media_type,
1446 - 'img_major_mime' => $row->fa_major_mime,
1447 - 'img_minor_mime' => $row->fa_minor_mime,
 1460+ 'img_media_type' => $props['media_type'],
 1461+ 'img_major_mime' => $props['major_mime'],
 1462+ 'img_minor_mime' => $props['minor_mime'],
14481463 'img_description' => $row->fa_description,
14491464 'img_user' => $row->fa_user,
14501465 'img_user_text' => $row->fa_user_text,
@@ -1474,10 +1489,10 @@
14751490 'oi_user' => $row->fa_user,
14761491 'oi_user_text' => $row->fa_user_text,
14771492 'oi_timestamp' => $row->fa_timestamp,
1478 - 'oi_metadata' => is_null($row->fa_metadata) ? '' : $row->fa_metadata,
1479 - 'oi_media_type' => $row->fa_media_type,
1480 - 'oi_major_mime' => $row->fa_major_mime,
1481 - 'oi_minor_mime' => $row->fa_minor_mime,
 1493+ 'oi_metadata' => $props['metadata'],
 1494+ 'oi_media_type' => $props['media_type'],
 1495+ 'oi_major_mime' => $props['major_mime'],
 1496+ 'oi_minor_mime' => $props['minor_mime'],
14821497 'oi_deleted' => $row->fa_deleted,
14831498 'oi_sha1' => $sha1 );
14841499 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r25223Merged revisions 25126-25214 via svnmerge from...david07:39, 28 August 2007

Status & tagging log