TYPO3  7.6
DefaultFactory.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Install\FolderStructure;
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 
23 {
31  public function getStructure()
32  {
33  $rootNode = new RootNode($this->getDefaultStructureDefinition(), null);
34  if (!($rootNode instanceof RootNodeInterface)) {
35  throw new Exception(
36  'Root node must implement RootNodeInterface',
37  1366139176
38  );
39  }
40  $structureFacade = new StructureFacade($rootNode);
41  if (!($structureFacade instanceof StructureFacadeInterface)) {
42  throw new Exception(
43  'Structure facade must implement StructureFacadeInterface',
44  1366535827
45  );
46  }
47  return $structureFacade;
48  }
49 
56  protected function getDefaultStructureDefinition()
57  {
58  $filePermission = $GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'];
59  $directoryPermission = $GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'];
60 
62  // In composer mode the links are configurable and might even be actual files
63  // Ignore this structure in this case
64  $structureAdditional = array();
65  } else {
66  $structureAdditional = array(
67  array(
68  'name' => 'index.php',
69  'type' => LinkNode::class,
70  'target' => 'typo3_src/index.php',
71  ),
72  array(
73  'name' => 'typo3',
74  'type' => LinkNode::class,
75  'target' => 'typo3_src/typo3',
76  ),
77  array(
78  'name' => 'typo3_src',
79  'type' => LinkNode::class,
80  ),
81  );
82  }
83  $structureBase = array(
84  array(
85  'name' => 'typo3temp',
86  'type' => DirectoryNode::class,
87  'targetPermission' => $directoryPermission,
88  'children' => array(
89  array(
90  'name' => 'index.html',
91  'type' => FileNode::class,
92  'targetPermission' => $filePermission,
93  'targetContent' => '',
94  ),
95  array(
96  'name' => 'compressor',
97  'type' => DirectoryNode::class,
98  'targetPermission' => $directoryPermission,
99  ),
100  array(
101  'name' => 'cs',
102  'type' => DirectoryNode::class,
103  'targetPermission' => $directoryPermission,
104  ),
105  array(
106  'name' => 'Cache',
107  'type' => DirectoryNode::class,
108  'targetPermission' => $directoryPermission,
109  ),
110  array(
111  'name' => 'GB',
112  'type' => DirectoryNode::class,
113  'targetPermission' => $directoryPermission,
114  ),
115  array(
116  'name' => 'llxml',
117  'type' => DirectoryNode::class,
118  'targetPermission' => $directoryPermission,
119  ),
120  array(
121  'name' => 'locks',
122  'type' => DirectoryNode::class,
123  'targetPermission' => $directoryPermission,
124  ),
125  array(
126  'name' => 'pics',
127  'type' => DirectoryNode::class,
128  'targetPermission' => $directoryPermission,
129  ),
130  array(
131  'name' => 'sprites',
132  'type' => DirectoryNode::class,
133  'targetPermission' => $directoryPermission,
134  ),
135  array(
136  'name' => 'temp',
137  'type' => DirectoryNode::class,
138  'targetPermission' => $directoryPermission,
139  ),
140  array(
141  'name' => '_processed_',
142  'type' => DirectoryNode::class,
143  'targetPermission' => $directoryPermission,
144  ),
145  ),
146  ),
147  array(
148  'name' => 'typo3conf',
149  'type' => DirectoryNode::class,
150  'targetPermission' => $directoryPermission,
151  'children' => array(
152  array(
153  'name' => 'ext',
154  'type' => DirectoryNode::class,
155  'targetPermission' => $directoryPermission,
156  ),
157  array(
158  'name' => 'l10n',
159  'type' => DirectoryNode::class,
160  'targetPermission' => $directoryPermission,
161  ),
162  ),
163  ),
164  array(
165  'name' => 'uploads',
166  'type' => DirectoryNode::class,
167  'targetPermission' => $directoryPermission,
168  'children' => array(
169  array(
170  'name' => 'index.html',
171  'type' => FileNode::class,
172  'targetPermission' => $filePermission,
173  'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/uploads-index.html',
174  ),
175  array(
176  'name' => 'media',
177  'type' => DirectoryNode::class,
178  'targetPermission' => $directoryPermission,
179  'children' => array(
180  array(
181  'name' => 'index.html',
182  'type' => FileNode::class,
183  'targetPermission' => $filePermission,
184  'targetContent' => '',
185  ),
186  ),
187  ),
188  array(
189  'name' => 'pics',
190  'type' => DirectoryNode::class,
191  'targetPermission' => $directoryPermission,
192  'children' => array(
193  array(
194  'name' => 'index.html',
195  'type' => FileNode::class,
196  'targetPermission' => $filePermission,
197  'targetContent' => '',
198  ),
199  ),
200  ),
201  array(
202  'name' => 'tx_felogin',
203  'type' => DirectoryNode::class,
204  'targetPermission' => $directoryPermission,
205  ),
206  ),
207  ),
208  array(
209  'name' => !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin',
210  'type' => DirectoryNode::class,
211  'targetPermission' => $directoryPermission,
212  'children' => array(
213  array(
214  'name' => '_temp_',
215  'type' => DirectoryNode::class,
216  'targetPermission' => $directoryPermission,
217  'children' => array(
218  array(
219  'name' => '.htaccess',
220  'type' => FileNode::class,
221  'targetPermission' => $filePermission,
222  'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
223  ),
224  array(
225  'name' => 'index.html',
226  'type' => FileNode::class,
227  'targetPermission' => $filePermission,
228  'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
229  ),
230  ),
231  ),
232  array(
233  'name' => 'user_upload',
234  'type' => DirectoryNode::class,
235  'targetPermission' => $directoryPermission,
236  'children' => array(
237  array(
238  'name' => '_temp_',
239  'type' => DirectoryNode::class,
240  'targetPermission' => $directoryPermission,
241  'children' => array(
242  array(
243  'name' => 'index.html',
244  'type' => FileNode::class,
245  'targetPermission' => $filePermission,
246  'targetContent' => '',
247  ),
248  array(
249  'name' => 'importexport',
250  'type' => DirectoryNode::class,
251  'targetPermission' => $directoryPermission,
252  'children' => array(
253  array(
254  'name' => '.htaccess',
255  'type' => FileNode::class,
256  'targetPermission' => $filePermission,
257  'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
258  ),
259  array(
260  'name' => 'index.html',
261  'type' => FileNode::class,
262  'targetPermission' => $filePermission,
263  'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
264  ),
265  ),
266  ),
267  ),
268  ),
269  array(
270  'name' => 'index.html',
271  'type' => FileNode::class,
272  'targetPermission' => $filePermission,
273  'targetContent' => '',
274  ),
275  ),
276  ),
277  ),
278  ),
279  );
280 
281  return array(
282  // Cut off trailing forward / from PATH_site, so root node has no trailing slash like all others
283  'name' => substr(PATH_site, 0, -1),
284  'targetPermission' => $directoryPermission,
285  'children' => array_merge($structureAdditional, $structureBase)
286  );
287  }
288 }