コード例 #1
0
 /**
  * Initializes the cache for this command.
  *
  * @return void
  */
 protected function initializeCache()
 {
     try {
         $this->cacheInstance = $this->cacheManager->getCache('tx_solr');
     } catch (NoSuchCacheException $e) {
         $this->cacheInstance = $this->cacheFactory->create('tx_solr', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['options']);
     }
 }
コード例 #2
0
 /**
  * Initialize cache
  *
  * @return void
  */
 protected function initializeCache()
 {
     $this->cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     try {
         $this->frontend = $this->cacheManager->getCache('cartography_cache');
     } catch (NoSuchCacheException $e) {
     }
 }
コード例 #3
0
ファイル: Cache.php プロジェクト: steffmeister/typo3-forum
 /**
  *
  */
 public function initializeObject()
 {
     try {
         $this->cacheInstance = $this->cacheManager->getCache(self::CACHE_NAME);
     } catch (NoSuchCacheException $e) {
         $this->cacheInstance = $this->cacheFactory->create(self::CACHE_NAME, $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['typo3forum_main']['options']);
     }
 }
コード例 #4
0
ファイル: Limbo.php プロジェクト: electricretina/cicbase
 /**
  * Returns the cache object
  * @return mixed
  * @throws \Exception
  */
 protected function getCache()
 {
     try {
         $cache = $this->cacheManager->getCache('cicbase_cache');
     } catch (\TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException $e) {
         throw new \Exception('Unable to load the cicbase cache.');
     }
     return $cache;
 }
コード例 #5
0
 /**
  * Returns a cache instance.
  *
  * @param  string $name Name of the cache. Must be one of the class' constants.
  * @return FrontendInterface
  */
 public static function getCacheInstance($name)
 {
     if (!self::$cacheManager) {
         self::$cacheManager = Core::getObjectManager()->get(TYPO3CacheManager::class);
     }
     $cacheInstance = null;
     switch ($name) {
         case self::CACHE_MAIN:
         case self::CACHE_PROCESSED:
             $cacheInstance = self::$cacheManager->getCache($name);
     }
     return $cacheInstance;
 }
コード例 #6
0
 /**
  * @return NULL
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (TRUE === $hasCache) {
         return;
     }
     $templates = $this->getAllRootTypoScriptTemplates();
     $paths = $this->getPathConfigurationsFromRootTypoScriptTemplates($templates);
     $pageTsConfig = '';
     $this->backupPageUidForConfigurationManager();
     foreach ($paths as $pageUid => $collection) {
         if (FALSE === $collection) {
             continue;
         }
         try {
             $this->overrideCurrentPageUidForConfigurationManager($pageUid);
             $wizardTabs = $this->buildAllWizardTabGroups($collection);
             $collectionPageTsConfig = $this->buildAllWizardTabsPageTsConfig($wizardTabs);
             $pageTsConfig .= '[PIDinRootline = ' . strval($pageUid) . ']' . LF;
             $pageTsConfig .= $collectionPageTsConfig . LF;
             $pageTsConfig .= '[GLOBAL]' . LF;
             $this->message('Built content setup for page ' . $pageUid, GeneralUtility::SYSLOG_SEVERITY_INFO, 'Fluidcontent');
         } catch (\Exception $error) {
             $this->debug($error);
         }
     }
     $this->restorePageUidForConfigurationManager();
     $cache->set('pageTsConfig', $pageTsConfig, array(), 806400);
     return NULL;
 }
コード例 #7
0
ファイル: Bootstrap.php プロジェクト: khanhdeux/typo3test
 /**
  * Initializes the Reflection Service
  *
  * @return void
  * @see initialize()
  */
 protected function initializeReflection()
 {
     $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection'));
     if (!$this->reflectionService->isInitialized()) {
         $this->reflectionService->initialize();
     }
 }
コード例 #8
0
 /**
  * @param string $classFile
  * @param string $className
  * @param bool $triggerRequire
  */
 protected function writeCacheEntryForClass($className, $classFile, $triggerRequire = FALSE)
 {
     $classesCache = $this->cacheManager->getCache('cache_classes');
     $cacheEntryIdentifier = strtolower(str_replace('\\', '_', $className));
     $classLoadingInformation = array($classFile, strtolower($className));
     if (!$classesCache->has($cacheEntryIdentifier)) {
         $classesCache->set($cacheEntryIdentifier, implode("ÿ", $classLoadingInformation));
     }
 }
コード例 #9
0
 /**
  * @return void
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (FALSE === $hasCache) {
         $cache->set('pageTsConfig', $this->getPageTsConfig(), array(), 86400);
     }
 }
コード例 #10
0
ファイル: Dropbox.php プロジェクト: wmdbsystems/fal_dropbox
 /**
  * Initializes this object. This is called by the storage after the driver
  * has been attached.
  *
  * @return void
  */
 public function initialize()
 {
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->cacheManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     $this->cache = $this->cacheManager->getCache('fal_dropbox');
     if (!empty($this->configuration['accessToken'])) {
         $this->dropboxClient = $this->objectManager->get('SFroemken\\FalDropbox\\Dropbox\\Client', $this->configuration['accessToken'], 'TYPO3 CMS');
     } else {
         $this->dropboxClient = NULL;
     }
 }
コード例 #11
0
ファイル: Cache.php プロジェクト: khanhdeux/typo3test
 /**
  * Helper method for install tool and extension manager to determine
  * required table structure of all caches that depend on it
  *
  * This is not a public API method!
  *
  * @return string Required table structure of all registered caches
  */
 public static function getDatabaseTableDefinitions()
 {
     $tableDefinitions = '';
     foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $cacheName => $_) {
         $backend = self::$cacheManager->getCache($cacheName)->getBackend();
         if (method_exists($backend, 'getTableDefinitions')) {
             $tableDefinitions .= LF . $backend->getTableDefinitions();
         }
     }
     return $tableDefinitions;
 }
コード例 #12
0
ファイル: LabelManager.php プロジェクト: 3ev/tev_label
 /**
  * Get the cache to retrieve labels.
  *
  * @return \TYPO3\CMS\Core\Cache\Cache
  */
 private function getCache()
 {
     if ($this->cache === null) {
         try {
             $this->cache = $this->cacheManager->getCache('tev_label_label_cache');
         } catch (NoSuchCacheException $e) {
             $this->cache = $this->cacheFactory->create('tev_label_label_cache', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tev_label_label_cache']['options']);
         }
     }
     return $this->cache;
 }
コード例 #13
0
 /**
  * @return void
  */
 protected function initializeExtbaseFramework()
 {
     // initialize cache manager
     $this->cacheManager = $GLOBALS['typo3CacheManager'];
     // inject content object into the configuration manager
     $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->configurationManager->setContentObject($contentObject);
     $this->typoScriptService->makeTypoScriptBackup();
     // load extbase typoscript
     TypoScriptService::loadTypoScriptFromFile('EXT:extbase/ext_typoscript_setup.txt');
     TypoScriptService::loadTypoScriptFromFile('EXT:ap_ldap_auth/ext_typoscript_setup.txt');
     $this->configurationManager->setConfiguration($GLOBALS['TSFE']->tmpl->setup);
     $this->configureObjectManager();
     // initialize reflection
     $this->reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection'));
     if (!$this->reflectionService->isInitialized()) {
         $this->reflectionService->initialize();
     }
     // initialize persistence
     $this->persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
 }
コード例 #14
0
 /**
  * @return void
  */
 public function writeCachedConfigurationIfMissing()
 {
     /** @var StringFrontend $cache */
     $cache = $this->manager->getCache('fluidcontent');
     $hasCache = $cache->has('pageTsConfig');
     if (FALSE === $hasCache) {
         $pageTsConfig = '';
         $templates = $this->getAllRootTypoScriptTemplates();
         foreach ($templates as $template) {
             $pageUid = (int) $template['pid'];
             $pageTsConfig .= $this->renderPageTypoScriptForPageUid($pageUid);
         }
         $cache->set('pageTsConfig', $pageTsConfig, array(), 86400);
     }
 }
コード例 #15
0
 /**
  * Get schema SQL of required cache framework tables.
  *
  * This method needs ext_localconf and ext_tables loaded!
  *
  * @return string Cache framework SQL
  */
 public function getCachingFrameworkRequiredDatabaseSchema()
 {
     // Use new to circumvent the singleton pattern of CacheManager
     $cacheManager = new CacheManager();
     $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     // Cache manager needs cache factory. cache factory injects itself to manager in __construct()
     new CacheFactory('production', $cacheManager);
     $tableDefinitions = '';
     foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $cacheName => $_) {
         $backend = $cacheManager->getCache($cacheName)->getBackend();
         if (method_exists($backend, 'getTableDefinitions')) {
             $tableDefinitions .= LF . $backend->getTableDefinitions();
         }
     }
     return $tableDefinitions;
 }
コード例 #16
0
 /**
  * @param \TYPO3\CMS\Core\Cache\CacheManager $cacheManager
  * @return void
  */
 public function injectCacheManager(\TYPO3\CMS\Core\Cache\CacheManager $cacheManager)
 {
     $this->tokenCache = $cacheManager->getCache('hairu_token');
 }
コード例 #17
0
 /**
  * Construct
  *
  * @param CacheManager $cacheManager Application CacheManager
  *
  * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException The application
  * caching framework will throw this exception if the specified cache isn't
  * properly configured.
  */
 public function __construct(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('cache_hash');
 }
コード例 #18
0
 /**
  * Initializes the cache and determines caching method.
  *
  * @author  Martin Helmich <*****@*****.**>
  * @version 2008-10-11
  * @param   string $mode The caching mode. This may either be 'auto',
  *                       'apc','database','file' or 'none' (see above).
  * @param array $configuration
  * @throws Exception
  */
 function init($mode = 'auto', $configuration = array())
 {
     /* If mode is set to 'auto' or 'apc', first try to set mode
      * to APC (if enabled) or otherwise to database. */
     if ($mode == 'auto' || $mode == 'apc') {
         if ($this->getAPCEnabled()) {
             $useMode = 'apc';
         } else {
             $useMode = 'database';
         }
         /* If mode is set to 'file',... */
     } elseif ($mode == 'file') {
         $useMode = 'file';
     } elseif ($mode == 'none') {
         $useMode = 'none';
     } else {
         $useMode = 'database';
     }
     /* Compose class name and instantiate */
     if (isset($GLOBALS['typo3CacheManager'])) {
         $this->useTYPO3Cache = TRUE;
         if ($useMode == 'database') {
             $this->cacheObj =& $this->typo3CacheManager->getCache('cache_hash');
         } else {
             if ($this->typo3CacheManager->hasCache('mm_forum')) {
                 $this->cacheObj =& $this->typo3CacheManager->getCache('mm_forum');
             } else {
                 switch ($useMode) {
                     case 'database':
                         $className = 't3lib_cache_backend_DbBackend';
                         break;
                     case 'apc':
                         $className = 't3lib_cache_backend_ApcBackend';
                         break;
                     case 'file':
                         $className = 't3lib_cache_backend_FileBackend';
                         break;
                     case 'none':
                         $className = 't3lib_cache_backend_NullBackend';
                         break;
                     case 'globals':
                         $className = 't3lib_cache_backend_GlobalsBackend';
                         break;
                     default:
                         throw new Exception("Unknown caching mode: {$useMode}", 1296594227);
                 }
                 if (!class_exists($className) && file_exists(PATH_t3lib . 'cache/backend/class.' . strtolower($className) . '.php')) {
                     include_once PATH_t3lib . 'cache/backend/class.' . strtolower($className) . '.php';
                 } elseif (!class_exists($className)) {
                     $this->cacheObj =& $this->typo3CacheManager->getCache('cache_hash');
                 }
                 if (class_exists($className)) {
                     $cacheBackend = GeneralUtility::makeInstance($className, $configuration);
                     $cacheObject = GeneralUtility::makeInstance('t3lib_cache_frontend_VariableFrontend', 'mm_forum', $cacheBackend);
                     $this->typo3CacheManager->registerCache($cacheObject);
                     $this->cacheObj =& $this->typo3CacheManager->getCache('mm_forum');
                 } else {
                     throw new Exception("Cache backend does not exist: {$className}", 1296594228);
                 }
             }
         }
     } else {
         $className = 'tx_mmforum_cache_' . $useMode;
         $this->cacheObj =& GeneralUtility::makeInstance($className);
     }
 }
コード例 #19
0
ファイル: CacheService.php プロジェクト: preinboth/moox_news
 /**
  * Flush cache
  *
  * @return void
  */
 public function flush()
 {
     $this->cacheManager->getCache($this->cacheName)->flush();
 }
コード例 #20
0
 private function initializeCache()
 {
     $this->cacheManager = $GLOBALS['typo3CacheManager'];
     $this->cacheFactory = $GLOBALS['typo3CacheFactory'];
     try {
         $this->cache = $this->cacheManager->getCache(static::$CACHE_NAMESPACE);
     } catch (\TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException $e) {
         $this->cache = $this->cacheFactory->create(static::$CACHE_NAMESPACE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][static::$CACHE_NAMESPACE]['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][static::$CACHE_NAMESPACE]['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][static::$CACHE_NAMESPACE]['options']);
     }
 }
コード例 #21
0
 /**
  * @param CacheManager $cacheManager
  */
 public function __construct(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('codesnippet_brushes');
 }
コード例 #22
0
 /**
  * Saves any change in settings made in the Admin Panel.
  * Called from \TYPO3\CMS\Frontend\Http\RequestHandler right after access check for the Admin Panel
  *
  * @return void
  */
 public function saveConfigOptions()
 {
     $input = GeneralUtility::_GP('TSFE_ADMIN_PANEL');
     $beUser = $this->getBackendUser();
     if (is_array($input)) {
         // Setting
         $beUser->uc['TSFE_adminConfig'] = array_merge(!is_array($beUser->uc['TSFE_adminConfig']) ? [] : $beUser->uc['TSFE_adminConfig'], $input);
         unset($beUser->uc['TSFE_adminConfig']['action']);
         // Actions:
         if ($input['action']['clearCache'] && $this->isAdminModuleEnabled('cache') || isset($input['preview_showFluidDebug'])) {
             $beUser->extPageInTreeInfo = [];
             $theStartId = (int) $input['cache_clearCacheId'];
             $this->getTypoScriptFrontendController()->clearPageCacheContent_pidList($beUser->extGetTreeList($theStartId, $this->extGetFeAdminValue('cache', 'clearCacheLevels'), 0, $beUser->getPagePermsClause(1)) . $theStartId);
         }
         // Saving
         $beUser->writeUC();
         // Flush fluid template cache
         $cacheManager = new CacheManager();
         $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
         $cacheManager->getCache('fluid_template')->flush();
     }
     $this->getTimeTracker()->LR = $this->extGetFeAdminValue('tsdebug', 'LR');
     if ($this->extGetFeAdminValue('cache', 'noCache')) {
         $this->getTypoScriptFrontendController()->set_no_cache('Admin Panel: No Caching', true);
     }
 }
コード例 #23
0
 /**
  * @return void
  */
 public function initializeObject()
 {
     $this->cache = $this->manager->getCache('schemaker');
 }
コード例 #24
0
ファイル: Typo3DbBackend.php プロジェクト: plan2net/TYPO3.CMS
 /**
  * Lifecycle method
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->tableColumnCache = $this->cacheManager->getCache('extbase_typo3dbbackend_tablecolumns');
     $this->queryCache = $this->cacheManager->getCache('extbase_typo3dbbackend_queries');
 }
コード例 #25
0
 /**
  * Lifecycle method
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->dataMapCache = $this->cacheManager->getCache('extbase_datamapfactory_datamap');
 }
コード例 #26
0
 /**
  * @param CacheManager $cacheManager
  *
  * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
  */
 public function injectCacheManager(CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('codesnippet_brushes');
 }
コード例 #27
0
 /**
  * Cache constructor.
  */
 public function __construct()
 {
     $this->cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager');
     $this->cache = $this->cacheManager->getCache('openweathermap_php_api_service');
 }