Added the ability to configure the path to the mime types db.
This commit is contained in:
parent
628b01faf4
commit
28b650f841
@ -359,11 +359,11 @@ class IDF_Views_Source
|
|||||||
* Use /etc/mime.types to find the type.
|
* Use /etc/mime.types to find the type.
|
||||||
*
|
*
|
||||||
* @param string Filename/Filepath
|
* @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
|
* @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));
|
$mimes = preg_split("/\015\012|\015|\012/", file_get_contents($src));
|
||||||
$info = pathinfo($file);
|
$info = pathinfo($file);
|
||||||
if (isset($info['extension'])) {
|
if (isset($info['extension'])) {
|
||||||
|
@ -175,5 +175,5 @@ $cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
|
|||||||
'mercurial' => 'IDF_Scm_Mercurial',
|
'mercurial' => 'IDF_Scm_Mercurial',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$cfg['idf_mimetypes_db'] = '/etc/mime.types';
|
||||||
return $cfg;
|
return $cfg;
|
||||||
|
Loading…
Reference in New Issue
Block a user