55 public function __construct($a_storage_type,$a_path_conversion,$a_container_id)
57 $this->storage_type = $a_storage_type;
58 $this->path_conversion = $a_path_conversion;
59 $this->container_id = $a_container_id;
83 $num = $a_container_id;
84 for($i = self::MAX_EXPONENT; $i > 0;$i--)
86 $factor = pow(self::FACTOR,$i);
87 if(($tmp = (
int) ($num / $factor))
or $found)
90 $num = $num % $factor;
97 $path_string = (implode(
'/',
$path).
'/');
99 return $path_string.$a_name.
'_'.$a_container_id;
133 if(!file_exists($this->path))
159 switch($this->storage_type)
161 case self::STORAGE_DATA:
165 case self::STORAGE_WEB:
169 case self::STORAGE_SECURED:
172 $this->path .=
'/'.self::SECURED_DIRECTORY;
181 if($this->path_conversion)
183 $this->path .= self::_createPathFromId($this->container_id,$this->
getPathPostfix());
201 if(!$fp = @fopen($a_absolute_path,
'w+'))
205 if(@fwrite($fp,$a_data) ===
false)
223 if(@file_exists($a_abs_name))
225 @unlink($a_abs_name);
240 if(@file_exists($a_abs_name))
256 public function delete()
272 if(@file_exists($a_from))
274 @copy($a_from,$a_to);
293 $this->path .= $a_appendix;
static makeDirParents($a_dir)
Create a new directory and all parent directories.
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.
deleteDirectory($a_abs_name)
Delete directory.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
create()
Create directory.
deleteFile($a_abs_name)
Delete file.
getPathPostfix()
Get directory name.
copyFile($a_from, $a_to)
Copy files.
writeToFile($a_data, $a_absolute_path)
Write data to file.
getAbsolutePath()
Get absolute path of storage directory.
static removeTrailingPathSeparators($path)
Create styles array
The data for the language used.
getPathPrefix()
Get path prefix.
static getDataDir()
get data directory (outside webspace)
__construct($a_storage_type, $a_path_conversion, $a_container_id)
Constructor.
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
appendToPath($a_appendix)