Skip to content

Commit

Permalink
Issue #11728: Add Fileinfo checks to admin/check/
Browse files Browse the repository at this point in the history
Add some further checks to check_attachments_inc.php as part of the new
configuration/environment check script in 1.3.x to verify that Fileinfo
is configured correctly.
  • Loading branch information
davidhicks committed Mar 31, 2010
1 parent f39d92f commit 666e231
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions admin/check/check_attachments_inc.php
Expand Up @@ -85,3 +85,32 @@
);
}
}

$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 );
}
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.' )
);
}

0 comments on commit 666e231

Please sign in to comment.