Exemplo n.º 1
0
 /**
  * Prepares a mirror of public package resources that is accessible through
  * the web server directly.
  *
  * @param array $activePackages
  * @return void
  */
 public function publishPublicPackageResources(array $activePackages)
 {
     if ($this->settings['resource']['publishing']['detectPackageResourceChanges'] === FALSE && $this->statusCache->has('packageResourcesPublished')) {
         return;
     }
     foreach ($activePackages as $packageKey => $package) {
         $this->resourcePublisher->publishStaticResources($package->getResourcesPath() . 'Public/', 'Packages/' . $packageKey . '/');
     }
     if (!$this->statusCache->has('packageResourcesPublished')) {
         $this->statusCache->set('packageResourcesPublished', 'y', array(\TYPO3\FLOW3\Cache\Frontend\FrontendInterface::TAG_PACKAGE));
     }
 }
Exemplo n.º 2
0
 /**
  * Exports the internal reflection data into the ReflectionData cache
  *
  * This method is triggered by a signal which is connected to the bootstrap's
  * shutdown sequence.
  *
  * If the reflection data has previously been loaded from the runtime cache,
  * saving it is omitted as changes are not expected.
  *
  * In Production context the whole cache is written at once and then frozen in
  * order to be consistent. Frozen cache data in Development is only produced for
  * classes contained in frozen packages.
  *
  * @return void
  * @throws \TYPO3\FLOW3\Reflection\Exception if no cache has been injected
  */
 public function saveToCache()
 {
     if ($this->loadFromClassSchemaRuntimeCache === TRUE) {
         return;
     }
     if (!$this->reflectionDataCompiletimeCache instanceof \TYPO3\FLOW3\Cache\Frontend\FrontendInterface) {
         throw new \TYPO3\FLOW3\Reflection\Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
     }
     if (count($this->updatedReflectionData) > 0) {
         $this->log(sprintf('Found %s classes whose reflection data was not cached previously.', count($this->updatedReflectionData)), LOG_DEBUG);
         foreach (array_keys($this->updatedReflectionData) as $className) {
             $this->statusCache->set(str_replace('\\', '_', $className), '');
         }
         $data = array();
         $propertyNames = array('classReflectionData', 'classSchemata', 'annotatedClasses', 'classesByMethodAnnotations');
         foreach ($propertyNames as $propertyName) {
             $data[$propertyName] = $this->{$propertyName};
         }
         $this->reflectionDataCompiletimeCache->set('ReflectionData', $data);
     }
     if ($this->context->isProduction()) {
         $this->reflectionDataRuntimeCache->flush();
         $classNames = array();
         foreach ($this->classReflectionData as $className => $reflectionData) {
             $classNames[$className] = TRUE;
             $this->reflectionDataRuntimeCache->set(str_replace('\\', '_', $className), $reflectionData);
             if (isset($this->classSchemata[$className])) {
                 $this->classSchemataRuntimeCache->set(str_replace('\\', '_', $className), $this->classSchemata[$className]);
             }
         }
         $this->reflectionDataRuntimeCache->set('__classNames', $classNames);
         $this->reflectionDataRuntimeCache->set('__annotatedClasses', $this->annotatedClasses);
         $this->reflectionDataRuntimeCache->getBackend()->freeze();
         $this->classSchemataRuntimeCache->getBackend()->freeze();
         $this->log(sprintf('Built and froze reflection runtime caches (%s classes).', count($this->classReflectionData)), LOG_INFO);
     } elseif ($this->context->isDevelopment()) {
         foreach (array_keys($this->packageManager->getFrozenPackages()) as $packageKey) {
             $pathAndFilename = $this->getPrecompiledReflectionStoragePath() . $packageKey . '.dat';
             if (!file_exists($pathAndFilename)) {
                 $this->log(sprintf('Rebuilding precompiled reflection data for frozen package %s.', $packageKey), LOG_INFO);
                 $this->freezePackageReflection($packageKey);
             }
         }
     }
 }
Exemplo n.º 3
0
 /**
  * @test
  */
 public function flushCachesResetsBothRoutingCaches()
 {
     $this->mockFindMatchResultsCache->expects($this->once())->method('flush');
     $this->mockResolveCache->expects($this->once())->method('flush');
     $this->routerCachingAspect->flushCaches();
 }
Exemplo n.º 4
0
 /**
  * Constructs the cache
  *
  * @param string $identifier A identifier which describes this cache
  * @param \TYPO3\FLOW3\Cache\Backend\PhpCapableBackendInterface $backend Backend to be used for this cache
  */
 public function __construct($identifier, \TYPO3\FLOW3\Cache\Backend\PhpCapableBackendInterface $backend)
 {
     parent::__construct($identifier, $backend);
 }