Fixed bug in LocalFile::isCacheable().
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 14 May 2013 18:45:34 +0000 (11:45 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 14 May 2013 18:45:34 +0000 (11:45 -0700)
* The metadata field is actually defaulting to "" not null.

Change-Id: I745441c7061494db26de7f64dda30b80171c9443

includes/filerepo/file/LocalFile.php

index b07186d..3cb1f41 100644 (file)
@@ -1686,8 +1686,9 @@ class LocalFile extends File {
         * @return bool Whether to cache in RepoGroup (this avoids OOMs)
         */
        function isCacheable() {
-               $this->load(); // if loaded from cache, metadata will be null if it didn't fit
-               return $this->metadata !== null
+               $this->load();
+               // If extra data (metadata) was not loaded then it must have been large
+               return $this->extraDataLoaded
                        && strlen( serialize( $this->metadata ) ) <= self::CACHE_FIELD_MAX_LEN;
        }