Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -1430,6 +1430,21 @@ |
1431 | 1431 | if ( strlen( $sha1 ) == 32 && $sha1[0] == '0' ) { |
1432 | 1432 | $sha1 = substr( $sha1, 1 ); |
1433 | 1433 | } |
| 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 | + } |
1434 | 1449 | |
1435 | 1450 | if ( $first && !$exists ) { |
1436 | 1451 | // This revision will be published as the new current version |
— | — | @@ -1439,11 +1454,11 @@ |
1440 | 1455 | 'img_size' => $row->fa_size, |
1441 | 1456 | 'img_width' => $row->fa_width, |
1442 | 1457 | 'img_height' => $row->fa_height, |
1443 | | - 'img_metadata' => $row->fa_metadata, |
| 1458 | + 'img_metadata' => $props['metadata'], |
1444 | 1459 | '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'], |
1448 | 1463 | 'img_description' => $row->fa_description, |
1449 | 1464 | 'img_user' => $row->fa_user, |
1450 | 1465 | 'img_user_text' => $row->fa_user_text, |
— | — | @@ -1474,10 +1489,10 @@ |
1475 | 1490 | 'oi_user' => $row->fa_user, |
1476 | 1491 | 'oi_user_text' => $row->fa_user_text, |
1477 | 1492 | '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'], |
1482 | 1497 | 'oi_deleted' => $row->fa_deleted, |
1483 | 1498 | 'oi_sha1' => $sha1 ); |
1484 | 1499 | } |