当前位置: 首页>>代码示例>>PHP>>正文


PHP FileInterface::getParentFolder方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Resource\FileInterface::getParentFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInterface::getParentFolder方法的具体用法?PHP FileInterface::getParentFolder怎么用?PHP FileInterface::getParentFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Resource\FileInterface的用法示例。


在下文中一共展示了FileInterface::getParentFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPath

 /**
  * @return string
  */
 public function getPath()
 {
     $method = 'getReadablePath';
     if (is_callable([$this->resource->getParentFolder(), $method])) {
         return call_user_func([$this->resource->getParentFolder(), $method]);
     }
     return '';
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:11,代码来源:FileFacade.php

示例2: moveFile

 /**
  * Moves a $file into a $targetFolder
  * the target folder has to be part of this storage
  *
  * previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::func_move()
  *
  * @param FileInterface $file
  * @param Folder $targetFolder
  * @param string $targetFileName an optional destination fileName
  * @param string $conflictMode a value of the DuplicationBehavior enumeration
  *
  * @throws Exception\ExistingTargetFileNameException
  * @throws \RuntimeException
  * @return FileInterface
  */
 public function moveFile($file, $targetFolder, $targetFileName = null, $conflictMode = DuplicationBehavior::RENAME)
 {
     $conflictMode = DuplicationBehavior::cast($conflictMode);
     if ($targetFileName === null) {
         $targetFileName = $file->getName();
     }
     $originalFolder = $file->getParentFolder();
     $sanitizedTargetFileName = $this->driver->sanitizeFileName($targetFileName);
     $this->assureFileMovePermissions($file, $targetFolder, $sanitizedTargetFileName);
     if ($targetFolder->hasFile($sanitizedTargetFileName)) {
         // File exists and we should abort, let's abort
         if ($conflictMode->equals(DuplicationBehavior::RENAME)) {
             $sanitizedTargetFileName = $this->getUniqueName($targetFolder, $sanitizedTargetFileName);
         } elseif ($conflictMode->equals(DuplicationBehavior::CANCEL)) {
             throw new Exception\ExistingTargetFileNameException('The target file already exists', 1329850997);
         }
     }
     $this->emitPreFileMoveSignal($file, $targetFolder);
     $sourceStorage = $file->getStorage();
     // Call driver method to move the file and update the index entry
     try {
         if ($sourceStorage === $this) {
             $newIdentifier = $this->driver->moveFileWithinStorage($file->getIdentifier(), $targetFolder->getIdentifier(), $sanitizedTargetFileName);
             if (!$file instanceof AbstractFile) {
                 throw new \RuntimeException('The given file is not of type AbstractFile.', 1384209025);
             }
             $file->updateProperties(array('identifier' => $newIdentifier));
         } else {
             $tempPath = $file->getForLocalProcessing();
             $newIdentifier = $this->driver->addFile($tempPath, $targetFolder->getIdentifier(), $sanitizedTargetFileName);
             $sourceStorage->driver->deleteFile($file->getIdentifier());
             if ($file instanceof File) {
                 $file->updateProperties(array('storage' => $this->getUid(), 'identifier' => $newIdentifier));
             }
         }
         $this->getIndexer()->updateIndexEntry($file);
     } catch (\TYPO3\CMS\Core\Exception $e) {
         echo $e->getMessage();
     }
     $this->emitPostFileMoveSignal($file, $targetFolder, $originalFolder);
     return $file;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:57,代码来源:ResourceStorage.php

示例3: preFileDelete

 /**
  * Pre file delete
  *
  * @param FileInterface $file The file
  *
  * @return void
  */
 public function preFileDelete(FileInterface $file)
 {
     $this->flushCacheForAffectedPages($file->getParentFolder());
 }
开发者ID:vertexvaar,项目名称:fal_gallery,代码行数:11,代码来源:FileMutationSlot.php


注:本文中的TYPO3\CMS\Core\Resource\FileInterface::getParentFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。