diff --git a/admin/check/check_attachments_inc.php b/admin/check/check_attachments_inc.php index 862fba5368..0ef429dd75 100644 --- a/admin/check/check_attachments_inc.php +++ b/admin/check/check_attachments_inc.php @@ -92,29 +92,20 @@ } } -$t_finfo_exists = class_exists( 'finfo' ); -check_print_test_warn_row( - 'Fileinfo extension is available for determining file MIME types', - $t_finfo_exists, - array( false => 'Web clients may struggle to download files without knowing the MIME type of each attachment.' ) -); - -if( $t_finfo_exists ) { - $t_fileinfo_magic_db_file = config_get_global( 'fileinfo_magic_db_file' ); - if( $t_fileinfo_magic_db_file ) { - check_print_info_row( - 'Name of magic.db file set with the fileinfo_magic_db_file configuration value', - config_get_global( 'fileinfo_magic_db_file' ) ); - check_print_test_row( - 'fileinfo_magic_db_file configuration value points to an existing magic.db file', - file_exists( $t_fileinfo_magic_db_file ) ); - $t_finfo = new finfo( FILEINFO_MIME, $t_fileinfo_magic_db_file ); - } else { - $t_finfo = new finfo( FILEINFO_MIME ); - } +$t_fileinfo_magic_db_file = config_get_global( 'fileinfo_magic_db_file' ); +if( $t_fileinfo_magic_db_file ) { + check_print_info_row( + 'Name of magic.db file set with the fileinfo_magic_db_file configuration value', + config_get_global( 'fileinfo_magic_db_file' ) ); check_print_test_row( - 'Fileinfo extension can find and load a valid magic.db file', - $t_finfo !== false, - array( false => 'Ensure that the fileinfo_magic_db_file configuration value points to a valid magic.db file.' ) - ); -} \ No newline at end of file + 'fileinfo_magic_db_file configuration value points to an existing magic.db file', + file_exists( $t_fileinfo_magic_db_file ) ); + $t_finfo = new finfo( FILEINFO_MIME, $t_fileinfo_magic_db_file ); +} else { + $t_finfo = new finfo( FILEINFO_MIME ); +} +check_print_test_row( + 'Fileinfo extension can find and load a valid magic.db file', + $t_finfo !== false, + array( false => 'Ensure that the fileinfo_magic_db_file configuration value points to a valid magic.db file.' ) +); diff --git a/admin/check/check_php_inc.php b/admin/check/check_php_inc.php index 8fae5952a5..36bf5798cf 100644 --- a/admin/check/check_php_inc.php +++ b/admin/check/check_php_inc.php @@ -50,7 +50,8 @@ 'pcre', 'Reflection', 'session', - 'mbstring' + 'mbstring', + 'fileinfo' ); foreach( $t_extensions_required as $t_extension ) { diff --git a/core/file_api.php b/core/file_api.php index a6e4816698..5c16e45cb2 100644 --- a/core/file_api.php +++ b/core/file_api.php @@ -993,7 +993,7 @@ function file_ensure_uploaded( array $p_file ) { } /** - * Return instance of fileinfo class if enabled in php + * Return instance of fileinfo class * @return finfo instance of finfo class. */ function file_create_finfo() { diff --git a/docbook/Admin_Guide/en-US/Installation.xml b/docbook/Admin_Guide/en-US/Installation.xml index 7def4c8c92..f7e8542ae3 100644 --- a/docbook/Admin_Guide/en-US/Installation.xml +++ b/docbook/Admin_Guide/en-US/Installation.xml @@ -181,6 +181,19 @@ mbstring - Required for Unicode (UTF-8) support. + + Fileinfo - + Guesses the MIME type of attachments + + Without this extension, file attachment + previews and downloads do not work + as MantisBT won't be able to send + the Content-Type header to a browser + requesting an attachment. + + This extension is included by default from + PHP version 5.3.x and above. + @@ -195,19 +208,7 @@ required for the captcha feature - - Fileinfo - - Guesses the MIME type of attachments - - Without this extension, file attachment - previews and downloads may not work - correctly as MantisBT won't be able to send - the Content-Type header to a browser - requesting an attachment. - - This extension is included by default from - PHP version 5.3.x and above. - +