From: Brion Vibber Date: Fri, 4 May 2007 19:39:19 +0000 (+0000) Subject: Fix regression causing incorrect image data to be stored in the oldimage table. X-Git-Tag: 1.31.0-rc.0~53084 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=67c4772b6751b9b03fbd5375351a531c2f4dd9f7;p=lhc%2Fweb%2Fwiklou.git Fix regression causing incorrect image data to be stored in the oldimage table. The call to upgradeRow() in purgeMetadataCache(), indirectly called during upload, caused data for the new file to be written into the 'image' table in the database before migration from 'image' to 'oldimage'. Thus data for the new file was recorded as belonging to the old file. Have replaced this call with a call to loadFromFile(), so the new data goes only into cache at this time, and won't get written to the database until after. The 'purge' action in ImagePage now explicitly calls the upgradeRow() function in addition to cache purging... is it needed elsewhere? This whole mess still stinks of race conditions, though. Sigh. --- diff --git a/includes/Image.php b/includes/Image.php index 274661aa4a..a898f9b31c 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1052,7 +1052,7 @@ class Image */ function purgeMetadataCache() { clearstatcache(); - $this->upgradeRow(); + $this->loadFromFile(); $this->saveToCache(); } diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 4cf8730eb6..a9f91aecc4 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -698,6 +698,7 @@ END wfDebug( "ImagePage::doPurge purging " . $this->img->getName() . "\n" ); $update = new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ); $update->doUpdate(); + $this->img->upgradeRow(); $this->img->purgeCache(); } else { wfDebug( "ImagePage::doPurge no image\n" );