From bf4d45d387d41fbcb4df44d8c8c4b66963aa8d35 Mon Sep 17 00:00:00 2001 From: nbm Date: Mon, 6 Mar 2006 10:52:24 +0000 Subject: [PATCH] Use KTMime's getIconPath which has in-memory caching to prevent the same queries over and over. --- lib/browse/BrowseColumns.inc.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/browse/BrowseColumns.inc.php b/lib/browse/BrowseColumns.inc.php index 584e0cc..b54d4ed 100644 --- a/lib/browse/BrowseColumns.inc.php +++ b/lib/browse/BrowseColumns.inc.php @@ -86,6 +86,8 @@ class BrowseColumn { class TitleColumn extends BrowseColumn { var $aOptions = array(); + var $aIconPaths = array(); + function setOptions($aOptions) { $this->aOptions = $aOptions; } @@ -149,17 +151,9 @@ class TitleColumn extends BrowseColumn { if ($finalSize > 1000) { $label='Mb'; $finalSize = floor($finalSize/1000); } return $finalSize . $label; } - + function _mimeHelper($iMimeTypeId) { - // FIXME lazy cache this. - $sQuery = 'SELECT icon_path FROM mime_types WHERE id = ?'; - $res = DBUtil::getOneResult(array($sQuery, array($iMimeTypeId))); - - if ($res['icon_path'] !== null) { - return $res['icon_path']; - } else { - return 'unspecified_type'; - } + return KTMime::getIconPath($iMimeTypeId); } } -- libgit2 0.21.4