[BUGFIX] Copy and move folders between storages is broken
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Resource / Driver / AbstractDriver.php
1 <?php
2 namespace TYPO3\CMS\Core\Resource\Driver;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2011-2013 Ingmar Schlecht <ingmar.schlecht@typo3.org>
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 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * An abstract implementation of a storage driver.
31 *
32 * @author Ingmar Schlecht <ingmar.schlecht@typo3.org>
33 * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
34 */
35 abstract class AbstractDriver {
36
37 /**
38 * The mount object this driver instance belongs to
39 *
40 * @var \TYPO3\CMS\Core\Resource\ResourceStorage
41 */
42 protected $storage;
43
44 /**
45 * A list of all supported hash algorithms, written all lower case and
46 * without any dashes etc. (e.g. sha1 instead of SHA-1)
47 * Be sure to set this in inherited classes!
48 *
49 * @var array
50 */
51 protected $supportedHashAlgorithms = array();
52
53 /**
54 * The storage folder that forms the root of this FS tree
55 *
56 * @var \TYPO3\CMS\Core\Resource\Folder
57 */
58 protected $rootLevelFolder;
59
60 /**
61 * The default folder new files should be put into.
62 *
63 * @var \TYPO3\CMS\Core\Resource\Folder
64 */
65 protected $defaultLevelFolder;
66
67 /**
68 * The configuration of this driver
69 *
70 * @var array
71 */
72 protected $configuration = array();
73
74 /**
75 * The callback method to handle the files when listing folder contents
76 *
77 * @var string
78 */
79 protected $fileListCallbackMethod = 'getFileList_itemCallback';
80
81 /**
82 * The callback method to handle the folders when listing folder contents
83 *
84 * @var string
85 */
86 protected $folderListCallbackMethod = 'getFolderList_itemCallback';
87
88 /**
89 * Creates this object.
90 *
91 * @param array $configuration
92 */
93 public function __construct(array $configuration = array()) {
94 $this->configuration = $configuration;
95 }
96
97 /**
98 * Initializes this object. This is called by the storage after the driver
99 * has been attached.
100 *
101 * @return void
102 */
103 abstract public function initialize();
104
105 /**
106 * Checks a fileName for validity. This could be overriden in concrete
107 * drivers if they have different file naming rules.
108 *
109 * @param string $fileName
110 * @return boolean TRUE if file name is valid
111 */
112 public function isValidFilename($fileName) {
113 if (strpos($fileName, '/') !== FALSE) {
114 return FALSE;
115 }
116 if (!preg_match('/^[\\pL\\d[:blank:]._-]*$/u', $fileName)) {
117 return FALSE;
118 }
119 return TRUE;
120 }
121
122 /**
123 * Sets the storage object that works with this driver
124 *
125 * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
126 * @return \TYPO3\CMS\Core\Resource\Driver\AbstractDriver
127 */
128 public function setStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storage) {
129 $this->storage = $storage;
130 return $this;
131 }
132
133 /**
134 * Checks if a configuration is valid for this driver.
135 * Throws an exception if a configuration will not work.
136 *
137 * @abstract
138 * @param array $configuration
139 * @return void
140 */
141 static abstract public function verifyConfiguration(array $configuration);
142
143 /**
144 * processes the configuration, should be overridden by subclasses
145 *
146 * @return void
147 */
148 abstract public function processConfiguration();
149
150 /**
151 * Returns the name of a file/folder based on its identifier.
152 *
153 * @param string $identifier
154 * @return string
155 */
156 protected function getNameFromIdentifier($identifier) {
157 return basename($identifier);
158 }
159
160 /**
161 * Generic handler method for directory listings - gluing together the
162 * listing items is done
163 *
164 * @param string $path
165 * @param integer $start
166 * @param integer $numberOfItems
167 * @param array $filterMethods The filter methods used to filter the directory items
168 * @param string $itemHandlerMethod
169 * @param array $itemRows
170 * @param boolean $recursive
171 * @return array
172 */
173 protected function getDirectoryItemList($path, $start, $numberOfItems, array $filterMethods, $itemHandlerMethod, $itemRows = array(), $recursive = FALSE) {
174
175 }
176
177 /*******************
178 * CAPABILITIES
179 *******************/
180 /**
181 * The capabilities of this driver. See Storage::CAPABILITY_* constants for possible values. This value should be set
182 * in the constructor of derived classes.
183 *
184 * @var integer
185 */
186 protected $capabilities = 0;
187
188 /**
189 * Returns the capabilities of this driver.
190 *
191 * @return integer
192 * @see Storage::CAPABILITY_* constants
193 */
194 public function getCapabilities() {
195 return $this->capabilities;
196 }
197
198 /**
199 * Returns TRUE if this driver has the given capability.
200 *
201 * @param int $capability A capability, as defined in a CAPABILITY_* constant
202 * @return boolean
203 */
204 public function hasCapability($capability) {
205 return $this->capabilities & $capability == $capability;
206 }
207
208 /*******************
209 * FILE FUNCTIONS
210 *******************/
211 /**
212 * Returns a temporary path for a given file, including the file extension.
213 *
214 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
215 * @return string
216 */
217 protected function getTemporaryPathForFile(\TYPO3\CMS\Core\Resource\FileInterface $file) {
218 return \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('fal-tempfile-') . '.' . $file->getExtension();
219 }
220
221 /**
222 * Returns the public URL to a file.
223 *
224 * @abstract
225 * @param \TYPO3\CMS\Core\Resource\ResourceInterface $resource
226 * @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)
227 * @return string
228 */
229 abstract public function getPublicUrl(\TYPO3\CMS\Core\Resource\ResourceInterface $resource, $relativeToCurrentScript = FALSE);
230
231 /**
232 * Returns a list of all hashing algorithms this Storage supports.
233 *
234 * @return array
235 */
236 public function getSupportedHashAlgorithms() {
237 return $this->supportedHashAlgorithms;
238 }
239
240 /**
241 * Creates a (cryptographic) hash for a file.
242 *
243 * @abstract
244 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
245 * @param string $hashAlgorithm The hash algorithm to use
246 * @return string
247 */
248 abstract public function hash(\TYPO3\CMS\Core\Resource\FileInterface $file, $hashAlgorithm);
249
250 /**
251 * Creates a new file and returns the matching file object for it.
252 *
253 * @abstract
254 * @param string $fileName
255 * @param \TYPO3\CMS\Core\Resource\Folder $parentFolder
256 * @return \TYPO3\CMS\Core\Resource\File
257 */
258 abstract public function createFile($fileName, \TYPO3\CMS\Core\Resource\Folder $parentFolder);
259
260 /**
261 * Returns the contents of a file. Beware that this requires to load the
262 * complete file into memory and also may require fetching the file from an
263 * external location. So this might be an expensive operation (both in terms
264 * of processing resources and money) for large files.
265 *
266 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
267 * @return string The file contents
268 */
269 abstract public function getFileContents(\TYPO3\CMS\Core\Resource\FileInterface $file);
270
271 /**
272 * Sets the contents of a file to the specified value.
273 *
274 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
275 * @param string $contents
276 * @return integer The number of bytes written to the file
277 * @throws \RuntimeException if the operation failed
278 */
279 abstract public function setFileContents(\TYPO3\CMS\Core\Resource\FileInterface $file, $contents);
280
281 /**
282 * Adds a file from the local server hard disk to a given path in TYPO3s virtual file system.
283 *
284 * This assumes that the local file exists, so no further check is done here!
285 *
286 * @param string $localFilePath
287 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
288 * @param string $fileName The name to add the file under
289 * @param \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject Optional file object to update (instead of creating a new object). With this parameter, this function can be used to "populate" a dummy file object with a real file underneath.
290 * @return \TYPO3\CMS\Core\Resource\FileInterface
291 */
292 abstract public function addFile($localFilePath, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $fileName, \TYPO3\CMS\Core\Resource\AbstractFile $updateFileObject = NULL);
293
294 /**
295 * Checks if a resource exists - does not care for the type (file or folder).
296 *
297 * @param $identifier
298 * @return boolean
299 */
300 abstract public function resourceExists($identifier);
301
302 /**
303 * Checks if a file exists.
304 *
305 * @abstract
306 * @param string $identifier
307 * @return boolean
308 */
309 abstract public function fileExists($identifier);
310
311 /**
312 * Checks if a file inside a storage folder exists.
313 *
314 * @abstract
315 * @param string $fileName
316 * @param \TYPO3\CMS\Core\Resource\Folder $folder
317 * @return boolean
318 */
319 abstract public function fileExistsInFolder($fileName, \TYPO3\CMS\Core\Resource\Folder $folder);
320
321 /**
322 * Returns a (local copy of) a file for processing it. When changing the
323 * file, you have to take care of replacing the current version yourself!
324 *
325 * @abstract
326 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
327 * @param bool $writable Set this to FALSE if you only need the file for read operations. This might speed up things, e.g. by using a cached local version. Never modify the file if you have set this flag!
328 * @return string The path to the file on the local disk
329 */
330 // TODO decide if this should return a file handle object
331 abstract public function getFileForLocalProcessing(\TYPO3\CMS\Core\Resource\FileInterface $file, $writable = TRUE);
332
333 /**
334 * Returns the permissions of a file as an array (keys r, w) of boolean flags
335 *
336 * @abstract
337 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
338 * @return array
339 */
340 abstract public function getFilePermissions(\TYPO3\CMS\Core\Resource\FileInterface $file);
341
342 /**
343 * Returns the permissions of a folder as an array (keys r, w) of boolean flags
344 *
345 * @abstract
346 * @param \TYPO3\CMS\Core\Resource\Folder $folder
347 * @return array
348 */
349 abstract public function getFolderPermissions(\TYPO3\CMS\Core\Resource\Folder $folder);
350
351 /**
352 * Renames a file
353 *
354 * @abstract
355 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
356 * @param string $newName
357 * @return string The new identifier of the file if the operation succeeds
358 * @throws \RuntimeException if renaming the file failed
359 */
360 abstract public function renameFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $newName);
361
362 /**
363 * Replaces the contents (and file-specific metadata) of a file object with a local file.
364 *
365 * @abstract
366 * @param \TYPO3\CMS\Core\Resource\AbstractFile $file
367 * @param string $localFilePath
368 * @return boolean
369 */
370 abstract public function replaceFile(\TYPO3\CMS\Core\Resource\AbstractFile $file, $localFilePath);
371
372 /**
373 * Returns information about a file for a given file identifier.
374 *
375 * @param string $identifier The (relative) path to the file.
376 * @return array
377 */
378 abstract public function getFileInfoByIdentifier($identifier);
379
380 /**
381 * Returns information about a file for a given file object.
382 *
383 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
384 * @return array
385 */
386 public function getFileInfo(\TYPO3\CMS\Core\Resource\FileInterface $file) {
387 return $this->getFileInfoByIdentifier($file->getIdentifier());
388 }
389
390 /**
391 * Returns a file object by its identifier.
392 *
393 * @param string $identifier
394 * @return \TYPO3\CMS\Core\Resource\FileInterface
395 */
396 public function getFile($identifier) {
397 $fileObject = NULL;
398 if (!$this->fileExists($identifier)) {
399 throw new \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException();
400 }
401 $fileInfo = $this->getFileInfoByIdentifier($identifier);
402 $fileObject = $this->getFileObject($fileInfo);
403 return $fileObject;
404 }
405
406 /**
407 * Creates a file object from a given file data array
408 *
409 * @param array $fileData
410 * @return \TYPO3\CMS\Core\Resource\File
411 */
412 protected function getFileObject(array $fileData) {
413 $fileObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->createFileObject($fileData);
414 return $fileObject;
415 }
416
417 /**
418 * Returns a folder by its identifier.
419 *
420 * @param string $identifier
421 * @return \TYPO3\CMS\Core\Resource\Folder
422 */
423 public function getFolder($identifier) {
424 $name = $this->getNameFromIdentifier($identifier);
425 return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->createFolderObject($this->storage, $identifier, $name);
426 }
427
428 /**
429 * Returns a folder within the given folder. Use this method instead of doing your own string manipulation magic
430 * on the identifiers because non-hierarchical storages might fail otherwise.
431 *
432 * @param $name
433 * @param \TYPO3\CMS\Core\Resource\Folder $parentFolder
434 * @return \TYPO3\CMS\Core\Resource\Folder
435 */
436 abstract public function getFolderInFolder($name, \TYPO3\CMS\Core\Resource\Folder $parentFolder);
437
438 /**
439 * Applies a set of filter methods to a file name to find out if it should be used or not. This is e.g. used by
440 * directory listings.
441 *
442 * @param array $filterMethods The filter methods to use
443 * @param string $itemName
444 * @param string $itemIdentifier
445 * @param string $parentIdentifier
446 * @param array $additionalInformation Additional information about the inspected item
447 * @return boolean
448 */
449 protected function applyFilterMethodsToDirectoryItem(array $filterMethods, $itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation = array()) {
450 foreach ($filterMethods as $filter) {
451 if (is_array($filter)) {
452 $result = call_user_func($filter, $itemName, $itemIdentifier, $parentIdentifier, $additionalInformation, $this);
453 // We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE
454 // If calling the method succeeded and thus we can't use that as a return value.
455 if ($result === -1) {
456 return FALSE;
457 } elseif ($result === FALSE) {
458 throw new \RuntimeException('Could not apply file/folder name filter ' . $filter[0] . '::' . $filter[1]);
459 }
460 }
461 }
462 return TRUE;
463 }
464
465 /**
466 * Returns a list of files inside the specified path
467 *
468 * @param string $path
469 * @param integer $start The position to start the listing; if not set, start from the beginning
470 * @param integer $numberOfItems The number of items to list; if not set, return all items
471 * @param array $filenameFilterCallbacks The method callbacks to use for filtering the items
472 * @param array $fileData Two-dimensional, identifier-indexed array of file index records from the database
473 * @param boolean $recursive
474 * @return array
475 */
476 // TODO add unit tests
477 public function getFileList($path, $start = 0, $numberOfItems = 0, array $filenameFilterCallbacks = array(), $fileData = array(), $recursive = FALSE) {
478 return $this->getDirectoryItemList($path, $start, $numberOfItems, $filenameFilterCallbacks, $this->fileListCallbackMethod, $fileData, $recursive);
479 }
480
481 /**
482 * Copies a file to a temporary path and returns that path.
483 *
484 * @abstract
485 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
486 * @return string The temporary path
487 */
488 abstract public function copyFileToTemporaryPath(\TYPO3\CMS\Core\Resource\FileInterface $file);
489
490 /**
491 * Moves a file *within* the current storage.
492 * Note that this is only about an intra-storage move action, where a file is just
493 * moved to another folder in the same storage.
494 *
495 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
496 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
497 * @param string $fileName
498 * @return string The new identifier of the file
499 */
500 abstract public function moveFileWithinStorage(\TYPO3\CMS\Core\Resource\FileInterface $file, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $fileName);
501
502 /**
503 * Copies a file *within* the current storage.
504 * Note that this is only about an intra-storage copy action, where a file is just
505 * copied to another folder in the same storage.
506 *
507 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
508 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
509 * @param string $fileName
510 * @return \TYPO3\CMS\Core\Resource\FileInterface The new (copied) file object.
511 */
512 abstract public function copyFileWithinStorage(\TYPO3\CMS\Core\Resource\FileInterface $file, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $fileName);
513
514 /**
515 * Folder equivalent to moveFileWithinStorage().
516 *
517 * @param \TYPO3\CMS\Core\Resource\Folder $folderToMove
518 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
519 * @param string $newFolderName
520 * @return array A map of old to new file identifiers
521 */
522 abstract public function moveFolderWithinStorage(\TYPO3\CMS\Core\Resource\Folder $folderToMove, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $newFolderName);
523
524 /**
525 * Folder equivalent to copyFileWithinStorage().
526 *
527 * @param \TYPO3\CMS\Core\Resource\Folder $folderToCopy
528 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
529 * @param string $newFileName
530 * @return boolean
531 */
532 abstract public function copyFolderWithinStorage(\TYPO3\CMS\Core\Resource\Folder $folderToCopy, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $newFileName);
533
534 /**
535 * Move a folder from another storage.
536 *
537 * @param \TYPO3\CMS\Core\Resource\Folder $folderToMove
538 * @param \TYPO3\CMS\Core\Resource\Folder $targetParentFolder
539 * @param string $newFolderName
540 * @throws \BadMethodCallException
541 * @return boolean
542 */
543 public function moveFolderBetweenStorages(\TYPO3\CMS\Core\Resource\Folder $folderToMove, \TYPO3\CMS\Core\Resource\Folder $targetParentFolder, $newFolderName) {
544 // This is not implemented for now as moving files between storages might cause quite some headaches when
545 // something goes wrong. It is also not that common of a use case, so it does not hurt that much to leave it out
546 // for now.
547 throw new \BadMethodCallException('Moving folders between storages is not implemented.');
548 }
549
550 /**
551 * Copy a folder from another storage.
552 *
553 * @param \TYPO3\CMS\Core\Resource\Folder $folderToCopy
554 * @param \TYPO3\CMS\Core\Resource\Folder $targetParentFolder
555 * @param string $newFolderName
556 * @throws \BadMethodCallException
557 * @return boolean
558 */
559 public function copyFolderBetweenStorages(\TYPO3\CMS\Core\Resource\Folder $folderToCopy, \TYPO3\CMS\Core\Resource\Folder $targetParentFolder, $newFolderName) {
560 throw new \BadMethodCallException('Not yet implemented!', 1330262731);
561 }
562
563 /**
564 * Removes a file from this storage. This does not check if the file is
565 * still used or if it is a bad idea to delete it for some other reason
566 * this has to be taken care of in the upper layers (e.g. the Storage)!
567 *
568 * @abstract
569 * @param \TYPO3\CMS\Core\Resource\FileInterface $file
570 * @return boolean TRUE if deleting the file succeeded
571 */
572 abstract public function deleteFile(\TYPO3\CMS\Core\Resource\FileInterface $file);
573
574 /**
575 * Removes a folder from this storage.
576 *
577 * @param \TYPO3\CMS\Core\Resource\Folder $folder
578 * @param boolean $deleteRecursively
579 * @return boolean
580 */
581 abstract public function deleteFolder(\TYPO3\CMS\Core\Resource\Folder $folder, $deleteRecursively = FALSE);
582
583 /**
584 * Adds a file at the specified location. This should only be used internally.
585 *
586 * @abstract
587 * @param string $localFilePath
588 * @param \TYPO3\CMS\Core\Resource\Folder $targetFolder
589 * @param string $targetFileName
590 * @return string The new identifier of the file
591 */
592 // TODO check if this is still necessary if we move more logic to the storage
593 abstract public function addFileRaw($localFilePath, \TYPO3\CMS\Core\Resource\Folder $targetFolder, $targetFileName);
594
595 /**
596 * Deletes a file without access and usage checks.
597 * This should only be used internally.
598 *
599 * This accepts an identifier instead of an object because we might want to
600 * delete files that have no object associated with (or we don't want to
601 * create an object for) them - e.g. when moving a file to another storage.
602 *
603 * @abstract
604 * @param string $identifier
605 * @return boolean TRUE if removing the file succeeded
606 */
607 abstract public function deleteFileRaw($identifier);
608
609 /*******************
610 * FOLDER FUNCTIONS
611 *******************/
612 /**
613 * Returns the root level folder of the storage.
614 *
615 * @abstract
616 * @return \TYPO3\CMS\Core\Resource\Folder
617 */
618 abstract public function getRootLevelFolder();
619
620 /**
621 * Returns the default folder new files should be put into.
622 *
623 * @abstract
624 * @return \TYPO3\CMS\Core\Resource\Folder
625 */
626 abstract public function getDefaultFolder();
627
628 /**
629 * Creates a folder.
630 *
631 * @param string $newFolderName
632 * @param \TYPO3\CMS\Core\Resource\Folder $parentFolder
633 * @return \TYPO3\CMS\Core\Resource\Folder The new (created) folder object
634 */
635 abstract public function createFolder($newFolderName, \TYPO3\CMS\Core\Resource\Folder $parentFolder);
636
637 /**
638 * Returns a list of all folders in a given path
639 *
640 * @param string $path
641 * @param integer $start The position to start the listing; if not set, start from the beginning
642 * @param integer $numberOfItems The number of items to list; if not set, return all items
643 * @param array $foldernameFilterCallbacks The method callbacks to use for filtering the items
644 * @param boolean $recursive
645 * @return array
646 */
647 public function getFolderList($path, $start = 0, $numberOfItems = 0, array $foldernameFilterCallbacks = array(), $recursive = FALSE) {
648 return $this->getDirectoryItemList($path, $start, $numberOfItems, $foldernameFilterCallbacks, $this->folderListCallbackMethod, $recursive);
649 }
650
651 /**
652 * Checks if a folder exists
653 *
654 * @abstract
655 * @param string $identifier
656 * @return boolean
657 */
658 abstract public function folderExists($identifier);
659
660 /**
661 * Checks if a file inside a storage folder exists.
662 *
663 * @abstract
664 * @param string $folderName
665 * @param \TYPO3\CMS\Core\Resource\Folder $folder
666 * @return boolean
667 */
668 abstract public function folderExistsInFolder($folderName, \TYPO3\CMS\Core\Resource\Folder $folder);
669
670 /**
671 * Renames a folder in this storage.
672 *
673 * @param \TYPO3\CMS\Core\Resource\Folder $folder
674 * @param string $newName The target path (including the file name!)
675 * @return array A map of old to new file identifiers
676 * @throws \RuntimeException if renaming the folder failed
677 */
678 abstract public function renameFolder(\TYPO3\CMS\Core\Resource\Folder $folder, $newName);
679
680 /**
681 * Checks if a given object or identifier is within a container, e.g. if
682 * a file or folder is within another folder.
683 * This can e.g. be used to check for webmounts.
684 *
685 * @abstract
686 * @param \TYPO3\CMS\Core\Resource\Folder $container
687 * @param mixed $content An object or an identifier to check
688 * @return boolean TRUE if $content is within $container
689 */
690 abstract public function isWithin(\TYPO3\CMS\Core\Resource\Folder $container, $content);
691
692 /**
693 * Checks if a folder contains files and (if supported) other folders.
694 *
695 * @param \TYPO3\CMS\Core\Resource\Folder $folder
696 * @return boolean TRUE if there are no files and folders within $folder
697 */
698 abstract public function isFolderEmpty(\TYPO3\CMS\Core\Resource\Folder $folder);
699
700 }
701
702
703 ?>