Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e48ff222
Commit
e48ff222
authored
Jun 11, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3804 from Ragazzo/fileinfo_added_to_requirements_checks
fileinfo check
parents
527daa20
31e8ef3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
UPGRADE.md
framework/UPGRADE.md
+4
-0
BaseFileHelper.php
framework/helpers/BaseFileHelper.php
+8
-8
requirements.php
framework/requirements/requirements.php
+7
-0
No files found.
framework/UPGRADE.md
View file @
e48ff222
...
...
@@ -47,3 +47,6 @@ 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;`
.
*
The
`fileinfo`
PHP extension is now required by Yii. If you use
`yii\helpers\FileHelper::getMimeType()`
, make sure
you have enabled this extension. This extension is
[
builtin
](
http://www.php.net/manual/en/fileinfo.installation.php
)
in php above
`5.3`
.
\ No newline at end of file
framework/helpers/BaseFileHelper.php
View file @
e48ff222
...
...
@@ -120,14 +120,14 @@ 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
;
}
$info
=
finfo_open
(
FILEINFO_MIME_TYPE
,
$magicFile
);
if
(
$info
)
{
$result
=
finfo_file
(
$info
,
$file
);
finfo_close
(
$info
);
if
(
$result
!==
false
)
{
return
$result
;
}
}
...
...
framework/requirements/requirements.php
View file @
e48ff222
...
...
@@ -47,4 +47,11 @@ return array(
in <code>Yii::t()</code>, <abbr title="Internationalized domain names">IDN</abbr>-feature of
<code>EmailValidator</code> or <code>UrlValidator</code> or the <code>yii\i18n\Formatter</code> class.'
),
array
(
'name'
=>
'Fileinfo extension'
,
'mandatory'
=>
true
,
'condition'
=>
extension_loaded
(
'fileinfo'
),
'by'
=>
'<a href="http://www.php.net/manual/en/book.fileinfo.php">File Information</a>'
,
'memo'
=>
'Required for files upload to detect correct file mime-types.'
),
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment