| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace ThurData\Servers\KerioEmail\Core\FileReader;
- /**
- * Description of File
- *
- * @autor ThurData <info@thrudata.ch>
- */
- class File
- {
- public static function createFile()
- {
- // next version
- }
- public static function createPaths()
- {
- foreach (func_get_args() as $path)
- {
- if (is_array($path) && isset($path['permission']) && self::createPath($path['full'], $path['permission']) === false)
- {
- $parentPath = explode(DS, $path['full']);
- array_pop($pathFull);
- $parentPath = implode(DS, $parentPath);
- self::setPermission($parentPath);
- self::setUser($path['full'], 'www-data');
- self::createPath($path['full'], $path['permission']);
- }
- elseif (is_array($path) && self::createPath($path['full']) === false)
- {
- $parentPath = explode(DS, $path['full']);
- array_pop($pathFull);
- $parentPath = implode(DS, $parentPath);
- self::setPermission($parentPath);
- self::setUser($path['full'], 'www-data');
- self::createPath($path['full']);
- }
- else
- {
- self::createPath($path);
- }
- }
- }
- public static function createPath($path, $permission = 0777)
- {
- return mkdir($path, $permission);
- }
- public static function setPermission($file, $permission = 0777)
- {
- return chmod($file, $permission);
- }
- public static function setUser($file, $user)
- {
- return chown($file, $user);
- }
- /**
- * @return PathValidator
- */
- public static function getValidator()
- {
- return new PathValidator();
- }
- }
|