/** * Constructs this Dispatcher and registers the autoloader */ public function __construct() { t3lib_cache::initializeCachingFramework(); $this->initializeClassLoader(); $this->initializeCache(); $this->initializeReflection(); }
/** * Collects the needed data recursively cached. This function detects recursion loops. * * @param string $function The function to call and collect the result of. * @param string $childrenFunction The function to get the children from (must return an iterable object or an array). * @param callable $processData An optional closure to process the data from the function, must return an array. * @return array The resulting collection. */ public function collectRecursiveDataCached($function, $childrenFunction, $processData = null, $keyFunction = null, &$recursionIndex = array()) { if (isset($recursionIndex[$this->getUid()])) { return array(); } $recursionIndex[$this->getUid()] = true; $identifier = 'tx_contentstage_' . get_class($this) . '_' . $function . '_' . $childrenFunction . '_' . $this->getUid(); if (TX_CONTENTSTAGE_USECACHE) { if (self::$cache === null) { t3lib_cache::initializeCachingFramework(); if (method_exists('t3lib_cache', 'initContentHashCache')) { // not needed in 6.2 anymore t3lib_cache::initContentHashCache(); } self::$cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash'); } if (TX_CONTENTSTAGE_USECACHE && self::$cache->has($identifier)) { return self::$cache->get($identifier); } } $data = array(); $tData = array(); if (is_callable(array($this, $function))) { $tData = $this->{$function}(); if ($processData !== null && is_callable($processData)) { $tData = $processData($tData); } } $tData = is_array($tData) ? $tData : array(); $useKeyFunction = false; if ($keyFunction !== null && is_callable($keyFunction)) { $useKeyFunction = true; foreach ($tData as $item) { $key = $keyFunction($item); if ($key !== null) { $data[$key] = $item; } else { $data[] = $item; } } } else { $data = $tData; } if (is_callable(array($this, $childrenFunction))) { foreach ($this->{$childrenFunction}() as $child) { foreach ($child->collectRecursiveDataCached($function, $childrenFunction, $processData, $keyFunction, $recursionIndex) as $item) { if ($useKeyFunction && ($key = $keyFunction($item)) !== null) { $data[$key] = $item; } else { $data[] = $item; } } } } if (TX_CONTENTSTAGE_USECACHE) { self::$cache->set($identifier, $data, array(), TX_CONTENTSTAGE_CACHETIME); } return $data; }
/** * Initializes the cache for this command. * * @return void */ protected function initializeCache() { t3lib_cache::initializeCachingFramework(); try { $this->cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_solr'); } catch (t3lib_cache_exception_NoSuchCache $e) { $this->cacheInstance = $GLOBALS['typo3CacheFactory']->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']); } }
<?php if (!defined('TYPO3_MODE')) { die('Access denied.'); } if (TYPO3_MODE == 'BE') { // register the cache in BE so it will be cleared with "clear all caches" try { t3lib_cache::initializeCachingFramework(); $GLOBALS['typo3CacheFactory']->create('tx_extbase_cache_reflection', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']); } catch (t3lib_cache_exception_NoSuchCache $exception) { } $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Dispatcher'; } $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['extbase'][] = 'tx_extbase_utility_extbaserequirementscheck'; t3lib_div::loadTCA('fe_users'); if (!isset($TCA['fe_groups']['ctrl']['type'])) { $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUser', 'Tx_Extbase_Domain_Model_FrontendUser')), 'size' => 1, 'maxitems' => 1, 'default' => '0'))); t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, 1); t3lib_extMgm::addToAllTCAtypes('fe_users', 'tx_extbase_type'); $TCA['fe_users']['ctrl']['type'] = 'tx_extbase_type'; } $TCA['fe_users']['types']['Tx_Extbase_Domain_Model_FrontendUser'] = $TCA['fe_users']['types']['0']; t3lib_div::loadTCA('fe_groups'); if (!isset($TCA['fe_groups']['ctrl']['type'])) { $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUserGroup', 'Tx_Extbase_Domain_Model_FrontendUserGroup')), 'size' => 1, 'maxitems' => 1, 'default' => '0'))); t3lib_extMgm::addTCAcolumns('fe_groups', $tempColumns, 1); t3lib_extMgm::addToAllTCAtypes('fe_groups', 'tx_extbase_type'); $TCA['fe_groups']['ctrl']['type'] = 'tx_extbase_type'; } $TCA['fe_groups']['types']['Tx_Extbase_Domain_Model_FrontendUserGroup'] = $TCA['fe_groups']['types']['0'];
/** * Initialize the controller. * * @return void */ public function initializeAction() { $this->extensionName = 'Contentstage'; $this->activeBackendUser = $this->backendUserRepository->findByUid($GLOBALS['BE_USER']->user['uid']); if ($this->activeBackendUser === null) { // should never happen die($this->translate('error.noBackendUser')); } t3lib_cache::initializeCachingFramework(); if (method_exists('t3lib_cache', 'initContentHashCache')) { // not needed in 6.2 anymore t3lib_cache::initContentHashCache(); } $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash'); $this->extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contentstage']); define('TX_CONTENTSTAGE_USECACHE', !empty($this->extensionConfiguration['useCache'])); define('TX_CONTENTSTAGE_CACHETIME', intval($this->extensionConfiguration['cacheTime'])); $this->settings['publishRecords'] = $this->extensionConfiguration['global.']['disablePublishRecord'] ? '' : 'Extended'; $this->localDB = $GLOBALS['TYPO3_DB']; $this->initializePage(); $info = $this->extensionConfiguration['remote.']['db.']; $noPconnect = $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect']; $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] = true; $this->remoteDB = t3lib_div::makeInstance('t3lib_db'); $this->remoteDB->connectDB($info['host'], $info['user'], $info['password'], $info['database']); $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] = $noPconnect; $this->initializeLog(); $this->localRepository = $this->objectManager->create('Tx_Contentstage_Domain_Repository_ContentRepository', $this->localDB, $this->log, $this->cache, 'localRepository'); $this->localRepository->setFolder(PATH_site); $this->localRepository->setCurrentPage($this->page); $this->localRepository->setParent($this); $this->remoteRepository = $this->objectManager->create('Tx_Contentstage_Domain_Repository_ContentRepository', $this->remoteDB, $this->log, $this->cache, 'remoteRepository'); $this->remoteRepository->setFolder($this->extensionConfiguration['remote.']['folder']); $this->remoteRepository->setCurrentPage($this->page); $this->remoteRepository->setParent($this); $pageTS = $this->getPageTS(); $this->localRepository->setUseHttps($pageTS['useHttpsLocal']); $this->localRepository->setOverrideDomain($pageTS['overrideDomainLocal']); $this->remoteRepository->setUseHttps($pageTS['useHttpsRemote']); $this->remoteRepository->setOverrideDomain($pageTS['overrideDomainRemote']); $this->initializeDepth(); $this->initializeIgnoreTables(); $this->initializeReview(); $hookFilename = 'contentstage/Classes/Controller/' . $this->request->getControllerName() . 'Controller.php'; if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$hookFilename][$this->request->getControllerActionName()])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$hookFilename][$this->request->getControllerActionName()] as $classRef) { $this->hookObjectsArray[] =& t3lib_div::getUserObj($classRef); } } }
/** * Initializes the cache instance * * @return void */ protected function initCache() { t3lib_cache::initializeCachingFramework(); try { $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_nrsemantictemplates_html'); } catch (Exception $e) { $conf = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_nrsemantictemplates_html']; $this->cache = $GLOBALS['typo3CacheFactory']->create('cache_nrsemantictemplates_html', $conf['frontend'], $conf['backend'], $conf['options']); } }
/** * Initializes the caching framework by loading the cache manager and factory * into the global context. * * @return void */ public static function initializeCachingFramework() { t3lib_cache::initializeCachingFramework(); }
/** * Initialize the cache. * * @return void */ protected function initializeCache() { t3lib_cache::initializeCachingFramework(); if (method_exists('t3lib_cache', 'initContentHashCache')) { // not needed in 6.2 anymore t3lib_cache::initContentHashCache(); } $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash'); }
/** * Initialize the TYPO3 second level cache */ private function initializeLevel2Cache() { t3lib_cache::initializeCachingFramework(); try { $this->level2Cache = $GLOBALS['typo3CacheManager']->getCache('cache_extbase_object'); } catch (t3lib_cache_exception_NoSuchCache $exception) { $this->level2Cache = $GLOBALS['typo3CacheFactory']->create('cache_extbase_object', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['options']); } }
/** * initializes the cache for the DB requests * * @return Cache Object */ protected function initializeCache() { // Create the cache (only needed for 4.5 and lower) if (\t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) < '4006000') { \t3lib_cache::initializeCachingFramework(); try { $cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_geocoding'); } catch (\t3lib_cache_exception_NoSuchCache $e) { $cacheInstance = $GLOBALS['typo3CacheFactory']->create('tx_geocoding', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['options']); } } else { // Initialize the cache try { if (isset($GLOBALS['typo3CacheManager'])) { $cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_geocoding'); } else { $cacheInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('tx_geocoding'); } } catch (\t3lib_cache_exception_NoSuchCache $e) { throw new Exception('Unable to load Cache! 1299944198'); } } return $cacheInstance; }