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


PHP Folder::getSubfolder方法代码示例

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


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

示例1: postFolderMove

 /**
  * Update folder permissions records when folder is moved
  *
  * @param Folder $folder
  * @param Folder $targetFolder
  * @param string $newName
  */
 public function postFolderMove(Folder $folder, Folder $targetFolder, $newName)
 {
     $newFolder = $targetFolder->getSubfolder($newName);
     $oldStorageUid = $folder->getStorage()->getUid();
     $newStorageUid = $newFolder->getStorage()->getUid();
     $this->utilityService->updateFolderRecord($oldStorageUid, $folder->getHashedIdentifier(), $folder->getIdentifier(), array('storage' => $newStorageUid, 'folder_hash' => $newFolder->getHashedIdentifier(), 'folder' => $newFolder->getIdentifier()));
     if (!empty($this->folderMapping[$folder->getCombinedIdentifier()])) {
         $newMapping = $this->getSubFolderIdentifiers($newFolder);
         foreach ($this->folderMapping[$folder->getCombinedIdentifier()] as $key => $folderInfo) {
             $this->utilityService->updateFolderRecord($oldStorageUid, $folderInfo[0], $folderInfo[1], array('storage' => $newStorageUid, 'folder_hash' => $newMapping[$key][0], 'folder' => $newMapping[$key][1]));
         }
     }
 }
开发者ID:camrun91,项目名称:fal_securedownload,代码行数:20,代码来源:FolderChangedSlot.php

示例2: writeSysFileResourceForLegacyImport

 /**
  * Writes the file with the is $fileId to the legacy import folder. The file name will used from
  * argument $fileName and the file was successfully created or an identical file was already found,
  * $fileName will held the uid of the new created file record.
  *
  * @param string $fileName The file name for the new file. Value would be changed to the uid of the new created file record.
  * @param int $fileId The id of the file in data array
  * @return bool
  */
 protected function writeSysFileResourceForLegacyImport(&$fileName, $fileId)
 {
     if ($this->legacyImportFolder === null) {
         return false;
     }
     if (!isset($this->dat['files'][$fileId])) {
         $this->error('ERROR: File ID "' . $fileId . '" could not be found');
         return false;
     }
     $temporaryFile = $this->writeTemporaryFileFromData($fileId, 'files');
     if ($temporaryFile === null) {
         // error on writing the file. Error message was already added
         return false;
     }
     $importFolder = $this->legacyImportFolder;
     if (isset($this->dat['files'][$fileId]['relFileName'])) {
         $relativeFilePath = PathUtility::dirname($this->dat['files'][$fileId]['relFileName']);
         if (!$this->legacyImportFolder->hasFolder($relativeFilePath)) {
             $this->legacyImportFolder->createFolder($relativeFilePath);
         }
         $importFolder = $this->legacyImportFolder->getSubfolder($relativeFilePath);
     }
     $fileObject = null;
     try {
         // check, if there is alreay the same file in the folder
         if ($importFolder->hasFile($fileName)) {
             $fileStorage = $importFolder->getStorage();
             $file = $fileStorage->getFile($importFolder->getIdentifier() . $fileName);
             if ($file->getSha1() === sha1_file($temporaryFile)) {
                 $fileObject = $file;
             }
         }
     } catch (Exception $e) {
     }
     if ($fileObject === null) {
         try {
             $fileObject = $importFolder->addFile($temporaryFile, $fileName, DuplicationBehavior::RENAME);
         } catch (Exception $e) {
             $this->error('Error: no file could be added to the storage for file name ' . $this->alternativeFileName[$temporaryFile]);
         }
     }
     if (md5_file(PATH_site . $fileObject->getPublicUrl()) == $this->dat['files'][$fileId]['content_md5']) {
         $fileName = $fileObject->getUid();
         $this->fileIDMap[$fileId] = $fileName;
         $this->filePathMap[$fileId] = $fileObject->getPublicUrl();
         return true;
     } else {
         $this->error('ERROR: File content "' . $this->dat['files'][$fileId]['relFileName'] . '" was corrupted');
     }
     return false;
 }
开发者ID:amazingh,项目名称:TYPO3.CMS,代码行数:60,代码来源:Import.php


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