From 792e9e6a10c6e338593c6838c2b7bb008e6b369b Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 19 Nov 2007 10:04:18 +0000 Subject: [PATCH] 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. --- includes/filerepo/LocalFile.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 392bfa0c62..ae1672bc5b 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -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( '' ); -- 2.20.1