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--) {
85 $factor = pow(self::FACTOR,
$i);
86 if (($tmp = (
int) ($num / $factor)) or $found) {
88 $num = $num % $factor;
94 $path_string = (implode(
'/',
$path) .
'/');
96 return $path_string . $a_name .
'_' . $a_container_id;
130 if (!file_exists($this->path)) {
155 switch ($this->storage_type) {
156 case self::STORAGE_DATA:
160 case self::STORAGE_WEB:
164 case self::STORAGE_SECURED:
167 $this->path .=
'/' . self::SECURED_DIRECTORY;
176 if ($this->path_conversion) {
177 $this->path .= self::_createPathFromId($this->container_id, $this->
getPathPostfix());
193 if (!$fp = @fopen($a_absolute_path,
'w+')) {
196 if (@fwrite($fp, $a_data) ===
false) {
213 if (@file_exists($a_abs_name)) {
214 @unlink($a_abs_name);
229 if (@file_exists($a_abs_name)) {
244 public function delete()
260 if (@file_exists($a_from)) {
261 @copy($a_from, $a_to);
280 $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)