Ejemplo n.º 1
0
 /**
  * This is the main method that is called when a task is executed
  * It MUST be implemented by all classes inheriting from this one
  * Note that there is no error handling, errors and failures are expected
  * to be handled and logged by the client implementations.
  * Should return TRUE on successful execution, FALSE on error.
  *
  * @return boolean Returns TRUE on successful execution, FALSE on error
  */
 public function execute()
 {
     $selectedResolutionConfigCollection = $this->getSelectedResolutionConfigs();
     $itemRepository = $this->objectManager->get('Tx_Yag_Domain_Repository_ItemRepository');
     /** @var $itemRepository \Tx_Yag_Domain_Repository_ItemRepository */
     $resolutionFileCache = \Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance();
     /** @var  $resolutionFileCache \Tx_Yag_Domain_FileSystem_ResolutionFileCache */
     $items = $itemRepository->findImagesWithUnRenderedResolutions($selectedResolutionConfigCollection, $this->imagesPerRun);
     foreach ($items as $item) {
         $resolutionFileCache->buildResolutionFilesForItem($item, $selectedResolutionConfigCollection);
         $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface')->persistAll();
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * Factory method for file repository
  *
  * @return Tx_Yag_Domain_FileSystem_ResolutionFileCache
  */
 public static function getInstance()
 {
     $configurationBuilder = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance();
     if (self::$instance === NULL) {
         $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager  */
         self::$instance = $objectManager->get('Tx_Yag_Domain_FileSystem_ResolutionFileCache', $objectManager);
         $hashFileSystem = Tx_Yag_Domain_FileSystem_HashFileSystemFactory::getInstance();
         self::$instance->_injectHashFileSystem($hashFileSystem);
         $imageProcessor = Tx_Yag_Domain_ImageProcessing_ProcessorFactory::getInstance($configurationBuilder);
         self::$instance->_injectImageProcessor($imageProcessor);
         self::$instance->_injectConfigurationBuilder(Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance());
     }
     return self::$instance;
 }
Ejemplo n.º 3
0
 /**
  * Show a an unCached itemList
  *
  * @return void
  */
 public function unCachedListAction()
 {
     $this->extListContext->getPagerCollection()->setItemCount($this->extListContext->getDataBackend()->getTotalItemsCount());
     $this->view->assign('filterBoxCollection', $this->extListContext->getFilterBoxCollection());
     $this->view->assign('listData', $this->extListContext->getRenderedListData());
     $this->view->assign('pagerCollection', $this->extListContext->getPagerCollection());
     $this->view->assign('pager', $this->extListContext->getPager($this->configurationBuilder->buildItemListConfiguration()->getPagerIdentifier()));
     Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance()->preloadCacheForItemsAndTheme($this->extListContext->getRenderedListData(), $this->configurationBuilder->buildThemeConfiguration());
 }
Ejemplo n.º 4
0
 /**
  * Show the maintenance overview
  */
 public function maintenanceOverviewAction()
 {
     /**
      * Check if an update is available
      */
     if ($this->dbUpgradeUtility->getAvailableUpdateMethod() != '') {
         $this->forward('dbUpdateNeeded');
     }
     $itemRepository = $this->objectManager->get('Tx_Yag_Domain_Repository_ItemRepository');
     /* @var $itemRepository Tx_Yag_Domain_Repository_ItemRepository */
     $galleryCount = $this->objectManager->get('Tx_Yag_Domain_Repository_GalleryRepository')->countAll();
     $albumCount = $this->objectManager->get('Tx_Yag_Domain_Repository_AlbumRepository')->countAll();
     $itemCount = $itemRepository->countAll();
     $itemSizeSum = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($itemRepository->getItemSizeSum());
     $includedCount = $this->objectManager->get('Tx_Yag_Domain_Repository_Extern_TTContentRepository')->countAllYagInstances();
     $firstItem = $itemRepository->getItemsAfterThisItem();
     if ($firstItem) {
         $firstItemUid = $firstItem->getUid();
     }
     $resolutionFileCache = Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance();
     $this->view->assign('folderStatistics', array('galleryCount' => $galleryCount, 'albumCount' => $albumCount, 'itemCount' => $itemCount));
     $this->view->assign('globalStatistics', array('show' => $GLOBALS['BE_USER']->isAdmin(), 'itemSizeSum' => $itemSizeSum));
     $this->view->assign('firstItemUid', $firstItemUid);
     $this->view->assign('includedCount', $includedCount);
     $this->view->assign('resolutionFileCache', $resolutionFileCache);
 }
Ejemplo n.º 5
0
 /**
  * @param $listData
  */
 protected function preloadResolutionCache($listData)
 {
     Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance()->preloadCacheForItemsAndTheme($listData, $this->configurationBuilder->buildThemeConfiguration());
 }
Ejemplo n.º 6
0
 /**
  * Get image path by resolution config
  *
  * @param Tx_Yag_Domain_Configuration_Image_ResolutionConfig $resolutionConfig
  * @return Tx_Yag_Domain_Model_ResolutionFileCache
  */
 public function getResolutionByConfig($resolutionConfig)
 {
     if ($resolutionConfig != null) {
         return Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance()->getItemFileResolutionPathByConfiguration($this, $resolutionConfig);
     } else {
         return $this->getOriginalResolution();
     }
 }
 /**
  * @return void
  */
 public function postInitializeAction()
 {
     $this->resolutionFileCache = Tx_Yag_Domain_FileSystem_ResolutionFileCacheFactory::getInstance();
 }