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--) {
89 $factor = pow(self::FACTOR,
$i);
90 if (($tmp = (
int) ($num / $factor)) or $found) {
92 $num = $num % $factor;
98 $path_string = (implode(
'/',
$path) .
'/');
100 return $path_string . $a_name .
'_' . $a_container_id;
134 if (!file_exists($this->path)) {
159 switch ($this->storage_type) {
160 case self::STORAGE_DATA:
164 case self::STORAGE_WEB:
168 case self::STORAGE_SECURED:
171 $this->path .=
'/' . self::SECURED_DIRECTORY;
180 if ($this->path_conversion) {
181 $this->path .= self::_createPathFromId($this->container_id, $this->
getPathPostfix());
197 if (!$fp = @fopen($a_absolute_path,
'w+')) {
200 if (@fwrite($fp, $a_data) ===
false) {
217 if (@file_exists($a_abs_name)) {
218 @unlink($a_abs_name);
233 if (@file_exists($a_abs_name)) {
248 public function delete()
264 if (@file_exists($a_from)) {
265 @copy($a_from, $a_to);
284 $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.