59 public function __construct($a_storage_type,$a_path_conversion,$a_container_id)
61 $this->storage_type = $a_storage_type;
62 $this->path_conversion = $a_path_conversion;
63 $this->container_id = $a_container_id;
87 $num = $a_container_id;
88 for($i = self::MAX_EXPONENT; $i > 0;$i--)
90 $factor = pow(self::FACTOR,$i);
91 if(($tmp = (
int) ($num / $factor))
or $found)
94 $num = $num % $factor;
101 $path_string = (implode(
'/',
$path).
'/');
103 return $path_string.$a_name.
'_'.$a_container_id;
137 if(!file_exists($this->path))
163 switch($this->storage_type)
165 case self::STORAGE_DATA:
169 case self::STORAGE_WEB:
173 case self::STORAGE_SECURED:
176 $this->path .=
'/'.self::SECURED_DIRECTORY;
185 if($this->path_conversion)
187 $this->path .= self::_createPathFromId($this->container_id,$this->
getPathPostfix());
205 if(!$fp = @fopen($a_absolute_path,
'w+'))
209 if(@fwrite($fp,$a_data) ===
false)
227 if(@file_exists($a_abs_name))
229 @unlink($a_abs_name);
244 if(@file_exists($a_abs_name))
260 public function delete()
276 if(@file_exists($a_from))
278 @copy($a_from,$a_to);
297 $this->path .= $a_appendix;
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
appendToPath($a_appendix)
deleteDirectory($a_abs_name)
Delete directory.
static _copyDirectory($a_source, $a_target)
Copy directory and all contents.
static _createPathFromId($a_container_id, $a_name)
Create a path from an id: e.g 12345 will be converted to 12/34/<name>_5.
create()
Create directory.
writeToFile($a_data, $a_absolute_path)
Write data to file.
getPathPrefix()
Get path prefix.
__construct($a_storage_type, $a_path_conversion, $a_container_id)
Constructor.
static removeTrailingPathSeparators($path)
Create styles array
The data for the language used.
getAbsolutePath()
Get absolute path of storage directory.
static getDataDir()
get data directory (outside webspace)
getPathPostfix()
Get directory name.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
deleteFile($a_abs_name)
Delete file.
copyFile($a_from, $a_to)
Copy files.