[BUGFIX] Provide Foldername in InaccessibleException
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / InaccessibleFolder.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource;
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
17 /**
18 * A representation for an inaccessible folder.
19 *
20 * If a folder has execution rights you can list it's contents
21 * despite the access rights on the subfolders. If a subfolder
22 * has no rights it has to be shown anyhow, but marked as
23 * inaccessible.
24 */
25 class InaccessibleFolder extends Folder
26 {
27 /**
28 * Throws an Exception,
29 * used to prevent duplicate code in all the methods
30 *
31 * @throws Exception\InsufficientFolderReadPermissionsException
32 */
33 protected function throwInaccessibleException()
34 {
35 throw new Exception\InsufficientFolderReadPermissionsException(
36 'You are trying to use a method on the inaccessible folder "' . $this->getName() . '".',
37 1390290029
38 );
39 }
40
41 /**
42 * Sets a new name of the folder
43 * currently this does not trigger the "renaming process"
44 * as the name is more seen as a label
45 *
46 * @param string $name The new name
47 */
48 public function setName($name)
49 {
50 $this->throwInaccessibleException();
51 }
52
53 /**
54 * Returns a publicly accessible URL for this folder
55 *
56 * WARNING: Access to the folder may be restricted by further means, e.g. some
57 * web-based authentication. You have to take care of this yourself.
58 *
59 * @param bool $relativeToCurrentScript Determines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
60 * @return string
61 */
62 public function getPublicUrl($relativeToCurrentScript = false)
63 {
64 $this->throwInaccessibleException();
65 }
66
67 /**
68 * Returns a list of files in this folder, optionally filtered. There are several filter modes available, see the
69 * FILTER_MODE_* constants for more information.
70 *
71 * For performance reasons the returned items can also be limited to a given range
72 *
73 * @param int $start The item to start at
74 * @param int $numberOfItems The number of items to return
75 * @param int $filterMode The filter mode to use for the filelist.
76 * @param bool $recursive
77 * @param string $sort
78 * @param bool $sortRev
79 * @return File[]
80 */
81 public function getFiles($start = 0, $numberOfItems = 0, $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive = false, $sort = '', $sortRev = false)
82 {
83 $this->throwInaccessibleException();
84 }
85
86 /**
87 * Returns amount of all files within this folder, optionally filtered by
88 * the given pattern
89 *
90 * @param array $filterMethods
91 * @param bool $recursive
92 *
93 * @return int
94 */
95 public function getFileCount(array $filterMethods = [], $recursive = false)
96 {
97 $this->throwInaccessibleException();
98 }
99
100 /**
101 * Returns the object for a subfolder of the current folder, if it exists.
102 *
103 * @param string $name Name of the subfolder
104 *
105 * @throws \InvalidArgumentException
106 * @return Folder
107 */
108 public function getSubfolder($name)
109 {
110 $this->throwInaccessibleException();
111 }
112
113 /**
114 * Returns a list of subfolders
115 *
116 * @param int $start The item to start at
117 * @param int $numberOfItems The number of items to return
118 * @param int $filterMode The filter mode to use for the filelist.
119 * @param bool $recursive
120 * @return Folder[]
121 */
122 public function getSubfolders($start = 0, $numberOfItems = 0, $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive = false)
123 {
124 $this->throwInaccessibleException();
125 }
126
127 /**
128 * Adds a file from the local server disk. If the file already exists and
129 * overwriting is disabled,
130 *
131 * @param string $localFilePath
132 * @param string $fileName
133 * @param string $conflictMode a value of the DuplicationBehavior enumeration
134 * @return File The file object
135 */
136 public function addFile($localFilePath, $fileName = null, $conflictMode = DuplicationBehavior::CANCEL)
137 {
138 $this->throwInaccessibleException();
139 }
140
141 /**
142 * Adds an uploaded file into the Storage.
143 *
144 * @param array $uploadedFileData contains information about the uploaded file given by $_FILES['file1']
145 * @param string $conflictMode a value of the DuplicationBehavior enumeration
146 * @return File The file object
147 */
148 public function addUploadedFile(array $uploadedFileData, $conflictMode = DuplicationBehavior::CANCEL)
149 {
150 $this->throwInaccessibleException();
151 }
152
153 /**
154 * Renames this folder.
155 *
156 * @param string $newName
157 * @return Folder
158 */
159 public function rename($newName)
160 {
161 $this->throwInaccessibleException();
162 }
163
164 /**
165 * Deletes this folder from its storage. This also means that this object becomes useless.
166 *
167 * @param bool $deleteRecursively
168 * @return bool TRUE if deletion succeeded
169 */
170 public function delete($deleteRecursively = true)
171 {
172 $this->throwInaccessibleException();
173 }
174
175 /**
176 * Creates a new blank file
177 *
178 * @param string $fileName
179 * @return File The new file object
180 */
181 public function createFile($fileName)
182 {
183 $this->throwInaccessibleException();
184 }
185
186 /**
187 * Creates a new folder
188 *
189 * @param string $folderName
190 * @return Folder The new folder object
191 */
192 public function createFolder($folderName)
193 {
194 $this->throwInaccessibleException();
195 }
196
197 /**
198 * Copies folder to a target folder
199 *
200 * @param Folder $targetFolder Target folder to copy to.
201 * @param string $targetFolderName an optional destination fileName
202 * @param string $conflictMode a value of the DuplicationBehavior enumeration
203 * @return Folder New (copied) folder object.
204 */
205 public function copyTo(Folder $targetFolder, $targetFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
206 {
207 $this->throwInaccessibleException();
208 }
209
210 /**
211 * Moves folder to a target folder
212 *
213 * @param Folder $targetFolder Target folder to move to.
214 * @param string $targetFolderName an optional destination fileName
215 * @param string $conflictMode a value of the DuplicationBehavior enumeration
216 * @return Folder New (copied) folder object.
217 */
218 public function moveTo(Folder $targetFolder, $targetFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
219 {
220 $this->throwInaccessibleException();
221 }
222
223 /**
224 * Checks if a file exists in this folder
225 *
226 * @param string $name
227 * @return bool
228 */
229 public function hasFile($name)
230 {
231 $this->throwInaccessibleException();
232 }
233
234 /**
235 * Checks if a folder exists in this folder.
236 *
237 * @param string $name
238 * @return bool
239 */
240 public function hasFolder($name)
241 {
242 $this->throwInaccessibleException();
243 }
244
245 /**
246 * Updates the properties of this folder, e.g. after re-indexing or moving it.
247 *
248 * NOTE: This method should not be called from outside the File Abstraction Layer (FAL)!
249 *
250 * @param array $properties
251 * @internal
252 */
253 public function updateProperties(array $properties)
254 {
255 $this->throwInaccessibleException();
256 }
257
258 /**
259 * Sets the filters to use when listing files. These are only used if the filter mode is one of
260 * FILTER_MODE_USE_OWN_FILTERS and FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS
261 *
262 * @param array $filters
263 */
264 public function setFileAndFolderNameFilters(array $filters)
265 {
266 $this->throwInaccessibleException();
267 }
268
269 /**
270 * @return int
271 */
272 public function getModificationTime()
273 {
274 return 0;
275 }
276
277 /**
278 * @return int
279 */
280 public function getCreationTime()
281 {
282 return 0;
283 }
284 }