isProduction() public method

Returns TRUE if this context is the Production context or a sub-context of it
public isProduction ( ) : boolean
return boolean
 /**
  * @test
  * @dataProvider isMethods
  */
 public function contextMethodsReturnTheCorrectValues($contextName, $isDevelopment, $isProduction, $isTesting, $parentContext)
 {
     $context = new ApplicationContext($contextName);
     $this->assertSame($isDevelopment, $context->isDevelopment());
     $this->assertSame($isProduction, $context->isProduction());
     $this->assertSame($isTesting, $context->isTesting());
     $this->assertSame((string) $parentContext, (string) $context->getParent());
 }
Beispiel #2
0
 /**
  * Builds a boot sequence starting all modules necessary for the runtime state.
  * This includes all of the "essentials" sequence.
  *
  * @return Sequence
  * @api
  */
 public function buildRuntimeSequence()
 {
     $sequence = $this->buildEssentialsSequence('runtime');
     $sequence->addStep(new Step('neos.flow:objectmanagement:proxyclasses', [Scripts::class, 'initializeProxyClasses']), 'neos.flow:systemlogger');
     $sequence->addStep(new Step('neos.flow:classloader:cache', [Scripts::class, 'initializeClassLoaderClassesCache']), 'neos.flow:objectmanagement:proxyclasses');
     $sequence->addStep(new Step('neos.flow:objectmanagement:runtime', [Scripts::class, 'initializeObjectManager']), 'neos.flow:classloader:cache');
     if (!$this->context->isProduction()) {
         $sequence->addStep(new Step('neos.flow:systemfilemonitor', [Scripts::class, 'initializeSystemFileMonitor']), 'neos.flow:objectmanagement:runtime');
         $sequence->addStep(new Step('neos.flow:objectmanagement:recompile', [Scripts::class, 'recompileClasses']), 'neos.flow:systemfilemonitor');
     }
     $sequence->addStep(new Step('neos.flow:reflectionservice', [Scripts::class, 'initializeReflectionService']), 'neos.flow:objectmanagement:runtime');
     $sequence->addStep(new Step('neos.flow:resources', [Scripts::class, 'initializeResources']), 'neos.flow:reflectionservice');
     $sequence->addStep(new Step('neos.flow:session', [Scripts::class, 'initializeSession']), 'neos.flow:resources');
     return $sequence;
 }
 /**
  * Returns the form definitions for the step
  *
  * @param FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Setup complete');
     $congratulations = $page1->createElement('congratulationsSection', 'Neos.Form:Section');
     $congratulations->setLabel('Congratulations');
     $success = $congratulations->createElement('success', 'Neos.Form:StaticText');
     $success->setProperty('text', 'You have successfully installed Neos! If you need help getting started, please refer to the Neos documentation.');
     $success->setProperty('elementClassAttribute', 'alert alert-success');
     $docs = $congratulations->createElement('docsLink', 'Neos.Setup:LinkElement');
     $docs->setLabel('Read the documentation');
     $docs->setProperty('href', 'https://neos.readthedocs.org/');
     $docs->setProperty('target', '_blank');
     $contextEnv = Bootstrap::getEnvironmentConfigurationSetting('FLOW_CONTEXT') ?: 'Development';
     $applicationContext = new ApplicationContext($contextEnv);
     if (!$applicationContext->isProduction()) {
         $context = $page1->createElement('contextSection', 'Neos.Form:Section');
         $context->setLabel('Define application context');
         $contextInfo = $context->createElement('contextInfo', 'Neos.Form:StaticText');
         $contextInfo->setProperty('text', 'Your Neos installation is currently not running in "Production" context. If you want to experience Neos with its full speed, you should now change your FLOW_CONTEXT environment variable to "Production".');
         $contextDocs = $context->createElement('contextDocsLink', 'Neos.Setup:LinkElement');
         $contextDocs->setLabel('Read about application contexts');
         $contextDocs->setProperty('href', 'http://flowframework.readthedocs.org/en/stable/TheDefinitiveGuide/PartIII/Bootstrapping.html#the-typo3-flow-application-context');
         $contextDocs->setProperty('target', '_blank');
     }
     $frontend = $page1->createElement('frontendSection', 'Neos.Form:Section');
     $frontend->setLabel('View the site');
     $link = $frontend->createElement('link', 'Neos.Setup:LinkElement');
     $link->setLabel('Go to the frontend');
     $link->setProperty('href', '/');
     $link->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $backend = $page1->createElement('backendSection', 'Neos.Form:Section');
     $backend->setLabel('Start editing');
     $backendLink = $backend->createElement('backendLink', 'Neos.Setup:LinkElement');
     $backendLink->setLabel('Go to the backend');
     $backendLink->setProperty('href', '/neos');
     $backendLink->setProperty('elementClassAttribute', 'btn btn-large btn-primary');
     $loggedOut = $page1->createElement('loggedOut', 'Neos.Form:StaticText');
     $loggedOut->setProperty('text', 'You have automatically been logged out for security reasons since this is the final step. Refresh the page to log in again if you missed something.');
     $loggedOut->setProperty('elementClassAttribute', 'alert alert-info');
 }
Beispiel #4
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 Exception if no cache has been injected
  */
 public function saveToCache()
 {
     if ($this->hasFrozenCacheInProduction()) {
         return;
     }
     if (!$this->initialized) {
         $this->initialize();
     }
     if ($this->loadFromClassSchemaRuntimeCache === true) {
         return;
     }
     if (!$this->reflectionDataCompiletimeCache instanceof FrontendInterface) {
         throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
     }
     if ($this->updatedReflectionData !== []) {
         $this->updateReflectionData();
     }
     if ($this->context->isProduction()) {
         $this->saveProductionData();
         return;
     }
     $this->saveDevelopmentData();
 }