* (bug 11072) Fix regression in API image history query
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 27 Aug 2007 21:32:47 +0000 (21:32 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 27 Aug 2007 21:32:47 +0000 (21:32 +0000)
LocalFile::nextHistoryLine() now returns original column names for oldimage rows instead of aliasing them to image column names.
That whole interface should fucking die, it's hideous.

RELEASE-NOTES
includes/api/ApiQueryImageInfo.php

index 9cfc838..f3bfd9e 100644 (file)
@@ -417,6 +417,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Preventing the TOC from appearing in Special:Statistics
 * (bug 11082) Fix check for fully-specced table names in Database::tableName
 * (bug 11067) Fix regression in upload conflict thumbnail display
+* (bug 11072) Fix regression in API image history query
 
 
 == API changes since 1.10 ==
index 56c1c12..7566f72 100644 (file)
@@ -67,24 +67,26 @@ class ApiQueryImageInfo extends ApiQueryBase {
 
                                        $isCur = true;
                                        while($line = $img->nextHistoryLine()) { // assignment
+                                               $row = get_object_vars( $line );
                                                $vals = array();
+                                               $prefix = $isCur ? 'img' : 'oi';
 
                                                if ($fld_timestamp)
-                                                       $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $line->img_timestamp);
+                                                       $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row["${prefix}_timestamp"]);
                                                if ($fld_user) {
-                                                       $vals['user'] = $line->img_user_text;
-                                                       if(!$line->img_user)
+                                                       $vals['user'] = $row["${prefix}_user_text"];
+                                                       if(!$row["${prefix}_user"])
                                                                $vals['anon'] = '';
                                                }
                                                if ($fld_size) {
-                                                       $vals['size'] = intval($line->img_size);
-                                                       $vals['width'] = intval($line->img_width);
-                                                       $vals['height'] = intval($line->img_height);
+                                                       $vals['size'] = intval($row["{$prefix}_size"]);
+                                                       $vals['width'] = intval($row["{$prefix}_width"]);
+                                                       $vals['height'] = intval($row["{$prefix}_height"]);
                                                }
                                                if ($fld_url)
-                                                       $vals['url'] = $isCur ? $img->getURL() : $img->getArchiveUrl($line->oi_archive_name);
+                                                       $vals['url'] = $isCur ? $img->getURL() : $img->getArchiveUrl($row["oi_archive_name"]);
                                                if ($fld_comment)
-                                                       $vals['comment'] = $line->img_description;
+                                                       $vals['comment'] = $row["{$prefix}_description"];
 
                                                $data[] = $vals;