Commit 718d1148 by Mark

file helper adjusted , upgrade notes added

parent 724efdb5
...@@ -47,3 +47,5 @@ Upgrade from Yii 2.0 Beta ...@@ -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. * 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;`. 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,14 +120,14 @@ class BaseFileHelper ...@@ -120,14 +120,14 @@ class BaseFileHelper
*/ */
public static function getMimeType($file, $magicFile = null, $checkExtension = true) public static function getMimeType($file, $magicFile = null, $checkExtension = true)
{ {
if (function_exists('finfo_open')) { $info = finfo_open(FILEINFO_MIME_TYPE, $magicFile);
$info = finfo_open(FILEINFO_MIME_TYPE, $magicFile);
if ($info) { if ($info) {
$result = finfo_file($info, $file); $result = finfo_file($info, $file);
finfo_close($info); finfo_close($info);
if ($result !== false) {
return $result; if ($result !== false) {
} return $result;
} }
} }
......
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