/** * 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']); } }
/** * 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) { } }
/** * */ 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']); } }
/** * 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; }
/** * 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; }
/** * @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; }
/** * 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(); } }
/** * @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)); } }
/** * @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); } }
/** * 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; } }
/** * 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; }
/** * 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; }
/** * @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'); }
/** * @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); } }
/** * 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; }
/** * @param \TYPO3\CMS\Core\Cache\CacheManager $cacheManager * @return void */ public function injectCacheManager(\TYPO3\CMS\Core\Cache\CacheManager $cacheManager) { $this->tokenCache = $cacheManager->getCache('hairu_token'); }
/** * 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'); }
/** * 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); } }
/** * Flush cache * * @return void */ public function flush() { $this->cacheManager->getCache($this->cacheName)->flush(); }
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']); } }
/** * @param CacheManager $cacheManager */ public function __construct(CacheManager $cacheManager) { $this->cache = $cacheManager->getCache('codesnippet_brushes'); }
/** * 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); } }
/** * @return void */ public function initializeObject() { $this->cache = $this->manager->getCache('schemaker'); }
/** * Lifecycle method * * @return void */ public function initializeObject() { $this->tableColumnCache = $this->cacheManager->getCache('extbase_typo3dbbackend_tablecolumns'); $this->queryCache = $this->cacheManager->getCache('extbase_typo3dbbackend_queries'); }
/** * Lifecycle method * * @return void */ public function initializeObject() { $this->dataMapCache = $this->cacheManager->getCache('extbase_datamapfactory_datamap'); }
/** * @param CacheManager $cacheManager * * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException */ public function injectCacheManager(CacheManager $cacheManager) { $this->cache = $cacheManager->getCache('codesnippet_brushes'); }
/** * Cache constructor. */ public function __construct() { $this->cacheManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager'); $this->cache = $this->cacheManager->getCache('openweathermap_php_api_service'); }