/**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * @param ConsoleBootstrap $bootstrap
  */
 public static function initializeCachingFramework(ConsoleBootstrap $bootstrap)
 {
     // Cache framework initialisation for TYPO3 CMS <= 7.3
     if (class_exists('TYPO3\\CMS\\Core\\Cache\\Cache')) {
         $bootstrap->setEarlyInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager', \TYPO3\CMS\Core\Cache\Cache::initializeCachingFramework());
         // @deprecated since 6.2 will be removed in two versions
         if (class_exists('TYPO3\\CMS\\Core\\Compatibility\\GlobalObjectDeprecationDecorator')) {
             $GLOBALS['typo3CacheManager'] = new \TYPO3\CMS\Core\Compatibility\GlobalObjectDeprecationDecorator('TYPO3\\CMS\\Core\\Cache\\CacheManager');
             $GLOBALS['typo3CacheFactory'] = new \TYPO3\CMS\Core\Compatibility\GlobalObjectDeprecationDecorator('TYPO3\\CMS\\Core\\Cache\\CacheFactory');
         }
     } else {
         $cacheManager = new \TYPO3\CMS\Core\Cache\CacheManager();
         $cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
         \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $cacheManager);
         $cacheFactory = new \TYPO3\CMS\Core\Cache\CacheFactory('production', $cacheManager);
         \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Cache\CacheFactory::class, $cacheFactory);
         $bootstrap->setEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class, $cacheManager);
     }
 }
Ejemplo n.º 3
0
 /**
  * A slot method to inject the required caching framework database tables to the
  * tables definitions string
  *
  * @param array $sqlString
  * @param string $extensionKey
  * @return array
  */
 public function addCachingFrameworkRequiredDatabaseSchemaToTablesDefinition(array $sqlString, $extensionKey)
 {
     self::$cacheManager->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
     $sqlString[] = static::getDatabaseTableDefinitions();
     return array('sqlString' => $sqlString, 'extensionKey' => $extensionKey);
 }
Ejemplo n.º 4
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);
     }
 }