2 namespace TYPO3\CMS\Install\FolderStructure;
18 use TYPO3\CMS\Install\Status;
40 throw new Exception\InvalidArgumentException(
41 'Node must have parent',
48 if (strstr($structure[
'name'],
'/') !==
false) {
49 throw new Exception\InvalidArgumentException(
50 'Directory name must not contain forward slash',
54 $this->name = $structure[
'name'];
56 if (isset($structure[
'targetPermission'])) {
60 if (array_key_exists(
'children', $structure)) {
61 $this->createChildren($structure[
'children']);
76 $status->setMessage(
'The Install Tool can try to create it');
81 $result = array_merge($result, $this->getChildrenStatus());
108 public function fix()
111 foreach ($this->children as $child) {
113 $result = array_merge($result, $child->fix());
132 $result[] = $resultCreateDirectory;
133 if ($resultCreateDirectory instanceof Status\
OkStatus &&
149 ' but is of type ' . $fileType .
'. This cannot be fixed automatically. Please investigate.'
154 ' but is of unknown type, probably because an upper level directory does not exist. Please investigate.'
177 if ($result ===
true) {
184 'The target directory could not be created. There is probably a' .
185 ' group or owner permission problem on the parent directory.'
211 'Path ' . $this->
getAbsolutePath() .
' exists, but no file underneath it' .
239 protected function getChildrenStatus()
242 foreach ($this->children as $child) {
244 $result = array_merge($result, $child->getStatus());
258 if ($result ===
true) {
272 return (!@is_link($path) && @is_dir($path));
281 protected function createChildren(array $structure)
283 foreach ($structure as $child) {
284 if (!array_key_exists(
'type', $child)) {
285 throw new Exception\InvalidArgumentException(
286 'Child must have type',
290 if (!array_key_exists(
'name', $child)) {
291 throw new Exception\InvalidArgumentException(
292 'Child must have name',
296 $name = $child[
'name'];
297 foreach ($this->children as $existingChild) {
299 if ($existingChild->getName() ===
$name) {
300 throw new Exception\InvalidArgumentException(
301 'Child name must be unique',
306 $this->children[] =
new $child[
'type']($child, $this);