mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-12 11:40:19 +08:00
Fixed beforeCopy option.
This commit is contained in:
@@ -156,8 +156,7 @@ class BaseFileHelper
|
|||||||
* both '/' and '\' in the paths.
|
* both '/' and '\' in the paths.
|
||||||
* - recursive: boolean, whether the files under the subdirectories should also be copied. Defaults to true.
|
* - recursive: boolean, whether the files under the subdirectories should also be copied. Defaults to true.
|
||||||
* - beforeCopy: callback, a PHP callback that is called before copying each sub-directory or file.
|
* - beforeCopy: callback, a PHP callback that is called before copying each sub-directory or file.
|
||||||
* This option is used only when publishing a directory. If the callback returns false, the copy
|
* If the callback returns false, the copy operation for the sub-directory or file will be cancelled.
|
||||||
* operation for the sub-directory or file will be cancelled.
|
|
||||||
* The signature of the callback should be: `function ($from, $to)`, where `$from` is the sub-directory or
|
* The signature of the callback should be: `function ($from, $to)`, where `$from` is the sub-directory or
|
||||||
* file to be copied from, while `$to` is the copy target.
|
* file to be copied from, while `$to` is the copy target.
|
||||||
* - afterCopy: callback, a PHP callback that is called after each sub-directory or file is successfully copied.
|
* - afterCopy: callback, a PHP callback that is called after each sub-directory or file is successfully copied.
|
||||||
@@ -178,8 +177,8 @@ class BaseFileHelper
|
|||||||
$from = $src . DIRECTORY_SEPARATOR . $file;
|
$from = $src . DIRECTORY_SEPARATOR . $file;
|
||||||
$to = $dst . DIRECTORY_SEPARATOR . $file;
|
$to = $dst . DIRECTORY_SEPARATOR . $file;
|
||||||
if (static::filterPath($from, $options)) {
|
if (static::filterPath($from, $options)) {
|
||||||
if (isset($options['beforeCopy'])) {
|
if (!isset($options['beforeCopy']) || !call_user_func($options['beforeCopy'], $from, $to)) {
|
||||||
call_user_func($options['beforeCopy'], $from, $to);
|
continue;
|
||||||
}
|
}
|
||||||
if (is_file($from)) {
|
if (is_file($from)) {
|
||||||
copy($from, $to);
|
copy($from, $to);
|
||||||
|
|||||||
Reference in New Issue
Block a user