Merge branch 'improved-mkdir-error'

Conflicts:
	framework/CHANGELOG.md
This commit is contained in:
Klimov Paul
2015-04-20 13:13:03 +03:00

View File

@ -447,6 +447,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
* @throws \yii\base\Exception if the directory could not be created.
*/
public static function createDirectory($path, $mode = 0775, $recursive = true)
{
@ -457,8 +458,12 @@ class BaseFileHelper
if ($recursive && !is_dir($parentDir)) {
static::createDirectory($parentDir, $mode, true);
}
$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);
}
return $result;
}