From 042baf43bdc60ef432bb5dc6c889226e62b06404 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 23 Apr 2013 17:17:50 -0700 Subject: [PATCH] Fix bug in OOM avoidance for RepoGroup cache. Change-Id: Ic2e7fb6a9a7207315fd65454d883b84278efafc0 --- includes/filerepo/file/LocalFile.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 8bd83769bc..325c6739a2 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1663,11 +1663,11 @@ class LocalFile extends File { } /** - * @return bool + * @return bool Whether to cache in RepoGroup (this avoids OOMs) */ function isCacheable() { - $this->load(); - return strlen( $this->metadata ) <= self::CACHE_FIELD_MAX_LEN; // avoid OOMs + $this->load(); // if loaded from cache, metadata will be null if it didn't fit + return $this->metadata !== null && strlen( $this->metadata ) <= self::CACHE_FIELD_MAX_LEN; } /** -- 2.20.1