/**
  * Processes the file
  *
  * @param Resource\ProcessedFile $processedFile
  * @param Resource\ResourceStorage $targetStorage The storage to put the processed file into
  *
  * @throws \RuntimeException
  */
 protected function process(Resource\ProcessedFile $processedFile, Resource\ResourceStorage $targetStorage)
 {
     $targetFolder = $targetStorage->getProcessingFolder();
     if (!is_object($targetFolder)) {
         throw new \RuntimeException('Could not get processing folder for storage ' . $this->storage->getName(), 1350514301);
     }
     // We only have to trigger the file processing if the file either is new, does not exist or the
     // original file has changed since the last processing run (the last case has to trigger a reprocessing
     // even if the original file was used until now)
     if ($processedFile->isNew() || !$processedFile->usesOriginalFile() && !$processedFile->exists() || $processedFile->isOutdated()) {
         $task = $processedFile->getTask();
         /** @var $processor Resource\Processing\LocalImageProcessor */
         $processor = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Processing\\LocalImageProcessor');
         $processor->processTask($task);
         if ($processedFile->isProcessed()) {
             /** @var $processedFileRepository Resource\ProcessedFileRepository */
             $processedFileRepository = Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ProcessedFileRepository');
             $processedFileRepository->add($processedFile);
         }
     }
 }
Exemple #2
0
 /**
  * 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);
         }
     }
 }
Exemple #3
0
 /**
  * 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);
         }
     }
 }
 /**
  * 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);
         }
     }
 }