Use setProps() to set properties in LocalFile::loadFromCache(), instead of DIY property-setting. I must have forgotten to do this when I introduced setProps(), the result was a bug (hereby fixed) causing zero cache-hit ratio for the image cache.

This commit is contained in:
Tim Starling 2007-11-19 10:04:18 +00:00
parent 8a83843dc6
commit 792e9e6a10

View file

@ -110,11 +110,7 @@ class LocalFile extends File
wfDebug( "Pulling file metadata from cache key $key\n" );
$this->fileExists = $cachedValues['fileExists'];
if ( $this->fileExists ) {
unset( $cachedValues['version'] );
unset( $cachedValues['fileExists'] );
foreach ( $cachedValues as $name => $value ) {
$this->$name = $value;
}
$this->setProps( $cachedValues );
}
}
if ( $this->dataLoaded ) {
@ -313,6 +309,13 @@ class LocalFile extends File
wfProfileOut( __METHOD__ );
}
/**
* Set properties in this object to be equal to those given in the
* associative array $info. Only cacheable fields can be set.
*
* If 'mime' is given, it will be split into major_mime/minor_mime.
* If major_mime/minor_mime are given, $this->mime will also be set.
*/
function setProps( $info ) {
$this->dataLoaded = true;
$fields = $this->getCacheFields( '' );