/**
  * Parse list of icons and get pure icon names.
  *
  * @return array
  */
 protected function parseListOfIcons()
 {
     $cache = $this->cacheManager->getCache('Default');
     $cacheId = 'FontIconDataSource_parseListOfIcons';
     if (!($icons = $cache->get($cacheId))) {
         $icons = [];
         foreach (file(self::$iconsListFilePath) as $content) {
             if (preg_match('#fa-var-([-_a-z0-9]+):#i', $content, $match)) {
                 $icons[] = $match[1];
             }
         }
         $cache->set($cacheId, $icons, [], 0);
     }
     return $icons;
 }
 /**
  * @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('TYPO3_TypoScript_Content')->flush();
     }
 }
Пример #3
0
 /**
  * @test
  * @expectedException \TYPO3\Flow\Cache\Exception\NoSuchCacheException
  */
 public function getCacheThrowsExceptionForNonExistingIdentifier()
 {
     $cache = $this->getMockBuilder('TYPO3\\Flow\\Cache\\Frontend\\AbstractFrontend')->disableOriginalConstructor()->getMock();
     $cache->expects($this->atLeastOnce())->method('getIdentifier')->will($this->returnValue('someidentifier'));
     $this->cacheManager->registerCache($cache);
     $this->cacheManager->getCache('someidentifier');
     $this->cacheManager->getCache('doesnotexist');
 }
 /**
  * Initializes the controller before invoking an action method.
  *
  */
 public function initializeAction()
 {
     if ($this->securityContext->canBeInitialized()) {
         $account = $this->securityContext->getAccount();
         $this->bearbeiterObj = $this->bearbeiterRepository->findOneByAccount($account);
     }
     $this->cacheInterface = $this->cacheManager->getCache('GermaniaSacra_GermaniaCache');
 }
 /**
  * @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());
         }
     }
 }
 /**
  * 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);
 }
 /**
  * This aspect will reset the node type cache after changes to the dynamic node types
  *
  * @Flow\After("method(Shel\DynamicNodes\Controller\DynamicNodeTypeController->(update|create|delete|editProperty|createDynamicProperty|updateDynamicProperty|deleteDynamicProperty)Action())")
  * @param JoinPointInterface $joinPoint The current join point
  * @return void
  */
 public function clearNodeTypeConfigurationCache(JoinPointInterface $joinPoint)
 {
     // Flush note type configuration cache
     $this->nodeTypeManager->overrideNodeTypes(array());
     // Flush configuration version cache to force reload the node type schema
     $this->cacheManager->getCache('TYPO3_Neos_Configuration_Version')->flush();
     // Flush content cache so changed dynamic nodes are updated
     $this->cacheManager->getCache('TYPO3_TypoScript_Content')->flush();
 }
 /**
  * Flushes a particular cache by its identifier
  *
  * Given a cache identifier, this flushes just that one cache. To find
  * the cache identifiers, you can use the configuration:show command with
  * the type set to "Caches".
  *
  * Note that this does not have a force-flush option since it's not
  * meant to remove temporary code data, resulting into a broken state if
  * code files lack.
  *
  * @param string $identifier Cache identifier to flush cache for
  * @return void
  * @see typo3.flow:cache:flush
  * @see typo3.flow:configuration:show
  */
 public function flushOneCommand($identifier)
 {
     if (!$this->cacheManager->hasCache($identifier)) {
         $this->outputLine('The cache "%s" does not exist.', array($identifier));
         $cacheConfigurations = $this->cacheManager->getCacheConfigurations();
         $shortestDistance = -1;
         foreach (array_keys($cacheConfigurations) as $existingIdentifier) {
             $distance = levenshtein($existingIdentifier, $identifier);
             if ($distance <= $shortestDistance || $shortestDistance < 0) {
                 $shortestDistance = $distance;
                 $closestIdentifier = $existingIdentifier;
             }
         }
         if (isset($closestIdentifier)) {
             $this->outputLine('Did you mean "%s"?', array($closestIdentifier));
         }
         $this->quit(1);
     }
     $this->cacheManager->getCache($identifier)->flush();
     $this->outputLine('Flushed "%s" cache for "%s" context.', array($identifier, $this->bootstrap->getContext()));
     $this->sendAndExit(0);
 }
 /**
  * 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');
 }
 /**
  * @return void
  */
 protected function flushConfigurationCache()
 {
     $this->cacheManager->getCache('TYPO3_Neos_Configuration_Version')->flush();
 }
 /**
  * Create a new user
  *
  * @param string $cacheIdentifier
  * @Flow\Validate(argumentName="cacheIdentifier", type="\TYPO3\Flow\Validation\Validator\NotEmptyValidator")
  * @return void
  */
 public function flushAction($cacheIdentifier)
 {
     $this->cacheManager->getCache($cacheIdentifier)->flush();
     $this->addFlashMessage('Successfully flushed the cache "%s".', 'User created', Message::SEVERITY_OK, [$cacheIdentifier], 1448033946);
     $this->redirect('index');
 }
 /**
  * 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->policyCache = $cacheManager->getCache('Flow_Security_Policy');
 }
 /**
  * Injects the Cache Manager because we cannot inject an automatically factored cache during compile time.
  *
  * @param \TYPO3\Flow\Cache\CacheManager $cacheManager
  * @return void
  */
 public function injectCacheManager(\TYPO3\Flow\Cache\CacheManager $cacheManager)
 {
     $this->cache = $cacheManager->getCache('Flow_Security_Policy');
 }
 /**
  * Flushes a particular cache by its identifier
  *
  * Given a cache identifier, this flushes just that one cache. To find
  * the cache identifiers, you can use the configuration:show command with
  * the type set to "Caches".
  *
  * Note that this does not have a force-flush option since it's not
  * meant to remove temporary code data, resulting into a broken state if
  * code files lack.
  *
  * @param string $identifier Cache identifier to flush cache for
  * @return void
  * @see typo3.flow:cache:flush
  * @see typo3.flow:configuration:show
  */
 public function flushOneCommand($identifier)
 {
     $this->cacheManager->getCache($identifier)->flush();
     $this->outputLine('Flushed "%s" cache for "%s" context.', array($identifier, $this->bootstrap->getContext()));
     $this->sendAndExit(0);
 }