/** * @test */ public function parentContextIsConnectedRecursively() { $context = new ApplicationContext('Production/Foo/Bar'); $parentContext = $context->getParent(); $this->assertSame('Production/Foo', (string) $parentContext); $rootContext = $parentContext->getParent(); $this->assertSame('Production', (string) $rootContext); }
/** * Builds a boot sequence starting all modules necessary for the runtime state. * This includes all of the "essentials" sequence. * * @return \TYPO3\FLOW3\Core\Booting\Sequence * @api */ public function buildRuntimeSequence() { $sequence = $this->buildEssentialsSequence(); $sequence->addStep(new Step('typo3.flow3:objectmanagement:proxyclasses', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeProxyClasses')), 'typo3.flow3:systemlogger'); $sequence->addStep(new Step('typo3.flow3:classloader:cache', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeClassLoaderClassesCache')), 'typo3.flow3:objectmanagement:proxyclasses'); $sequence->addStep(new Step('typo3.flow3:objectmanagement:runtime', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeObjectManager')), 'typo3.flow3:classloader:cache'); if (!$this->context->isProduction()) { $sequence->addStep(new Step('typo3.flow3:systemfilemonitor', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeSystemFileMonitor')), 'typo3.flow3:objectmanagement:runtime'); } $sequence->addStep(new Step('typo3.flow3:reflectionservice', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeReflectionService')), 'typo3.flow3:objectmanagement:runtime'); $sequence->addStep(new Step('typo3.flow3:persistence', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializePersistence')), 'typo3.flow3:reflectionservice'); $sequence->addStep(new Step('typo3.flow3:session', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeSession')), 'typo3.flow3:persistence'); $sequence->addStep(new Step('typo3.flow3:resources', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeResources')), 'typo3.flow3:session'); $sequence->addStep(new Step('typo3.flow3:i18n', array('TYPO3\\FLOW3\\Core\\Booting\\Scripts', 'initializeI18n')), 'typo3.flow3:resources'); return $sequence; }
/** * 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); } } } }