Conditions | 6 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
38 | private function check($name, $tryCreateDirectories = true) |
||
39 | { |
||
40 | $exists = true; |
||
41 | $isWritable = true; |
||
42 | |||
43 | if (!file_exists($name)) { |
||
44 | $exists = false; |
||
45 | if ($tryCreateDirectories) { |
||
46 | umask(0002); |
||
47 | $exists = @mkdir($name, 0775, true); // @: will be escalated to exception on failure |
||
48 | } |
||
49 | } |
||
50 | if (!is_writable($name)) { |
||
51 | $isWritable = false; |
||
52 | } |
||
53 | |||
54 | if (!$exists || !$isWritable) { |
||
55 | throw new DirectoryException($name); |
||
56 | } |
||
57 | |||
58 | return $name; |
||
59 | } |
||
84 |