本文整理汇总了PHP中TYPO3\CMS\Core\Resource\ResourceStorage::getRootLevelFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP ResourceStorage::getRootLevelFolder方法的具体用法?PHP ResourceStorage::getRootLevelFolder怎么用?PHP ResourceStorage::getRootLevelFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\ResourceStorage
的用法示例。
在下文中一共展示了ResourceStorage::getRootLevelFolder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processChangesInStorages
/**
* @return void
*/
public function processChangesInStorages()
{
// get all file-identifiers from the storage
$availableFiles = $this->storage->getFileIdentifiersInFolder($this->storage->getRootLevelFolder()->getIdentifier(), TRUE, TRUE);
$this->detectChangedFilesInStorage($availableFiles);
$this->processChangedAndNewFiles();
$this->detectMissingFiles();
}
示例2: getReadablePath
/**
* Returns the full path of this folder, from the root.
*
* @param string $rootId ID of the root folder, NULL to auto-detect
*
* @return string
*/
public function getReadablePath($rootId = null)
{
if ($rootId === null) {
// Find first matching filemount and use that as root
foreach ($this->storage->getFileMounts() as $fileMount) {
if ($this->storage->isWithinFolder($fileMount['folder'], $this)) {
$rootId = $fileMount['folder']->getIdentifier();
break;
}
}
if ($rootId === null) {
$rootId = $this->storage->getRootLevelFolder()->getIdentifier();
}
}
$readablePath = '/';
if ($this->identifier !== $rootId) {
try {
$readablePath = $this->getParentFolder()->getReadablePath($rootId);
} catch (Exception\InsufficientFolderAccessPermissionsException $e) {
// May no access to parent folder (e.g. because of mount point)
$readablePath = '/';
}
}
return $readablePath . ($this->name ? $this->name . '/' : '');
}
示例3: getReadablePath
/**
* Returns the full path of this folder, from the root.
*
* @param string $rootId ID of the root folder, NULL to auto-detect
*
* @return string
*/
public function getReadablePath($rootId = null)
{
if ($rootId === null) {
$rootId = $this->storage->getRootLevelFolder()->getIdentifier();
}
$readablePath = '/';
if ($this->identifier !== $rootId) {
try {
$readablePath = $this->getParentFolder()->getReadablePath($rootId);
} catch (Exception\InsufficientFolderAccessPermissionsException $e) {
// May no access to parent folder (e.g. because of mount point)
$readablePath = '/';
}
}
return $readablePath . ($this->name ? $this->name . '/' : '');
}
示例4: checkPrerequisites
/**
* Ensures a new folder "fileadmin/content_upload/" is available.
*
* @return void
*/
protected function checkPrerequisites()
{
if (!$this->storage->hasFolder(self::FOLDER_ContentUploads)) {
$this->storage->createFolder(self::FOLDER_ContentUploads, $this->storage->getRootLevelFolder());
}
}
示例5: getBrowseableTreeForStorage
/**
* Get a tree for one storage
*
* @param \TYPO3\CMS\Core\Resource\ResourceStorage $storageObject
* @return void
*/
public function getBrowseableTreeForStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
{
// If there are filemounts, show each, otherwise just the rootlevel folder
$fileMounts = $storageObject->getFileMounts();
$rootLevelFolders = array();
if (count($fileMounts)) {
foreach ($fileMounts as $fileMountInfo) {
$rootLevelFolders[] = array('folder' => $fileMountInfo['folder'], 'name' => $fileMountInfo['title']);
}
} elseif ($this->BE_USER->isAdmin()) {
$rootLevelFolders[] = array('folder' => $storageObject->getRootLevelFolder(), 'name' => $storageObject->getName());
}
// Clean the tree
$this->reset();
// Go through all "root level folders" of this tree (can be the rootlevel folder or any file mount points)
foreach ($rootLevelFolders as $rootLevelFolderInfo) {
/** @var $rootLevelFolder \TYPO3\CMS\Core\Resource\Folder */
$rootLevelFolder = $rootLevelFolderInfo['folder'];
$rootLevelFolderName = $rootLevelFolderInfo['name'];
$folderHashSpecUID = GeneralUtility::md5int($rootLevelFolder->getCombinedIdentifier());
$this->specUIDmap[$folderHashSpecUID] = $rootLevelFolder->getCombinedIdentifier();
// Hash key
$storageHashNumber = $this->getShortHashNumberForStorage($storageObject, $rootLevelFolder);
// Set first:
$this->bank = $storageHashNumber;
$isOpen = $this->stored[$storageHashNumber][$folderHashSpecUID] || $this->expandFirst;
// Set PM icon:
$cmd = $this->generateExpandCollapseParameter($this->bank, !$isOpen, $rootLevelFolder);
if (!$storageObject->isBrowsable() || $this->getNumberOfSubfolders($rootLevelFolder) === 0) {
$rootIcon = 'blank';
} elseif (!$isOpen) {
$rootIcon = 'plusonly';
} else {
$rootIcon = 'minusonly';
}
$icon = '<img' . IconUtility::skinImg($this->backPath, 'gfx/ol/' . $rootIcon . '.gif') . ' alt="" />';
// Only link icon if storage is browseable
if (in_array($rootIcon, array('minusonly', 'plusonly'))) {
$firstHtml = $this->PM_ATagWrap($icon, $cmd);
} else {
$firstHtml = $icon;
}
// Mark a storage which is not online, as offline
// maybe someday there will be a special icon for this
if ($storageObject->isOnline() === FALSE) {
$rootLevelFolderName .= ' (' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file.xlf:sys_file_storage.isOffline') . ')';
}
// Preparing rootRec for the mount
$firstHtml .= $this->wrapIcon(IconUtility::getSpriteIconForResource($rootLevelFolder, array('mount-root' => TRUE)), $rootLevelFolder);
$row = array('uid' => $folderHashSpecUID, 'title' => $rootLevelFolderName, 'path' => $rootLevelFolder->getCombinedIdentifier(), 'folder' => $rootLevelFolder);
// Add the storage root to ->tree
$this->tree[] = array('HTML' => $firstHtml, 'row' => $row, 'bank' => $this->bank, 'hasSub' => $isOpen && $storageObject->isBrowsable());
// If the mount is expanded, go down:
if ($isOpen && $storageObject->isBrowsable()) {
// Set depth:
$this->getFolderTree($rootLevelFolder, 999);
}
}
}
示例6: getBrowseableTreeForStorage
/**
* Get a tree for one storage
*
* @param \TYPO3\CMS\Core\Resource\ResourceStorage $storageObject
* @return void
*/
public function getBrowseableTreeForStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
{
// If there are filemounts, show each, otherwise just the rootlevel folder
$fileMounts = $storageObject->getFileMounts();
$rootLevelFolders = array();
if (!empty($fileMounts)) {
foreach ($fileMounts as $fileMountInfo) {
$rootLevelFolders[] = array('folder' => $fileMountInfo['folder'], 'name' => $fileMountInfo['title']);
}
} elseif ($this->BE_USER->isAdmin()) {
$rootLevelFolders[] = array('folder' => $storageObject->getRootLevelFolder(), 'name' => $storageObject->getName());
}
// Clean the tree
$this->reset();
// Go through all "root level folders" of this tree (can be the rootlevel folder or any file mount points)
foreach ($rootLevelFolders as $rootLevelFolderInfo) {
/** @var $rootLevelFolder \TYPO3\CMS\Core\Resource\Folder */
$rootLevelFolder = $rootLevelFolderInfo['folder'];
$rootLevelFolderName = $rootLevelFolderInfo['name'];
$folderHashSpecUID = GeneralUtility::md5int($rootLevelFolder->getCombinedIdentifier());
$this->specUIDmap[$folderHashSpecUID] = $rootLevelFolder->getCombinedIdentifier();
// Hash key
$storageHashNumber = $this->getShortHashNumberForStorage($storageObject, $rootLevelFolder);
// Set first:
$this->bank = $storageHashNumber;
$isOpen = $this->stored[$storageHashNumber][$folderHashSpecUID] || $this->expandFirst;
// Set PM icon:
$cmd = $this->generateExpandCollapseParameter($this->bank, !$isOpen, $rootLevelFolder);
// Only show and link icon if storage is browseable
if (!$storageObject->isBrowsable() || $this->getNumberOfSubfolders($rootLevelFolder) === 0) {
$firstHtml = '';
} else {
$firstHtml = $this->renderPMIconAndLink($cmd, $isOpen);
}
// Mark a storage which is not online, as offline
// maybe someday there will be a special icon for this
if ($storageObject->isOnline() === false) {
$rootLevelFolderName .= ' (' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file.xlf:sys_file_storage.isOffline') . ')';
}
// Preparing rootRec for the mount
$icon = $this->iconFactory->getIconForResource($rootLevelFolder, Icon::SIZE_SMALL, null, array('mount-root' => true));
$firstHtml .= $this->wrapIcon($icon, $rootLevelFolder);
$row = array('uid' => $folderHashSpecUID, 'title' => $rootLevelFolderName, 'path' => $rootLevelFolder->getCombinedIdentifier(), 'folder' => $rootLevelFolder);
// Add the storage root to ->tree
$this->tree[] = array('HTML' => $firstHtml, 'row' => $row, 'bank' => $this->bank, 'hasSub' => $isOpen && $storageObject->isBrowsable(), 'invertedDepth' => 1000);
// If the mount is expanded, go down:
if ($isOpen && $storageObject->isBrowsable()) {
// Set depth:
$this->getFolderTree($rootLevelFolder, 999);
}
}
}
示例7: getBrowseableTreeForStorage
/**
* Get a tree for one storage
*
* @param \TYPO3\CMS\Core\Resource\ResourceStorage $storageObject
* @return void
*/
public function getBrowseableTreeForStorage(\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
{
// If there are filemounts, show each, otherwise just the rootlevel folder
$fileMounts = $storageObject->getFileMounts();
$rootLevelFolders = array();
if (!empty($fileMounts)) {
foreach ($fileMounts as $fileMountInfo) {
$rootLevelFolders[] = array('folder' => $fileMountInfo['folder'], 'name' => $fileMountInfo['title']);
}
} elseif ($this->BE_USER->isAdmin()) {
$rootLevelFolders[] = array('folder' => $storageObject->getRootLevelFolder(), 'name' => $storageObject->getName());
}
// Clean the tree
$this->reset();
// Go through all "root level folders" of this tree (can be the rootlevel folder or any file mount points)
foreach ($rootLevelFolders as $rootLevelFolderInfo) {
/** @var $rootLevelFolder \TYPO3\CMS\Core\Resource\Folder */
$rootLevelFolder = $rootLevelFolderInfo['folder'];
$rootLevelFolderName = $rootLevelFolderInfo['name'];
$folderHashSpecUID = GeneralUtility::md5int($rootLevelFolder->getCombinedIdentifier());
$this->specUIDmap[$folderHashSpecUID] = $rootLevelFolder->getCombinedIdentifier();
// Hash key
$storageHashNumber = $this->getShortHashNumberForStorage($storageObject, $rootLevelFolder);
// Set first:
$this->bank = $storageHashNumber;
$isOpen = $this->stored[$storageHashNumber][$folderHashSpecUID] || $this->expandFirst;
// Set PM icon:
$cmd = $this->generateExpandCollapseParameter($this->bank, !$isOpen, $rootLevelFolder);
if (!$storageObject->isBrowsable() || $this->getNumberOfSubfolders($rootLevelFolder) === 0) {
$firstHtml = '';
} else {
// Only show and link icon if storage is browseable
$link = '';
if ($this->thisScript) {
$link = ' href="' . htmlspecialchars($this->getThisScript() . 'PM=' . $cmd) . '"';
}
$firstHtml = '<a class="list-tree-control list-tree-control-' . ($isOpen ? 'open' : 'closed') . '"' . $link . '><i class="fa"></i></a>';
}
// Mark a storage which is not online, as offline
// maybe someday there will be a special icon for this
if ($storageObject->isOnline() === FALSE) {
$rootLevelFolderName .= ' (' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_mod_file.xlf:sys_file_storage.isOffline') . ')';
}
// Preparing rootRec for the mount
$firstHtml .= $this->wrapIcon(IconUtility::getSpriteIconForResource($rootLevelFolder, array('mount-root' => TRUE)), $rootLevelFolder);
$row = array('uid' => $folderHashSpecUID, 'title' => $rootLevelFolderName, 'path' => $rootLevelFolder->getCombinedIdentifier(), 'folder' => $rootLevelFolder);
// Add the storage root to ->tree
$this->tree[] = array('HTML' => $firstHtml, 'row' => $row, 'bank' => $this->bank, 'hasSub' => $isOpen && $storageObject->isBrowsable());
// If the mount is expanded, go down:
if ($isOpen && $storageObject->isBrowsable()) {
// Set depth:
$this->getFolderTree($rootLevelFolder, 999);
}
}
}
示例8: checkPrerequisites
/**
* Ensures a new folder "fileadmin/content_upload/" is available.
*
* @return void
*/
protected function checkPrerequisites()
{
if (!$this->storage->hasFolder(self::FILE_MIGRATION_FOLDER)) {
$this->storage->createFolder(self::FILE_MIGRATION_FOLDER, $this->storage->getRootLevelFolder());
}
}
示例9: getDefaultFolderInStorage
/**
* Return a new target folder when moving file from one storage to another.
*
* @param ResourceStorage $storage
* @param File $file
* @return \TYPO3\CMS\Core\Resource\Folder
*/
public function getDefaultFolderInStorage(ResourceStorage $storage, File $file)
{
// default is the root level
$folder = $storage->getRootLevelFolder();
// Retrieve storage record and a possible configured mount point.
$storageRecord = $storage->getStorageRecord();
$mountPointIdentifier = $storageRecord['mount_point_file_type_' . $file->getType()];
if ($mountPointIdentifier > 0) {
// We don't have a Mount Point repository in FAL, so query the database directly.
$record = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('path', 'sys_filemounts', 'deleted = 0 AND uid = ' . $mountPointIdentifier);
if (!empty($record['path'])) {
$folder = $storage->getFolder($record['path']);
}
}
return $folder;
}
示例10: checkPrerequisites
/**
* Ensures a new folder "fileadmin/content_upload/" is available.
*
* @return void
*/
protected function checkPrerequisites()
{
if (!$this->storage->hasFolder(\TYPO3\CMS\Install\Updates\TtContentUploadsUpdateWizard::FOLDER_ContentUploads)) {
$this->storage->createFolder(\TYPO3\CMS\Install\Updates\TtContentUploadsUpdateWizard::FOLDER_ContentUploads, $this->storage->getRootLevelFolder());
}
}