Index: mimedetect.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/mimedetect/mimedetect.admin.inc,v retrieving revision 1.1 diff -u -p -r1.1 mimedetect.admin.inc --- mimedetect.admin.inc 15 Apr 2009 19:35:40 -0000 1.1 +++ mimedetect.admin.inc 15 Apr 2009 19:57:46 -0000 @@ -2,19 +2,34 @@ 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_state) {