Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
26 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -989,6 +989,22 @@ function file_ensure_uploaded( array $p_file ) { | |
} | ||
} | ||
|
||
/** | ||
* Return instance of fileinfo class if enabled in php | ||
* @return finfo instance of finfo class. | ||
*/ | ||
function file_create_finfo() { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
atrol
Member
|
||
$t_info_file = config_get_global( 'fileinfo_magic_db_file' ); | ||
|
||
if( is_blank( $t_info_file ) ) { | ||
$t_finfo = new finfo( FILEINFO_MIME ); | ||
} else { | ||
$t_finfo = new finfo( FILEINFO_MIME, $t_info_file ); | ||
} | ||
|
||
return $t_finfo; | ||
} | ||
|
||
/** | ||
* Get mime type for the specified file. | ||
* | ||
|
@@ -1000,14 +1016,7 @@ function file_get_mime_type( $p_file_path ) { | |
return false; | ||
} | ||
|
||
$t_info_file = config_get_global( 'fileinfo_magic_db_file' ); | ||
|
||
if( is_blank( $t_info_file ) ) { | ||
$t_finfo = new finfo( FILEINFO_MIME ); | ||
} else { | ||
$t_finfo = new finfo( FILEINFO_MIME, $t_info_file ); | ||
} | ||
|
||
$t_finfo = file_create_finfo(); | ||
return $t_finfo->file( $p_file_path ); | ||
} | ||
|
||
|
@@ -1018,14 +1027,7 @@ function file_get_mime_type( $p_file_path ) { | |
* @return boolean|string The mime type or false on failure. | ||
*/ | ||
function file_get_mime_type_for_content( $p_content ) { | ||
$t_info_file = config_get_global( 'fileinfo_magic_db_file' ); | ||
|
||
if( is_blank( $t_info_file ) ) { | ||
$t_finfo = new finfo( FILEINFO_MIME ); | ||
} else { | ||
$t_finfo = new finfo( FILEINFO_MIME, $t_info_file ); | ||
} | ||
|
||
$t_finfo = file_create_finfo(); | ||
return $t_finfo->buffer( $p_content ); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now getting error in this file. @vboctor
<b>Fatal error</b>: Class 'finfo' not found in <b>/home/dummy/www.example.com/dash/core/file_api.php</b> on line <b>1000</b><br />