Commit bf4d45d387d41fbcb4df44d8c8c4b66963aa8d35
1 parent
89c77b66
Use KTMime's getIconPath which has in-memory caching to prevent the same
queries over and over. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5055 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
4 additions
and
10 deletions
lib/browse/BrowseColumns.inc.php
| @@ -86,6 +86,8 @@ class BrowseColumn { | @@ -86,6 +86,8 @@ class BrowseColumn { | ||
| 86 | 86 | ||
| 87 | class TitleColumn extends BrowseColumn { | 87 | class TitleColumn extends BrowseColumn { |
| 88 | var $aOptions = array(); | 88 | var $aOptions = array(); |
| 89 | + var $aIconPaths = array(); | ||
| 90 | + | ||
| 89 | function setOptions($aOptions) { | 91 | function setOptions($aOptions) { |
| 90 | $this->aOptions = $aOptions; | 92 | $this->aOptions = $aOptions; |
| 91 | } | 93 | } |
| @@ -149,17 +151,9 @@ class TitleColumn extends BrowseColumn { | @@ -149,17 +151,9 @@ class TitleColumn extends BrowseColumn { | ||
| 149 | if ($finalSize > 1000) { $label='Mb'; $finalSize = floor($finalSize/1000); } | 151 | if ($finalSize > 1000) { $label='Mb'; $finalSize = floor($finalSize/1000); } |
| 150 | return $finalSize . $label; | 152 | return $finalSize . $label; |
| 151 | } | 153 | } |
| 152 | - | 154 | + |
| 153 | function _mimeHelper($iMimeTypeId) { | 155 | function _mimeHelper($iMimeTypeId) { |
| 154 | - // FIXME lazy cache this. | ||
| 155 | - $sQuery = 'SELECT icon_path FROM mime_types WHERE id = ?'; | ||
| 156 | - $res = DBUtil::getOneResult(array($sQuery, array($iMimeTypeId))); | ||
| 157 | - | ||
| 158 | - if ($res['icon_path'] !== null) { | ||
| 159 | - return $res['icon_path']; | ||
| 160 | - } else { | ||
| 161 | - return 'unspecified_type'; | ||
| 162 | - } | 156 | + return KTMime::getIconPath($iMimeTypeId); |
| 163 | } | 157 | } |
| 164 | } | 158 | } |
| 165 | 159 |