Added the ability to configure the path to the mime types db.

This commit is contained in:
Loic d'Anterroches 2008-11-26 11:12:25 +01:00
parent 628b01faf4
commit 28b650f841
2 changed files with 3 additions and 3 deletions

View File

@ -359,11 +359,11 @@ class IDF_Views_Source
* Use /etc/mime.types to find the type.
*
* @param string Filename/Filepath
* @param string Path to the mime types database ('/etc/mime.types')
* @param array Mime type found or 'application/octet-stream', basename, extension
*/
public static function getMimeType($file, $src='/etc/mime.types')
public static function getMimeType($file)
{
$src= Pluf::f('idf_mimetypes_db', '/etc/mime.types');
$mimes = preg_split("/\015\012|\015|\012/", file_get_contents($src));
$info = pathinfo($file);
if (isset($info['extension'])) {

View File

@ -175,5 +175,5 @@ $cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
'mercurial' => 'IDF_Scm_Mercurial',
);
$cfg['idf_mimetypes_db'] = '/etc/mime.types';
return $cfg;