improved control over and handling of file and dir permissions

- rename FileHelper::mkdir for API consistency
- changed default permission for directories to 775 instead of 777
- added some properties to classes that deal with files to allow control
  over directory permissions.
This commit is contained in:
Carsten Brandt
2013-08-30 16:52:33 +02:00
parent fa07d31310
commit 4b7f5a728a
6 changed files with 74 additions and 21 deletions

View File

@@ -58,16 +58,17 @@ class AssetManager extends Component
public $linkAssets = false;
/**
* @var integer the permission to be set for newly published asset files.
* This value will be used by PHP chmod() function.
* This value will be used by PHP chmod() function. No umask will be applied.
* If not set, the permission will be determined by the current environment.
*/
public $fileMode;
/**
* @var integer the permission to be set for newly generated asset directories.
* This value will be used by PHP chmod() function.
* Defaults to 0777, meaning the directory can be read, written and executed by all users.
* This value will be used by PHP chmod() function. No umask will be applied.
* Defaults to 0775, meaning the directory is read-writable by owner and group,
* but read-only for other users.
*/
public $dirMode = 0777;
public $dirMode = 0775;
/**
* Initializes the component.
@@ -205,7 +206,7 @@ class AssetManager extends Component
$dstFile = $dstDir . DIRECTORY_SEPARATOR . $fileName;
if (!is_dir($dstDir)) {
mkdir($dstDir, $this->dirMode, true);
FileHelper::createDirectory($dstDir, $this->dirMode, true);
}
if ($this->linkAssets) {