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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
UPGRADE.md
framework/UPGRADE.md
+4
-0
BaseFileHelper.php
framework/helpers/BaseFileHelper.php
+2
-2
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
...
@@ -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.
*
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;`
.
*
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,16 +120,16 @@ class BaseFileHelper
...
@@ -120,16 +120,16 @@ 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
)
{
if
(
$result
!==
false
)
{
return
$result
;
return
$result
;
}
}
}
}
}
return
$checkExtension
?
static
::
getMimeTypeByExtension
(
$file
)
:
null
;
return
$checkExtension
?
static
::
getMimeTypeByExtension
(
$file
)
:
null
;
}
}
...
...
framework/requirements/requirements.php
View file @
e48ff222
...
@@ -47,4 +47,11 @@ return array(
...
@@ -47,4 +47,11 @@ return array(
in <code>Yii::t()</code>, <abbr title="Internationalized domain names">IDN</abbr>-feature of
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.'
<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