ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 146 of file class.ilUpdateUtilsMailMigration.php.

147 {
148 if (!is_dir($a_dir) || is_int(strpos($a_dir, "..")))
149 {
150 return;
151 }
152
153 $current_dir = opendir($a_dir);
154
155 $files = array();
156
157 // this extra loop has been necessary because of a strange bug
158 // at least on MacOS X. A looped readdir() didn't work
159 // correctly with larger directories
160 // when an unlink happened inside the loop. Getting all files
161 // into the memory first solved the problem.
162 while($entryname = readdir($current_dir))
163 {
164 $files[] = $entryname;
165 }
166
167 foreach($files as $file)
168 {
169 if(is_dir($a_dir."/".$file) and ($file != "." and $file!=".."))
170 {
171 self::delDir(${a_dir}."/".${file});
172 }
173 elseif ($file != "." and $file != "..")
174 {
175 unlink(${a_dir}."/".${file});
176 }
177 }
178
179 closedir($current_dir);
180 @rmdir(${a_dir});
181 }
print $file

References $file, 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 59 of file class.ilUpdateUtilsMailMigration.php.

60 {
61 return CLIENT_DATA_DIR;
62 }

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 183 of file class.ilUpdateUtilsMailMigration.php.

184 {
185 $current_dir = opendir($a_dir);
186
187 $dirs = array();
188 $files = array();
189 while($entry = readdir($current_dir))
190 {
191 if(is_dir($a_dir."/".$entry))
192 {
193 $dirs[$entry] = array("type" => "dir", "entry" => $entry);
194 }
195 else
196 {
197 if ($entry != "." && $entry != "..")
198 {
199 $size = filesize($a_dir."/".$entry);
200 $files[$entry] = array("type" => "file", "entry" => $entry,
201 "size" => $size);
202 }
203 }
204 }
205 ksort($dirs);
206 ksort($files);
207
208 return array_merge($dirs, $files);
209 }
$size
Definition: RandomTest.php:79
$dirs

References $dirs, 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 {
42 return "./".ILIAS_WEB_DIR."/".$ilias->client_id;
43 }
44 else
45 {
46 if (defined("ILIAS_MODULE"))
47 {
48 return "../".ILIAS_WEB_DIR."/".$ilias->client_id;
49 }
50 else
51 {
52 return "./".ILIAS_WEB_DIR."/".$ilias->client_id;
53 }
54 }
55
56 //return $ilias->ini->readVariable("server","webspace_dir");
57 }

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

+ Here is the caller graph for this function:

◆ ilTempnam()

static ilUpdateUtilsMailMigration::ilTempnam ( )
static

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

212 {
213 $temp_path = self::getDataDir() . "/temp";
214 if (!is_dir($temp_path))
215 {
216 self::makeDir($temp_path);
217 }
218 $temp_name = tempnam($temp_path, "tmp");
219 // --->
220 // added the following line because tempnam creates a backslash on some
221 // Windows systems which leads to problems, because the "...\tmp..." can be
222 // interpreted as "...{TAB-CHARACTER}...". The normal slash works fine
223 // even under windows (Helmut Schottmüller, 2005-08-31)
224 $temp_name = str_replace("\\", "/", $temp_name);
225 // --->
226 unlink($temp_name);
227 return $temp_name;
228 }

References getDataDir(), and makeDir().

+ Here is the call graph for this function:

◆ makeDir()

static ilUpdateUtilsMailMigration::makeDir (   $a_dir)
static

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

65 {
66 $a_dir = trim($a_dir);
67
68 // remove trailing slash (bugfix for php 4.2.x)
69 if (substr($a_dir,-1) == "/")
70 {
71 $a_dir = substr($a_dir,0,-1);
72 }
73
74 // check if a_dir comes with a path
75 if (!($path = substr($a_dir,0, strrpos($a_dir,"/") - strlen($a_dir))))
76 {
77 $path = ".";
78 }
79
80 // create directory with file permissions of parent directory
81 umask(0000);
82 return @mkdir($a_dir,fileperms($path));
83 }
$path
Definition: index.php:22

References $path.

Referenced by ilTempnam().

+ Here is the caller graph for this function:

◆ makeDirParents()

static ilUpdateUtilsMailMigration::makeDirParents (   $a_dir)
static

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

86 {
87 $dirs = array($a_dir);
88 $a_dir = dirname($a_dir);
89 $last_dirname = '';
90 while($last_dirname != $a_dir)
91 {
92 array_unshift($dirs, $a_dir);
93 $last_dirname = $a_dir;
94 $a_dir = dirname($a_dir);
95 }
96
97 // find the first existing dir
98 $reverse_paths = array_reverse($dirs, TRUE);
99 $found_index = -1;
100 foreach ($reverse_paths as $key => $value)
101 {
102 if ($found_index == -1)
103 {
104 if (is_dir($value))
105 {
106 $found_index = $key;
107 }
108 }
109 }
110
111 umask(0000);
112 foreach ($dirs as $dirindex => $dir)
113 {
114 // starting with the longest existing path
115 if ($dirindex >= $found_index)
116 {
117 if (! file_exists($dir))
118 {
119 if (strcmp(substr($dir,strlen($dir)-1,1),"/") == 0)
120 {
121 // on some systems there is an error when there is a slash
122 // at the end of a directory in mkdir, see Mantis #2554
123 $dir = substr($dir,0,strlen($dir)-1);
124 }
125 if (! mkdir($dir, $umask))
126 {
127 error_log("Can't make directory: $dir");
128 return false;
129 }
130 }
131 elseif (! is_dir($dir))
132 {
133 error_log("$dir is not a directory");
134 return false;
135 }
136 else
137 {
138 // get umask of the last existing parent directory
139 $umask = fileperms($dir);
140 }
141 }
142 }
143 return true;
144 }

References $dirs, 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 230 of file class.ilUpdateUtilsMailMigration.php.

231 {
232 return @rename($source, $target);
233 }

References 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: