‪TYPO3CMS  9.5
DefaultFactory.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
18 
24 {
30  public function ‪getStructure()
31  {
32  $rootNode = new ‪RootNode($this->‪getDefaultStructureDefinition(), null);
33  $structureFacade = new ‪StructureFacade($rootNode);
34  return $structureFacade;
35  }
36 
43  protected function ‪getDefaultStructureDefinition(): array
44  {
45  $filePermission = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'];
46  $directoryPermission = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'];
47 
48  $structure = [
49  // Note that root node has no trailing slash like all others
51  'targetPermission' => $directoryPermission,
52  'children' => [
53  [
54  'name' => 'typo3temp',
55  'type' => DirectoryNode::class,
56  'targetPermission' => $directoryPermission,
57  'children' => [
58  [
59  'name' => 'index.html',
60  'type' => FileNode::class,
61  'targetPermission' => $filePermission,
62  'targetContent' => '',
63  ],
64  [
65  'name' => 'assets',
66  'type' => DirectoryNode::class,
67  'targetPermission' => $directoryPermission,
68  'children' => [
69  [
70  'name' => 'compressed',
71  'type' => DirectoryNode::class,
72  'targetPermission' => $directoryPermission
73  ],
74  [
75  'name' => 'css',
76  'type' => DirectoryNode::class,
77  'targetPermission' => $directoryPermission
78  ],
79  [
80  'name' => 'js',
81  'type' => DirectoryNode::class,
82  'targetPermission' => $directoryPermission
83  ],
84  [
85  'name' => 'images',
86  'type' => DirectoryNode::class,
87  'targetPermission' => $directoryPermission
88  ],
89  [
90  'name' => '_processed_',
91  'type' => DirectoryNode::class,
92  'targetPermission' => $directoryPermission
93  ]
94  ]
95  ],
96  [
97  'name' => 'var',
98  'type' => DirectoryNode::class,
99  'targetPermission' => $directoryPermission,
100  'children' => [
101  [
102  'name' => '.htaccess',
103  'type' => FileNode::class,
104  'targetPermission' => $filePermission,
105  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess',
106  ],
107  [
108  'name' => 'charset',
109  'type' => DirectoryNode::class,
110  'targetPermission' => $directoryPermission,
111  ],
112  [
113  'name' => 'cache',
114  'type' => DirectoryNode::class,
115  'targetPermission' => $directoryPermission,
116  ],
117  [
118  'name' => 'lock',
119  'type' => DirectoryNode::class,
120  'targetPermission' => $directoryPermission,
121  ]
122  ]
123  ],
124  ],
125  ],
126  [
127  'name' => 'typo3conf',
128  'type' => DirectoryNode::class,
129  'targetPermission' => $directoryPermission,
130  'children' => [
131  [
132  'name' => 'ext',
133  'type' => DirectoryNode::class,
134  'targetPermission' => $directoryPermission,
135  ],
136  [
137  'name' => 'l10n',
138  'type' => DirectoryNode::class,
139  'targetPermission' => $directoryPermission,
140  ],
141  ],
142  ],
143  [
144  'name' => !empty(‪$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim(‪$GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin',
145  'type' => DirectoryNode::class,
146  'targetPermission' => $directoryPermission,
147  'children' => [
148  [
149  'name' => '.htaccess',
150  'type' => FileNode::class,
151  'targetPermission' => $filePermission,
152  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/resources-root-htaccess',
153  ],
154  [
155  'name' => '_temp_',
156  'type' => DirectoryNode::class,
157  'targetPermission' => $directoryPermission,
158  'children' => [
159  [
160  'name' => '.htaccess',
161  'type' => FileNode::class,
162  'targetPermission' => $filePermission,
163  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
164  ],
165  [
166  'name' => 'index.html',
167  'type' => FileNode::class,
168  'targetPermission' => $filePermission,
169  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
170  ],
171  ],
172  ],
173  [
174  'name' => 'user_upload',
175  'type' => DirectoryNode::class,
176  'targetPermission' => $directoryPermission,
177  'children' => [
178  [
179  'name' => '_temp_',
180  'type' => DirectoryNode::class,
181  'targetPermission' => $directoryPermission,
182  'children' => [
183  [
184  'name' => 'index.html',
185  'type' => FileNode::class,
186  'targetPermission' => $filePermission,
187  'targetContent' => '',
188  ],
189  [
190  'name' => 'importexport',
191  'type' => DirectoryNode::class,
192  'targetPermission' => $directoryPermission,
193  'children' => [
194  [
195  'name' => '.htaccess',
196  'type' => FileNode::class,
197  'targetPermission' => $filePermission,
198  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
199  ],
200  [
201  'name' => 'index.html',
202  'type' => FileNode::class,
203  'targetPermission' => $filePermission,
204  'targetContentFile' => ‪Environment::getFrameworkBasePath() . '/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
205  ],
206  ],
207  ],
208  ],
209  ],
210  [
211  'name' => 'index.html',
212  'type' => FileNode::class,
213  'targetPermission' => $filePermission,
214  'targetContent' => '',
215  ],
216  ],
217  ],
218  ],
219  ],
220  ],
221  ];
222 
223  // Have a default .htaccess if running apache web server or a default web.config if running IIS
224  if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === 0) {
225  $structure['children'][] = [
226  'name' => '.htaccess',
227  'type' => FileNode::class,
228  'targetPermission' => $filePermission,
229  'targetContentFile' => ‪Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess',
230  ];
231  } elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') === 0) {
232  $structure['children'][] = [
233  'name' => 'web.config',
234  'type' => FileNode::class,
235  'targetPermission' => $filePermission,
236  'targetContentFile' => ‪Environment::getPublicPath() . '/typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-web-config',
237  ];
238  }
239 
240  return $structure;
241  }
242 }
‪TYPO3\CMS\Install\FolderStructure\StructureFacadeInterface
Definition: StructureFacadeInterface.php:23
‪TYPO3\CMS\Install\FolderStructure\DefaultFactory\getStructure
‪StructureFacadeInterface getStructure()
Definition: DefaultFactory.php:30
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:153
‪TYPO3\CMS\Install\FolderStructure\DefaultFactory\getDefaultStructureDefinition
‪array getDefaultStructureDefinition()
Definition: DefaultFactory.php:43
‪TYPO3\CMS\Install\FolderStructure\StructureFacade
Definition: StructureFacade.php:25
‪TYPO3\CMS\Install\FolderStructure\DefaultFactory
Definition: DefaultFactory.php:24
‪TYPO3\CMS\Install\FolderStructure
Definition: AbstractNode.php:2
‪TYPO3\CMS\Core\Core\Environment\getFrameworkBasePath
‪static string getFrameworkBasePath()
Definition: Environment.php:234
‪TYPO3\CMS\Install\FolderStructure\RootNode
Definition: RootNode.php:24
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:39