Index: mimedetect.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mimedetect/mimedetect.module,v retrieving revision 1.3.2.4 diff -u -p -r1.3.2.4 mimedetect.module --- mimedetect.module 15 Apr 2009 19:24:18 -0000 1.3.2.4 +++ mimedetect.module 15 Apr 2009 20:00:40 -0000 @@ -63,20 +63,33 @@ function mimedetect_requirements($phase) } function mimedetect_settings() { - $form[] = array(); - $form['mimedetect_enable_file_binary'] = array( - '#type' => 'checkbox', - '#title' => t("Use UNIX 'file' command to detect mime type?"), - '#description' => t("The UNIX 'file' command will be used for mime detection only if the PHP Fileinfo extension is not installed or fails to load."), - '#default_value' => variable_get('mimedetect_enable_file_binary', FALSE), - ); - $form['mimedetect_file_binary'] = array( - '#type' => 'textfield', - '#title' => t("Path to the 'file' command"), - '#description' => t("The path to the executable 'file' binary."), - '#default_value' => variable_get('mimedetect_file_binary','/usr/bin/file'), - ); - return system_settings_form($form); + // Check if fileinfo is available so we don't present the file options if + // they can't use them + if (extension_loaded('fileinfo')) { + $form['file'] = array( + '#value' => t("The MimeDetect module is using PHP's fileinfo extension to detect MIME types. There are no settings for the extension.") + ); + } + else { + $form['file'] = array( + '#type' => 'fieldset', + '#title' => t("UNIX 'file' command"), + ); + $form['file']['mimedetect_enable_file_binary'] = array( + '#type' => 'checkbox', + '#title' => t("Use UNIX 'file' command to detect mime type?"), + '#description' => t("The UNIX 'file' command will be used for mime detection only if the PHP Fileinfo extension is not installed or fails to load."), + '#default_value' => variable_get('mimedetect_enable_file_binary', FALSE), + ); + $form['file']['mimedetect_file_binary'] = array( + '#type' => 'textfield', + '#title' => t("Path to the 'file' command"), + '#description' => t("The path to the executable 'file' binary."), + '#default_value' => variable_get('mimedetect_file_binary','/usr/bin/file'), + ); + $form = system_settings_form($form); + } + return $form; } function mimedetect_settings_validate($form_id, $form_values) {