From 091c0afc2e7d97085163edd0488a824aded048a6 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 26 Apr 2008 06:47:29 +0000 Subject: [PATCH] Merged revisions 52293 via svnmerge from http://svn.silverstripe.com/open/modules/sapphire/branches/2.2.2 ........ r52293 | aoneil | 2008-04-08 12:03:43 +1200 (Tue, 08 Apr 2008) | 2 lines don't cache in overridden instance_get(), as the fields are different for subclasses ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@53509 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- filesystem/File.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/filesystem/File.php b/filesystem/File.php index b9606ebd0..97950fec3 100755 --- a/filesystem/File.php +++ b/filesystem/File.php @@ -486,19 +486,18 @@ class File extends DataObject { // Work out which columns we're actually going to select // In short, we select everything except File.Content - $filteredSelect = array(); - foreach($query->select as $i => $item) { + $dataobject_select = array(); + foreach($query->select as $item) { if($item == "`File`.*") { - if(!isset(self::$cache_file_fields)) self::$cache_file_fields = DB::query("SHOW FIELDS IN `File`")->column(); - $columnsToAdd = array_diff(self::$cache_file_fields, $excludeDbColumns); - foreach($columnsToAdd as $otherItem) { - $filteredSelect[] = '`File`.' . $otherItem; - } + $fileColumns = DB::query("SHOW FIELDS IN `File`")->column(); + $columnsToAdd = array_diff($fileColumns, $excludeDbColumns); + foreach($columnsToAdd as $otherItem) $dataobject_select[] = '`File`.' . $otherItem; } else { - $filteredSelect[] = $item; + $dataobject_select[] = $item; } } - $query->select = $filteredSelect; + + $query->select = $dataobject_select; $records = $query->execute(); $ret = $this->buildDataObjectSet($records, $containerClass);