mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-11 19:20:01 +08:00
merge from master
This commit is contained in:
@@ -262,15 +262,7 @@ class BaseFileHelper
|
||||
|
||||
$handle = opendir($src);
|
||||
if ($handle === false) {
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
throw new InvalidParamException('Unable to open directory: ' . $src);
|
||||
=======
|
||||
throw new InvalidParamException("Unable to open directory: $src");
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
throw new InvalidParamException("Unable to open directory: $src");
|
||||
>>>>>>> master
|
||||
}
|
||||
if (!isset($options['basePath'])) {
|
||||
// this should be done only once
|
||||
@@ -393,15 +385,7 @@ class BaseFileHelper
|
||||
public static function findFiles($dir, $options = [])
|
||||
{
|
||||
if (!is_dir($dir)) {
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
throw new InvalidParamException('The dir argument must be a directory.');
|
||||
=======
|
||||
throw new InvalidParamException("The dir argument must be a directory: $dir");
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
throw new InvalidParamException("The dir argument must be a directory: $dir");
|
||||
>>>>>>> master
|
||||
}
|
||||
$dir = rtrim($dir, DIRECTORY_SEPARATOR);
|
||||
if (!isset($options['basePath'])) {
|
||||
@@ -412,15 +396,7 @@ class BaseFileHelper
|
||||
$list = [];
|
||||
$handle = opendir($dir);
|
||||
if ($handle === false) {
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
throw new InvalidParamException('Unable to open directory: ' . $dir);
|
||||
=======
|
||||
throw new InvalidParamException("Unable to open directory: $dir");
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
throw new InvalidParamException("Unable to open directory: $dir");
|
||||
>>>>>>> master
|
||||
}
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if ($file === '.' || $file === '..') {
|
||||
@@ -491,14 +467,7 @@ class BaseFileHelper
|
||||
* @param integer $mode the permission to be set for the created directory.
|
||||
* @param boolean $recursive whether to create parent directories if they do not exist.
|
||||
* @return boolean whether the directory is created successfully
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
* @throws \yii\base\Exception if the directory could not be created.
|
||||
>>>>>>> yiichina/master
|
||||
=======
|
||||
* @throws \yii\base\Exception if the directory could not be created (i.e. php error due to parallel changes)
|
||||
>>>>>>> master
|
||||
*/
|
||||
public static function createDirectory($path, $mode = 0775, $recursive = true)
|
||||
{
|
||||
@@ -510,21 +479,6 @@ class BaseFileHelper
|
||||
if ($recursive && !is_dir($parentDir) && $parentDir !== $path) {
|
||||
static::createDirectory($parentDir, $mode, true);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
$result = mkdir($path, $mode);
|
||||
chmod($path, $mode);
|
||||
=======
|
||||
try {
|
||||
$result = mkdir($path, $mode);
|
||||
chmod($path, $mode);
|
||||
} catch(\Exception $e) {
|
||||
throw new \yii\base\Exception("Failed to create directory '$path': " . $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
>>>>>>> yiichina/master
|
||||
|
||||
return $result;
|
||||
=======
|
||||
try {
|
||||
if (!mkdir($path, $mode)) {
|
||||
return false;
|
||||
@@ -539,7 +493,6 @@ class BaseFileHelper
|
||||
} catch (\Exception $e) {
|
||||
throw new \yii\base\Exception("Failed to change permissions for directory \"$path\": " . $e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user