ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilUpdateUtilsMailMigration Class Reference
+ Collaboration diagram for ilUpdateUtilsMailMigration:

Static Public Member Functions

static removeTrailingPathSeparators ($path)
 
static getWebspaceDir ($mode="filesystem")
 
static getDataDir ()
 
static makeDir ($a_dir)
 
static makeDirParents ($a_dir)
 
static delDir ($a_dir)
 
static getDir ($a_dir)
 
static ilTempnam ()
 
static rename ($source, $target)
 

Detailed Description

Definition at line 28 of file class.ilUpdateUtilsMailMigration.php.

Member Function Documentation

◆ delDir()

static ilUpdateUtilsMailMigration::delDir (   $a_dir)
static

Definition at line 125 of file class.ilUpdateUtilsMailMigration.php.

126 {
127 if (!is_dir($a_dir) || is_int(strpos($a_dir, ".."))) {
128 return;
129 }
130
131 $current_dir = opendir($a_dir);
132
133 $files = array();
134
135 // this extra loop has been necessary because of a strange bug
136 // at least on MacOS X. A looped readdir() didn't work
137 // correctly with larger directories
138 // when an unlink happened inside the loop. Getting all files
139 // into the memory first solved the problem.
140 while ($entryname = readdir($current_dir)) {
141 $files[] = $entryname;
142 }
143
144 foreach ($files as $file) {
145 if (is_dir($a_dir . "/" . $file) and ($file != "." and $file!="..")) {
146 self::delDir(${a_dir} . "/" . ${file});
147 } elseif ($file != "." and $file != "..") {
148 unlink(${a_dir} . "/" . ${file});
149 }
150 }
151
152 closedir($current_dir);
153 @rmdir(${a_dir});
154 }
$files
Definition: add-vimline.php:18
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $files, and delDir().

Referenced by delDir(), ilFileSystemStorageMailMigration\delete(), and ilFileSystemStorageMailMigration\deleteDirectory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDataDir()

static ilUpdateUtilsMailMigration::getDataDir ( )
static

Definition at line 53 of file class.ilUpdateUtilsMailMigration.php.

54 {
55 return CLIENT_DATA_DIR;
56 }

Referenced by ilFSStorageMailMailMigration\getRelativePathExMailDirectory(), ilTempnam(), and ilFileSystemStorageMailMigration\init().

+ Here is the caller graph for this function:

◆ getDir()

static ilUpdateUtilsMailMigration::getDir (   $a_dir)
static

Definition at line 156 of file class.ilUpdateUtilsMailMigration.php.

157 {
158 $current_dir = opendir($a_dir);
159
160 $dirs = array();
161 $files = array();
162 while ($entry = readdir($current_dir)) {
163 if (is_dir($a_dir . "/" . $entry)) {
164 $dirs[$entry] = array("type" => "dir", "entry" => $entry);
165 } else {
166 if ($entry != "." && $entry != "..") {
167 $size = filesize($a_dir . "/" . $entry);
168 $files[$entry] = array("type" => "file", "entry" => $entry,
169 "size" => $size);
170 }
171 }
172 }
173 ksort($dirs);
174 ksort($files);
175
176 return array_merge($dirs, $files);
177 }
$size
Definition: RandomTest.php:84

References $files, and $size.

◆ getWebspaceDir()

static ilUpdateUtilsMailMigration::getWebspaceDir (   $mode = "filesystem")
static

Definition at line 36 of file class.ilUpdateUtilsMailMigration.php.

37 {
38 global $ilias;
39
40 if ($mode == "filesystem") {
41 return "./" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
42 } else {
43 if (defined("ILIAS_MODULE")) {
44 return "../" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
45 } else {
46 return "./" . ILIAS_WEB_DIR . "/" . $ilias->client_id;
47 }
48 }
49
50 //return $ilias->ini->readVariable("server","webspace_dir");
51 }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

References defined.

Referenced by ilFSStorageMailMailMigration\getRelativePathExMailDirectory(), and ilFileSystemStorageMailMigration\init().

+ Here is the caller graph for this function:

◆ ilTempnam()

static ilUpdateUtilsMailMigration::ilTempnam ( )
static

Definition at line 179 of file class.ilUpdateUtilsMailMigration.php.

180 {
181 $temp_path = self::getDataDir() . "/temp";
182 if (!is_dir($temp_path)) {
183 self::makeDir($temp_path);
184 }
185 $temp_name = tempnam($temp_path, "tmp");
186 // --->
187 // added the following line because tempnam creates a backslash on some
188 // Windows systems which leads to problems, because the "...\tmp..." can be
189 // interpreted as "...{TAB-CHARACTER}...". The normal slash works fine
190 // even under windows (Helmut Schottmüller, 2005-08-31)
191 $temp_name = str_replace("\\", "/", $temp_name);
192 // --->
193 unlink($temp_name);
194 return $temp_name;
195 }

References getDataDir(), and makeDir().

+ Here is the call graph for this function:

◆ makeDir()

static ilUpdateUtilsMailMigration::makeDir (   $a_dir)
static

Definition at line 58 of file class.ilUpdateUtilsMailMigration.php.

59 {
60 $a_dir = trim($a_dir);
61
62 // remove trailing slash (bugfix for php 4.2.x)
63 if (substr($a_dir, -1) == "/") {
64 $a_dir = substr($a_dir, 0, -1);
65 }
66
67 // check if a_dir comes with a path
68 if (!($path = substr($a_dir, 0, strrpos($a_dir, "/") - strlen($a_dir)))) {
69 $path = ".";
70 }
71
72 // create directory with file permissions of parent directory
73 umask(0000);
74 return @mkdir($a_dir, fileperms($path));
75 }

References $path.

Referenced by ilTempnam().

+ Here is the caller graph for this function:

◆ makeDirParents()

static ilUpdateUtilsMailMigration::makeDirParents (   $a_dir)
static

Definition at line 77 of file class.ilUpdateUtilsMailMigration.php.

78 {
79 $dirs = array($a_dir);
80 $a_dir = dirname($a_dir);
81 $last_dirname = '';
82 while ($last_dirname != $a_dir) {
83 array_unshift($dirs, $a_dir);
84 $last_dirname = $a_dir;
85 $a_dir = dirname($a_dir);
86 }
87
88 // find the first existing dir
89 $reverse_paths = array_reverse($dirs, true);
90 $found_index = -1;
91 foreach ($reverse_paths as $key => $value) {
92 if ($found_index == -1) {
93 if (is_dir($value)) {
94 $found_index = $key;
95 }
96 }
97 }
98
99 umask(0000);
100 foreach ($dirs as $dirindex => $dir) {
101 // starting with the longest existing path
102 if ($dirindex >= $found_index) {
103 if (!file_exists($dir)) {
104 if (strcmp(substr($dir, strlen($dir)-1, 1), "/") == 0) {
105 // on some systems there is an error when there is a slash
106 // at the end of a directory in mkdir, see Mantis #2554
107 $dir = substr($dir, 0, strlen($dir)-1);
108 }
109 if (!mkdir($dir, $umask)) {
110 error_log("Can't make directory: $dir");
111 return false;
112 }
113 } elseif (!is_dir($dir)) {
114 error_log("$dir is not a directory");
115 return false;
116 } else {
117 // get umask of the last existing parent directory
118 $umask = fileperms($dir);
119 }
120 }
121 }
122 return true;
123 }
$key
Definition: croninfo.php:18

References $key, and Monolog\Handler\error_log().

Referenced by ilFileSystemStorageMailMigration\create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeTrailingPathSeparators()

static ilUpdateUtilsMailMigration::removeTrailingPathSeparators (   $path)
static

Definition at line 30 of file class.ilUpdateUtilsMailMigration.php.

31 {
32 $path = preg_replace("/[\/\\\]+$/", "", $path);
33 return $path;
34 }

References $path.

Referenced by ilFSStorageMailMailMigration\getRelativePathExMailDirectory(), and ilFileSystemStorageMailMigration\init().

+ Here is the caller graph for this function:

◆ rename()

static ilUpdateUtilsMailMigration::rename (   $source,
  $target 
)
static

Definition at line 197 of file class.ilUpdateUtilsMailMigration.php.

198 {
199 return @rename($source, $target);
200 }
$source
Definition: linkback.php:22

References $source, $target, and rename().

Referenced by rename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: