* Moving img_exif to img_metadata, makes more sense if we're going to drop
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Thu, 21 Apr 2005 21:16:12 +0000 (21:16 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Thu, 21 Apr 2005 21:16:12 +0000 (21:16 +0000)
  some metadata for files which do not support exif in there (like Ogg or PNG)

includes/Image.php
maintenance/archives/patch-img_metadata.sql [new file with mode: 0644]

index 4052135..3631a07 100644 (file)
@@ -236,7 +236,7 @@ class Image
                
                $dbr =& wfGetDB( DB_SLAVE );
                $row = $dbr->selectRow( 'image', 
-                       array( 'img_size', 'img_width', 'img_height', 'img_bits', 'img_type' , 'img_exif' ),
+                       array( 'img_size', 'img_width', 'img_height', 'img_bits', 'img_type' , 'img_metadata' ),
                        array( 'img_name' => $this->name ), $fname );
                if ( $row ) {
                        $this->fromSharedDirectory = false;
@@ -294,7 +294,7 @@ class Image
                $this->height = $row->img_height;
                $this->bits = $row->img_bits;
                $this->type = $row->img_type;
-               $this->exif = $row->img_exif;
+               $this->exif = $row->img_metadata;
                if ( $this->exif == "" ) $this->exif = serialize ( array() ) ;
                $this->dataLoaded = true;
        }
@@ -342,7 +342,7 @@ class Image
                                'img_height' => $this->height,
                                'img_bits' => $this->bits,
                                'img_type' => $this->type,
-                               'img_exif' => $this->exif,
+                               'img_metadata' => $this->exif,
                        ), array( 'img_name' => $this->name ), $fname
                );
                if ( $this->fromSharedDirectory ) {
@@ -1015,7 +1015,7 @@ class Image
                                'img_description' => $desc,
                                'img_user' => $wgUser->getID(),
                                'img_user_text' => $wgUser->getName(),
-                               'img_exif' => $this->exif,
+                               'img_metadata' => $this->exif,
                        ), $fname, 'IGNORE' 
                );
                $descTitle = $this->getTitle();
@@ -1060,7 +1060,7 @@ class Image
                                        'img_user' => $wgUser->getID(),
                                        'img_user_text' => $wgUser->getName(),
                                        'img_description' => $desc,
-                                       'img_exif' => $this->exif,
+                                       'img_metadata' => $this->exif,
                                ), array( /* WHERE */
                                        'img_name' => $this->name
                                ), $fname
@@ -1162,7 +1162,7 @@ class Image
                # Update EXIF data in database
                $dbw =& wfGetDB( DB_MASTER );
                $dbw->update( '`image`', 
-                       array( 'img_exif' => $this->exif ),
+                       array( 'img_metadata' => $this->exif ),
                        array( 'img_name' => $this->name ),
                        $fname
                );
diff --git a/maintenance/archives/patch-img_metadata.sql b/maintenance/archives/patch-img_metadata.sql
new file mode 100644 (file)
index 0000000..aee34c9
--- /dev/null
@@ -0,0 +1,8 @@
+-- Moving img_exif to img_metadata, so the name won't be so confusing when we
+-- Use it for Ogg metadata or something like that.
+
+ALTER TABLE /*$wgDBprefix*/image DROP img_exif;
+
+ALTER TABLE /*$wgDBprefix*/image ADD (
+  img_metadata mediumblob NOT NULL
+);