r21954 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21953‎ | r21954 | r21955 >
Date:14:44, 7 May 2007
Author:aaron
Status:old
Tags:
Comment:
*Add new oldimage columns for mime/mediatype info and oi_deleted field. Make rebuild image populate these while updating oldimage.
Modified paths:
  • /trunk/phase3/maintenance/archives/patch-oi_metadata.sql (added) (history)
  • /trunk/phase3/maintenance/rebuildImages.php (modified) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/archives/patch-oi_metadata.sql
@@ -0,0 +1,15 @@
 2+--
 3+-- patch-indexes.sql
 4+--
 5+-- Add data to allow for direct reference to old images
 6+-- They can be included into pages
 7+--
 8+
 9+ALTER TABLE /*$wgDBprefix*/oldimage
 10+ DROP INDEX oi_name,
 11+ ADD INDEX oi_name_timestamp (oi_name,oi_timestamp),
 12+ ADD oi_metadata mediumblob NOT NULL,
 13+ ADD oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
 14+ ADD oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
 15+ ADD oi_minor_mime varchar(32) NOT NULL default "unknown",
 16+ ADD oi_deleted tinyint(1) unsigned NOT NULL default '0',
\ No newline at end of file
Index: trunk/phase3/maintenance/updaters.inc
@@ -76,6 +76,7 @@
7777 array( 'archive', 'ar_len', 'patch-ar_len.sql' ),
7878 array( 'revision', 'rev_parent_id', 'patch-rev_parent_id.sql' ),
7979 array( 'page_restrictions', 'pr_id', 'patch-page_restrictions_sortkey.sql' ),
 80+ array( 'oldimage', 'oi_metadata', 'patch-oi_metadata.sql' ),
8081 );
8182
8283 function rename_table( $from, $to, $patch ) {
Index: trunk/phase3/maintenance/rebuildImages.php
@@ -144,7 +144,7 @@
145145 }
146146
147147 function oldimageCallback( $row ) {
148 - if( $row->oi_width ) {
 148+ if( $row->oi_width && $row->oi_media_type ) {
149149 return null;
150150 }
151151
@@ -153,7 +153,11 @@
154154 return array(
155155 'oi_width' => $info['width' ],
156156 'oi_height' => $info['height'],
157 - 'oi_bits' => $info['bits' ] );
 157+ 'oi_bits' => $info['bits' ],
 158+ 'oi_metadata' => '', // filled in on-demand
 159+ 'oi_media_type' => $info['media'],
 160+ 'oi_major_mime' => $info['major'],
 161+ 'oi_minor_mime' => $info['minor'] );
158162 }
159163
160164 function crawlMissing() {
Index: trunk/phase3/maintenance/tables.sql
@@ -715,6 +715,21 @@
716716 oi_user int(5) unsigned NOT NULL default '0',
717717 oi_user_text varchar(255) binary NOT NULL,
718718 oi_timestamp char(14) binary NOT NULL default '',
 719+
 720+ -- Extracted EXIF metadata stored as a serialized PHP array.
 721+ oi_metadata mediumblob NOT NULL,
 722+ -- Media type as defined by the MEDIATYPE_xxx constants
 723+ oi_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL,
 724+ -- major part of a MIME media type as defined by IANA
 725+ -- see http://www.iana.org/assignments/media-types/
 726+ oi_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown",
 727+ -- minor part of a MIME media type as defined by IANA
 728+ -- the minor parts are not required to adher to any standard
 729+ -- but should be consistent throughout the database
 730+ -- see http://www.iana.org/assignments/media-types/
 731+ oi_minor_mime varchar(32) NOT NULL default "unknown",
 732+
 733+ oi_deleted tinyint(1) unsigned NOT NULL default '0',
719734
720735 INDEX oi_name (oi_name(10))
721736

Follow-up revisions

RevisionCommit summaryAuthorDate
r21957Revert schema changes in r21954, 21955, 21956 for the momentbrion16:24, 7 May 2007