/** * Returns TRUE if the specified file exists. * * @param string $identifier * @return bool */ public function hasFile($identifier) { // Allow if identifier is in processing folder if (!$this->driver->isWithin($this->getProcessingFolder()->getIdentifier(), $identifier)) { $this->assureFolderReadPermission(); } return $this->driver->fileExists($identifier); }
/** * Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::deleteFile() * * @param FileInterface $fileObject * @throws Exception\InsufficientFileAccessPermissionsException * @throws Exception\FileOperationErrorException * @return bool TRUE if deletion succeeded */ public function deleteFile($fileObject) { $this->assureFileDeletePermissions($fileObject); $this->emitPreFileDeleteSignal($fileObject); if ($this->driver->fileExists($fileObject->getIdentifier())) { $result = $this->driver->deleteFile($fileObject->getIdentifier()); if (!$result) { throw new Exception\FileOperationErrorException('Deleting the file "' . $fileObject->getIdentifier() . '\' failed.', 1329831691); } } // Mark the file object as deleted if ($fileObject instanceof File) { $fileObject->setDeleted(); } $this->emitPostFileDeleteSignal($fileObject); return true; }
/** * Entry method for use as filelist filter. * * We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE * if calling the method failed and thus we can't use that as a return value. * * @param string $itemName * @param string $itemIdentifier * @param string $parentIdentifier * @param array $additionalInformation Additional information about the inspected item * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver * @return bool|int -1 if the file should not be included in a listing */ public function filterFileList($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver) { $returnCode = true; // Early return in case no file filters are set at all if ($this->allowedFileExtensions === null && $this->disallowedFileExtensions === null) { return $returnCode; } // Check that this is a file and not a folder if ($driver->fileExists($itemIdentifier)) { if (!$this->isAllowed($itemName)) { $returnCode = -1; } } return $returnCode; }