Commit 718d1148 by Mark

file helper adjusted , upgrade notes added

parent 724efdb5
......@@ -47,3 +47,5 @@ Upgrade from Yii 2.0 Beta
* The database table of the `yii\log\DbTarget` now needs a `prefix` column to store context information.
You can add it with `ALTER TABLE log ADD COLUMN prefix TEXT AFTER log_time;`.
* Extension `Fileinfo` added to requirement checker. This extension is [builtin](http://www.php.net/manual/en/fileinfo.installation.php) in php above `5.3`.
......@@ -120,16 +120,16 @@ class BaseFileHelper
*/
public static function getMimeType($file, $magicFile = null, $checkExtension = true)
{
if (function_exists('finfo_open')) {
$info = finfo_open(FILEINFO_MIME_TYPE, $magicFile);
if ($info) {
$result = finfo_file($info, $file);
finfo_close($info);
if ($result !== false) {
return $result;
}
}
}
return $checkExtension ? static::getMimeTypeByExtension($file) : null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment