/**
  * @param $fileMonitorIdentifier
  * @param array $changedFiles
  * @return void
  */
 public function flushContentCacheOnFileChanges($fileMonitorIdentifier, array $changedFiles)
 {
     $fileMonitorsThatTriggerContentCacheFlush = array('TYPO3CR_NodeTypesConfiguration', 'TypoScript_Files', 'Fluid_TemplateFiles', 'Flow_ClassFiles', 'Flow_ConfigurationFiles', 'Flow_TranslationFiles');
     if (in_array($fileMonitorIdentifier, $fileMonitorsThatTriggerContentCacheFlush)) {
         $this->flowCacheManager->getCache('Neos_Fusion_Content')->flush();
     }
 }
 /**
  * Creates the mocked filesystem used in the tests
  */
 public function setUp()
 {
     vfsStream::setup('Foo');
     $this->mockEnvironment = $this->createMock(Utility\Environment::class);
     $this->mockEnvironment->expects($this->any())->method('getPathToTemporaryDirectory')->will($this->returnValue('vfs://Foo/'));
     $this->mockEnvironment->expects($this->any())->method('getMaximumPathLength')->will($this->returnValue(1024));
     $this->mockEnvironment->expects($this->any())->method('getContext')->will($this->returnValue(new ApplicationContext('Testing')));
     $this->mockCacheManager = $this->getMockBuilder(CacheManager::class)->setMethods(['registerCache', 'isCachePersistent'])->disableOriginalConstructor()->getMock();
     $this->mockCacheManager->expects($this->any())->method('isCachePersistent')->will($this->returnValue(false));
     $this->mockEnvironmentConfiguration = $this->getMockBuilder(EnvironmentConfiguration::class)->setConstructorArgs([__DIR__ . '~Testing', 'vfs://Foo/', 255])->getMock();
 }
 /**
  * @param LifecycleEventArgs $eventArgs
  * @return void
  */
 public function postRemove(LifecycleEventArgs $eventArgs)
 {
     $entity = $eventArgs->getEntity();
     if ($entity instanceof ImageInterface) {
         /** @var PersistentResource $resource */
         $resource = $eventArgs->getEntity()->getResource();
         if ($resource !== null) {
             $this->cacheManager->getCache('TYPO3_Media_ImageSize')->remove($resource->getCacheEntryIdentifier());
         }
     }
 }
Exemple #4
0
 /**
  * Explicitly compile proxy classes
  *
  * The compile command triggers the proxy class compilation.
  * Although a compilation run is triggered automatically by Flow, there might
  * be cases in a production context where a manual compile run is needed.
  *
  * @Flow\Internal
  * @param boolean $force If set, classes will be compiled even though the cache says that everything is up to date.
  * @return void
  */
 public function compileCommand($force = false)
 {
     /** @var VariableFrontend $objectConfigurationCache */
     $objectConfigurationCache = $this->cacheManager->getCache('Flow_Object_Configuration');
     if ($force === false) {
         if ($objectConfigurationCache->has('allCompiledCodeUpToDate')) {
             return;
         }
     }
     /** @var PhpFrontend $classesCache */
     $classesCache = $this->cacheManager->getCache('Flow_Object_Classes');
     $this->proxyClassCompiler->injectClassesCache($classesCache);
     $this->aopProxyClassBuilder->injectObjectConfigurationCache($objectConfigurationCache);
     $this->aopProxyClassBuilder->build();
     $this->dependencyInjectionProxyClassBuilder->build();
     $classCount = $this->proxyClassCompiler->compile();
     $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory();
     Files::createDirectoryRecursively($dataTemporaryPath);
     file_put_contents($dataTemporaryPath . 'AvailableProxyClasses.php', $this->proxyClassCompiler->getStoredProxyClassMap());
     $objectConfigurationCache->set('allCompiledCodeUpToDate', true);
     $classesCacheBackend = $classesCache->getBackend();
     if ($this->bootstrap->getContext()->isProduction() && $classesCacheBackend instanceof FreezableBackendInterface) {
         /** @var FreezableBackendInterface $backend */
         $backend = $classesCache->getBackend();
         $backend->freeze();
     }
     $this->emitFinishedCompilationRun($classCount);
 }
 /**
  * Call system function
  *
  * @Flow\Internal
  * @param integer $address
  * @return void
  */
 public function sysCommand($address)
 {
     if ($address === 64738) {
         $this->cacheManager->flushCaches();
         $content = 'G1syShtbMkobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgKioqKiBDT01NT0RPUkUgNjQgQkFTSUMgVjIgKioqKiAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gIDY0SyBSQU0gU1lTVEVNICAzODkxMSBCQVNJQyBCWVRFUyBGUkVFICAgG1swbQobWzE7MzdtG1sxOzQ0bSBSRUFEWS4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIEZMVVNIIENBQ0hFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSBPSywgRkxVU0hFRCBBTEwgQ0FDSEVTLiAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtIFJFQURZLiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gG1sxOzQ3bSAbWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQobWzE7MzdtG1sxOzQ0bSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAbWzBtChtbMTszN20bWzE7NDRtICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIBtbMG0KG1sxOzM3bRtbMTs0NG0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgG1swbQoK';
         $this->response->setOutputFormat(Response::OUTPUTFORMAT_RAW);
         $this->response->appendContent(base64_decode($content));
         if ($this->lockManager->isSiteLocked()) {
             $this->lockManager->unlockSite();
         }
         $this->sendAndExit(0);
     }
 }
 /**
  * Initializes the cache framework
  *
  * @param Bootstrap $bootstrap
  * @return void
  */
 public static function initializeCacheManagement(Bootstrap $bootstrap)
 {
     /** @var ConfigurationManager $configurationManager */
     $configurationManager = $bootstrap->getEarlyInstance(ConfigurationManager::class);
     $environment = $bootstrap->getEarlyInstance(Environment::class);
     $cacheFactoryObjectConfiguration = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_OBJECTS, CacheFactoryInterface::class);
     $cacheFactoryClass = isset($cacheFactoryObjectConfiguration['className']) ? $cacheFactoryObjectConfiguration['className'] : CacheFactory::class;
     /** @var CacheFactory $cacheFactory */
     $cacheFactory = new $cacheFactoryClass($bootstrap->getContext(), $environment);
     $cacheManager = new CacheManager();
     $cacheManager->setCacheConfigurations($configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_CACHES));
     $cacheManager->injectConfigurationManager($configurationManager);
     $cacheManager->injectSystemLogger($bootstrap->getEarlyInstance(SystemLoggerInterface::class));
     $cacheManager->injectEnvironment($environment);
     $cacheManager->injectCacheFactory($cacheFactory);
     $cacheFactory->injectCacheManager($cacheManager);
     $bootstrap->setEarlyInstance(CacheManager::class, $cacheManager);
     $bootstrap->setEarlyInstance(CacheFactory::class, $cacheFactory);
 }
 /**
  * @return void
  */
 protected function flushConfigurationCache()
 {
     $this->cacheManager->getCache('TYPO3_Neos_Configuration_Version')->flush();
 }
 /**
  * Injects the Cache Manager because we cannot inject an automatically factored cache during compile time.
  *
  * @param CacheManager $cacheManager
  * @return void
  */
 public function injectCacheManager(CacheManager $cacheManager)
 {
     $this->methodPermissionCache = $cacheManager->getCache('Flow_Security_Authorization_Privilege_Method');
 }