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
05cca154
Commit
05cca154
authored
Jun 11, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed "fileTypes" option.
parent
db3bfd09
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
31 deletions
+0
-31
FileHelper.php
framework/yii/helpers/base/FileHelper.php
+0
-6
FileHelperTest.php
tests/unit/framework/helpers/FileHelperTest.php
+0
-25
No files found.
framework/yii/helpers/base/FileHelper.php
View file @
05cca154
...
@@ -137,7 +137,6 @@ class FileHelper
...
@@ -137,7 +137,6 @@ class FileHelper
* - filter: callback, a PHP callback that is called for each sub-directory or file.
* - filter: callback, a PHP callback that is called for each sub-directory or file.
* If the callback returns false, the the sub-directory or file will not be copied.
* If the callback returns false, the the sub-directory or file will not be copied.
* The signature of the callback should be: `function ($path)`, where `$path` refers the full path to be copied.
* The signature of the callback should be: `function ($path)`, where `$path` refers the full path to be copied.
* - fileTypes: array, list of file name suffix (without dot). Only files with these suffixes will be copied.
* - only: array, list of patterns that the files or directories should match if they want to be copied.
* - only: array, list of patterns that the files or directories should match if they want to be copied.
* A path matches a pattern if it contains the pattern string at its end. For example,
* A path matches a pattern if it contains the pattern string at its end. For example,
* '/a/b' will match all files and directories ending with '/a/b'; and the '.svn' will match all files and
* '/a/b' will match all files and directories ending with '/a/b'; and the '.svn' will match all files and
...
@@ -212,7 +211,6 @@ class FileHelper
...
@@ -212,7 +211,6 @@ class FileHelper
* - filter: callback, a PHP callback that is called for each sub-directory or file.
* - filter: callback, a PHP callback that is called for each sub-directory or file.
* If the callback returns false, the the sub-directory or file will be excluded from the returning result.
* If the callback returns false, the the sub-directory or file will be excluded from the returning result.
* The signature of the callback should be: `function ($path)`, where `$path` refers the full path to be filtered.
* The signature of the callback should be: `function ($path)`, where `$path` refers the full path to be filtered.
* - fileTypes: array, list of file name suffix (without dot). Only files with these suffixes will be returned.
* - only: array, list of patterns that the files or directories should match if they want to be returned.
* - only: array, list of patterns that the files or directories should match if they want to be returned.
* A path matches a pattern if it contains the pattern string at its end. For example,
* A path matches a pattern if it contains the pattern string at its end. For example,
* '/a/b' will match all files and directories ending with '/a/b'; and the '.svn' will match all files and
* '/a/b' will match all files and directories ending with '/a/b'; and the '.svn' will match all files and
...
@@ -272,12 +270,8 @@ class FileHelper
...
@@ -272,12 +270,8 @@ class FileHelper
}
}
}
}
}
}
if
(
!
empty
(
$options
[
'fileTypes'
])
&&
is_file
(
$path
))
{
return
in_array
(
pathinfo
(
$path
,
PATHINFO_EXTENSION
),
$options
[
'fileTypes'
]);
}
else
{
return
true
;
return
true
;
}
}
}
/**
/**
* Makes directory.
* Makes directory.
...
...
tests/unit/framework/helpers/FileHelperTest.php
View file @
05cca154
...
@@ -268,31 +268,6 @@ class FileHelperTest extends TestCase
...
@@ -268,31 +268,6 @@ class FileHelperTest extends TestCase
$this
->
assertEquals
(
array
(
$dirName
.
DIRECTORY_SEPARATOR
.
$fileName
),
$foundFiles
);
$this
->
assertEquals
(
array
(
$dirName
.
DIRECTORY_SEPARATOR
.
$fileName
),
$foundFiles
);
}
}
/**
* @depends testFindFiles
*/
public
function
testFindFilesFileType
()
{
$dirName
=
'test_dir'
;
$fileType
=
'dat'
;
$fileName
=
'test_file.'
.
$fileType
;
$excludeFileName
=
'exclude_file.txt'
;
$this
->
createFileStructure
(
array
(
$dirName
=>
array
(
$fileName
=>
'file content'
,
$excludeFileName
=>
'exclude file content'
,
),
));
$basePath
=
$this
->
testFilePath
;
$dirName
=
$basePath
.
DIRECTORY_SEPARATOR
.
$dirName
;
$options
=
array
(
'fileTypes'
=>
array
(
$fileType
),
);
$foundFiles
=
FileHelper
::
findFiles
(
$dirName
,
$options
);
$this
->
assertEquals
(
array
(
$dirName
.
DIRECTORY_SEPARATOR
.
$fileName
),
$foundFiles
);
}
public
function
testMkdir
()
{
public
function
testMkdir
()
{
$basePath
=
$this
->
testFilePath
;
$basePath
=
$this
->
testFilePath
;
$dirName
=
$basePath
.
DIRECTORY_SEPARATOR
.
'test_dir_level_1'
.
DIRECTORY_SEPARATOR
.
'test_dir_level_2'
;
$dirName
=
$basePath
.
DIRECTORY_SEPARATOR
.
'test_dir_level_1'
.
DIRECTORY_SEPARATOR
.
'test_dir_level_2'
;
...
...
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