[TASK] Fix typos & grammar issues in Install Tool
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / FolderStructure / DefaultFactory.php
1 <?php
2 namespace TYPO3\CMS\Install\FolderStructure;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Factory returns default folder structure object hierarchy
29 */
30 class DefaultFactory {
31
32 /**
33 * Get default structure object hierarchy
34 *
35 * @throws Exception
36 * @return RootNode
37 * @TODO: Use objectManager instead of new (will be injected)
38 */
39 public function getStructure() {
40 $rootNode = new RootNode($this->getDefaultStructureDefinition(), NULL);
41 if (!($rootNode instanceof RootNodeInterface)) {
42 throw new Exception(
43 'Root node must implement RootNodeInterface',
44 1366139176
45 );
46 }
47 $structureFacade = new StructureFacade($rootNode);
48 if (!($structureFacade instanceof StructureFacadeInterface)) {
49 throw new Exception(
50 'Structure facade must implement StructureFacadeInterface',
51 1366535827
52 );
53 }
54 return $structureFacade;
55 }
56
57 /**
58 * Default definition of folder and file structure with dynamic
59 * permission settings
60 *
61 * @return array
62 */
63 protected function getDefaultStructureDefinition() {
64 $filePermission = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'];
65 $directoryPermission = $GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'];
66
67 return array(
68 // Cut off trailing forward / from PATH_site, so root node has no trailing slash like all others
69 'name' => substr(PATH_site, 0, -1),
70 'targetPermission' => $directoryPermission,
71 'targetPermissionRelaxed' => TRUE,
72 'children' => array(
73 array(
74 'name' => 'index.php',
75 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\LinkNode',
76 'target' => 'typo3_src/index.php',
77 ),
78 array(
79 'name' => 'typo3',
80 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\LinkNode',
81 'target' => 'typo3_src/typo3',
82 ),
83 array(
84 'name' => 'typo3_src',
85 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\LinkNode',
86 ),
87 array(
88 'name' => 'typo3temp',
89 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
90 'targetPermission' => $directoryPermission,
91 'children' => array(
92 array(
93 'name' => 'index.html',
94 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
95 'targetPermission' => $filePermission,
96 'targetContent' => '',
97 ),
98 array(
99 'name' => 'compressor',
100 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
101 'targetPermission' => $directoryPermission,
102 ),
103 array(
104 'name' => 'cs',
105 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
106 'targetPermission' => $directoryPermission,
107 ),
108 array(
109 'name' => 'Cache',
110 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
111 'targetPermission' => $directoryPermission,
112 ),
113 array(
114 'name' => 'GB',
115 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
116 'targetPermission' => $directoryPermission,
117 ),
118 array(
119 'name' => 'llxml',
120 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
121 'targetPermission' => $directoryPermission,
122 ),
123 array(
124 'name' => 'locks',
125 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
126 'targetPermission' => $directoryPermission,
127 ),
128 array(
129 'name' => 'pics',
130 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
131 'targetPermission' => $directoryPermission,
132 ),
133 array(
134 'name' => 'sprites',
135 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
136 'targetPermission' => $directoryPermission,
137 ),
138 array(
139 'name' => 'temp',
140 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
141 'targetPermission' => $directoryPermission,
142 ),
143 ),
144 ),
145 array(
146 'name' => 'typo3conf',
147 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
148 'targetPermission' => $directoryPermission,
149 'children' => array(
150 array(
151 'name' => 'ext',
152 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
153 'targetPermission' => $directoryPermission,
154 ),
155 array(
156 'name' => 'l10n',
157 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
158 'targetPermission' => $directoryPermission,
159 ),
160 ),
161 ),
162 array(
163 'name' => 'uploads',
164 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
165 'targetPermission' => $directoryPermission,
166 'children' => array(
167 array(
168 'name' => 'index.html',
169 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
170 'targetPermission' => $filePermission,
171 'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/uploads-index.html',
172 ),
173 array(
174 'name' => 'media',
175 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
176 'targetPermission' => $directoryPermission,
177 'children' => array(
178 array(
179 'name' => 'index.html',
180 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
181 'targetPermission' => $filePermission,
182 'targetContent' => '',
183 ),
184 ),
185 ),
186 array(
187 'name' => 'pics',
188 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
189 'targetPermission' => $directoryPermission,
190 'children' => array(
191 array(
192 'name' => 'index.html',
193 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
194 'targetPermission' => $filePermission,
195 'targetContent' => '',
196 ),
197 ),
198 ),
199 array(
200 'name' => 'tf',
201 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
202 'targetPermission' => $directoryPermission,
203 'children' => array(
204 array(
205 'name' => 'index.html',
206 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
207 'targetPermission' => $filePermission,
208 'targetContent' => '',
209 ),
210 ),
211 ),
212 ),
213 ),
214 array(
215 'name' => !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin',
216 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
217 'targetPermission' => $directoryPermission,
218 'children' => array(
219 array(
220 'name' => '_temp_',
221 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
222 'targetPermission' => $directoryPermission,
223 'children' => array(
224 array(
225 'name' => '.htaccess',
226 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
227 'targetPermission' => $filePermission,
228 'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
229 ),
230 array(
231 'name' => 'index.html',
232 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
233 'targetPermission' => $filePermission,
234 'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
235 ),
236 ),
237 ),
238 array(
239 'name' => 'user_upload',
240 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
241 'targetPermission' => $directoryPermission,
242 'children' => array(
243 array(
244 'name' => '_temp_',
245 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\DirectoryNode',
246 'targetPermission' => $directoryPermission,
247 'children' => array(
248 array(
249 'name' => 'index.html',
250 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
251 'targetPermission' => $filePermission,
252 'targetContent' => '',
253 ),
254 ),
255 ),
256 array(
257 'name' => 'index.html',
258 'type' => 'TYPO3\\CMS\\install\\FolderStructure\\FileNode',
259 'targetPermission' => $filePermission,
260 'targetContent' => '',
261 ),
262 ),
263 ),
264 ),
265 ),
266 ),
267 );
268 }
269 }