Index: contributions/modules/mimedetect/README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimedetect/README.txt,v
retrieving revision 1.1
diff -u -p -r1.1 README.txt
--- contributions/modules/mimedetect/README.txt	5 Jan 2008 05:04:09 -0000	1.1
+++ contributions/modules/mimedetect/README.txt	20 Jun 2009 01:34:43 -0000
@@ -4,4 +4,29 @@ then tries to use the MIME type supplied
 fails it will select a MIME type based on file extension. 
 
 MimeDetect is Distributed with a magic database to make FileInfo based MIME
-detection more consistent across servers. 
+detection more consistent across servers.
+
+Troubleshooting
+===============
+
+In some cases this database file, 'magic', does not work with your server. You have to use the 'magic' file of your distribution, which usually comes with File 4.x on your server.
+Then in your settings.php, you add a new variable that tells Mimedetect the absolute path of the magic file to use :
+
+$conf = array(
+  'mimedetect_magic' => 'usr/share/file/magic',
+);
+
+Replace 'usr/share/file' by the magic file path if it's different on your server.
+
+Advice : first try with basic PHP, outside Drupal, if you can load the database :
+
+<?php
+$magic_file = '/usr/share/file/magic';
+$finfo = finfo_open(FILEINFO_MIME, $magic_file);
+if (!$finfo) {
+    echo "Opening fileinfo database failed";
+    exit();
+}
+?>
+
+Replace 'usr/share/file' by the magic file path if it's different on your server.
Index: contributions/modules/mimedetect/mimedetect.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimedetect/mimedetect.install,v
retrieving revision 1.7
diff -u -p -r1.7 mimedetect.install
--- contributions/modules/mimedetect/mimedetect.install	15 Apr 2009 19:19:18 -0000	1.7
+++ contributions/modules/mimedetect/mimedetect.install	20 Jun 2009 01:34:43 -0000
@@ -28,7 +28,7 @@ function mimedetect_requirements($phase)
 
   if (extension_loaded('fileinfo')) {
     $requirement['value'] = $t('PHP Fileinfo Extension');
-    if (!$finfo = @finfo_open(FILEINFO_MIME, drupal_get_path('module', 'mimedetect') .'/magic')) {
+    if (!$finfo = @finfo_open(FILEINFO_MIME, variable_get('mimedetect_magic', drupal_get_path('module', 'mimedetect') .'/magic'))) {
       $requirement['description'] = $t('Fileinfo could not load the magic file. It could be corrupted. Try reinstalling the magic file distributed with the MimeDetect module.');
       $requirement['severity'] = REQUIREMENT_ERROR;
     }
Index: contributions/modules/mimedetect/mimedetect.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mimedetect/mimedetect.module,v
retrieving revision 1.12
diff -u -p -r1.12 mimedetect.module
--- contributions/modules/mimedetect/mimedetect.module	9 May 2009 17:42:01 -0000	1.12
+++ contributions/modules/mimedetect/mimedetect.module	20 Jun 2009 01:34:43 -0000
@@ -53,7 +53,7 @@ function mimedetect_mime($file) {
   );
 
   $mime = FALSE;
-  $magic_file = drupal_get_path('module', 'mimedetect') . '/magic';
+  $magic_file = variable_get('mimedetect_magic', drupal_get_path('module', 'mimedetect') .'/magic');
 
   // Try to use the fileinfo extension first.
   if (extension_loaded('fileinfo')) {
