/**
  * This aspect will block loadNodeTypes from being called and will instead
  * call overrideNodeTypes with a modified configuration.
  *
  * @Flow\Around("method(TYPO3\TYPO3CR\Domain\Service\NodeTypeManager->loadNodeTypes())")
  * @param JoinPointInterface $joinPoint The current join point
  * @return void
  */
 public function addDynamicNodeConfiguration(JoinPointInterface $joinPoint)
 {
     $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes');
     $dynamicNodeTypes = $this->dynamicNodeTypeRepository->findAll();
     /* @var $dynamicNodeType DynamicNodeType */
     foreach ($dynamicNodeTypes as $dynamicNodeType) {
         $dynamicNodeName = $dynamicNodeType->getValidNodeTypeName($this->settings['nodeNamespace']);
         if (!array_key_exists($dynamicNodeName, $completeNodeTypeConfiguration)) {
             $dynamicProperties = array();
             /* @var $dynamicProperty DynamicProperty */
             foreach ($dynamicNodeType->getDynamicProperties() as $dynamicProperty) {
                 $dynamicPropertyName = $dynamicProperty->getValidPropertyName($this->settings['propertyPrefix']);
                 $dynamicProperties[$dynamicPropertyName] = array('type' => 'string', 'defaultValue' => $dynamicProperty->getDefaultValue(), 'ui' => array('label' => $dynamicProperty->getLabel(), 'reloadIfChanged' => TRUE, 'inlineEditable' => TRUE, 'aloha' => array('placeholder' => $dynamicProperty->getPlaceholder()), 'inspector' => array('group' => 'dynamicProperties', 'editorOptions' => array('placeholder' => $dynamicProperty->getPlaceholder()))));
             }
             $newNodeConfiguration = array('superTypes' => $this->settings['superTypes'], 'abstract' => FALSE, 'ui' => array('label' => $dynamicNodeType->getLabel()));
             // Only set properties if there are any.
             // If properties is set to an empty array a bug in Neos will break the node configuration.
             // This leads to an empty inspector and strange error messages.
             if (count($dynamicProperties)) {
                 $newNodeConfiguration['properties'] = $dynamicProperties;
             }
             $completeNodeTypeConfiguration[$dynamicNodeName] = $newNodeConfiguration;
         }
     }
     /* @var $nodeTypeManager NodeTypeManager */
     $nodeTypeManager = $joinPoint->getProxy();
     $nodeTypeManager->overrideNodeTypes($completeNodeTypeConfiguration);
 }
 /**
  * Called by the Flow object framework after creating the object and resolving all dependencies.
  *
  * @param integer $cause Creation cause
  */
 public function initializeObject($cause)
 {
     if ($cause === \TYPO3\Flow\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
         $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.TYPO3CR.Search');
         $this->indexName = $settings['elasticSearch']['indexName'];
     }
 }
 public function setUp()
 {
     $this->nodeTypeManager = new NodeTypeManager();
     $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
     $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($this->nodeTypesFixture));
     $this->inject($this->nodeTypeManager, 'configurationManager', $this->mockConfigurationManager);
 }
 /**
  * Called by the Flow object framework after creating the object and resolving all dependencies.
  *
  * @param integer $cause Creation cause
  */
 public function initializeObject($cause)
 {
     if ($cause === \TYPO3\Flow\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
         $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.TYPO3CR.Search');
         $this->defaultConfigurationPerType = $settings['defaultConfigurationPerType'];
     }
 }
예제 #5
0
 /**
  * Gets the authentication provider configuration needed
  *
  * @return void
  */
 public function initializeObject()
 {
     $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
     if (isset($settings['security']['authentication']['providers']['Typo3SetupProvider']['providerOptions']['keyName'])) {
         $this->keyName = $settings['security']['authentication']['providers']['Typo3SetupProvider']['providerOptions']['keyName'];
     }
 }
 /**
  * Get package settings
  */
 public function getSettings()
 {
     if (!is_array($this->settings)) {
         $this->settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Ttree.JobButler');
     }
     return $this->settings;
 }
 /**
  * This method walks through the view configuration and applies
  * matching configurations in the order of their specifity score.
  * Possible options are currently the viewObjectName to specify
  * a different class that will be used to create the view and
  * an array of options that will be set on the view object.
  *
  * @param \TYPO3\Flow\Mvc\ActionRequest $request
  * @return array
  */
 public function getViewConfiguration(ActionRequest $request)
 {
     $cacheIdentifier = $this->createCacheIdentifier($request);
     $viewConfiguration = $this->cache->get($cacheIdentifier);
     if ($viewConfiguration === false) {
         $configurations = $this->configurationManager->getConfiguration('Views');
         $requestMatcher = new RequestMatcher($request);
         $context = new Context($requestMatcher);
         $matchingConfigurations = array();
         foreach ($configurations as $order => $configuration) {
             $requestMatcher->resetWeight();
             if (!isset($configuration['requestFilter'])) {
                 $matchingConfigurations[$order]['configuration'] = $configuration;
                 $matchingConfigurations[$order]['weight'] = $order;
             } else {
                 $result = $this->eelEvaluator->evaluate($configuration['requestFilter'], $context);
                 if ($result === false) {
                     continue;
                 }
                 $matchingConfigurations[$order]['configuration'] = $configuration;
                 $matchingConfigurations[$order]['weight'] = $requestMatcher->getWeight() + $order;
             }
         }
         usort($matchingConfigurations, function ($configuration1, $configuration2) {
             return $configuration1['weight'] > $configuration2['weight'];
         });
         $viewConfiguration = array();
         foreach ($matchingConfigurations as $key => $matchingConfiguration) {
             $viewConfiguration = Arrays::arrayMergeRecursiveOverrule($viewConfiguration, $matchingConfiguration['configuration']);
         }
         $this->cache->set($cacheIdentifier, $viewConfiguration);
     }
     return $viewConfiguration;
 }
 /**
  * @param string $modelClassName
  * @param array $properties
  * @param string $applicationName
  * @param array $foundRelations
  * @return string
  */
 public function getModelDeclaration($modelClassName, array $properties, $applicationName, array &$foundRelations)
 {
     $globalPropertyIgnoreConfiguration = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.properties._exclude');
     $modelGenerationPropertyIgnoreConfiguration = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.applications.' . $applicationName . '.model.ignoredProperties');
     $ignoredProperties = array_merge($globalPropertyIgnoreConfiguration ?: array(), $modelGenerationPropertyIgnoreConfiguration ?: array());
     $typeMapping = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.applications.' . $applicationName . '.model.typeMapping');
     $propertyDefinition = array();
     foreach ($properties as $property => $propertyConfiguration) {
         if ($property === 'id' || in_array($property, $ignoredProperties) || $this->reflectionService->isPropertyAnnotatedWith($modelClassName, $property, 'TYPO3\\Flow\\Annotations\\Transient')) {
             continue;
         }
         $type = $propertyConfiguration['type'];
         if (isset($typeMapping[$type])) {
             $type = $typeMapping[$type];
         }
         if (strpos($propertyConfiguration['type'], '\\')) {
             if (!in_array($propertyConfiguration['type'], $foundRelations)) {
                 $foundRelations[] = $propertyConfiguration['type'];
             }
             $type = 'App.' . EmberDataUtility::uncamelizeClassName($type);
         }
         $propertyDefinition[] = sprintf('%s%s: DS.attr("%s")', chr(10) . "\t", $property, !empty($type) ? $type : 'string');
     }
     $modelName = EmberDataUtility::uncamelizeClassName($modelClassName);
     return sprintf('App.%s = DS.Model.extend(App.ModelMixin, {%s%s});', $modelName, implode(',', $propertyDefinition), chr(10)) . chr(10);
 }
 public function setUp($nodeTypesFixture = NULL)
 {
     if ($nodeTypesFixture === NULL) {
         $nodeTypesFixture = $this->nodeTypesFixture;
     }
     $this->configurationManager = $this->getMockBuilder('TYPO3\\Flow\\Configuration\\ConfigurationManager')->disableOriginalConstructor()->getMock();
     $this->configurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($nodeTypesFixture));
 }
 /**
  * @test
  */
 public function handleStoresRouterMatchResultsInTheComponentContext()
 {
     $mockMatchResults = array('someRouterMatchResults');
     $this->mockConfigurationManager->expects($this->atLeastOnce())->method('getConfiguration')->will($this->returnValue(array()));
     $this->mockRouter->expects($this->atLeastOnce())->method('route')->with($this->mockHttpRequest)->will($this->returnValue($mockMatchResults));
     $this->mockComponentContext->expects($this->atLeastOnce())->method('setParameter')->with('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults', $mockMatchResults);
     $this->routingComponent->handle($this->mockComponentContext);
 }
 /**
  * Injects the configuration manager
  *
  * @param \TYPO3\Flow\Configuration\ConfigurationManager $configurationManager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\Flow\Configuration\ConfigurationManager $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $this->matches = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Debug.Profiling.Classes');
     foreach ($this->matches as $key => $value) {
         $this->matches[$key] = '/^' . str_replace('\\', '\\\\', $value) . '$/';
     }
 }
예제 #12
0
 /**
  * @param string $providerName The provider name as given in Settings.yaml
  * @throws \InvalidArgumentException
  * @return TokenEndpointInterface
  */
 public function getTokenEndpointForProvider($providerName)
 {
     $tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName));
     if ($tokenEndpointClassName === NULL) {
         throw new \InvalidArgumentException(sprintf('In Settings.yaml, there was no "tokenEndpointClassName" option given for the provider "%s".', $providerName), 1383743372);
     }
     return $this->objectManager->get($tokenEndpointClassName);
 }
 /**
  * Resolve a route for the request
  *
  * Stores the resolved route values in the ComponentContext to pass them
  * to other components. They can be accessed via ComponentContext::getParameter('TYPO3\Flow\Mvc\Routing\RoutingComponent', 'matchResults');
  *
  * @param ComponentContext $componentContext
  * @return void
  */
 public function handle(ComponentContext $componentContext)
 {
     if ($componentContext->getParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization') !== TRUE) {
         $routesConfiguration = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
         $this->router->setRoutesConfiguration($routesConfiguration);
     }
     $matchResults = $this->router->route($componentContext->getHttpRequest());
     $componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults', $matchResults);
 }
 /**
  * @param \TYPO3\Flow\Core\Bootstrap $bootstrap
  */
 public function prepareRealtimeIndexing(\TYPO3\Flow\Core\Bootstrap $bootstrap)
 {
     $this->configurationManager = $bootstrap->getObjectManager()->get('TYPO3\\Flow\\Configuration\\ConfigurationManager');
     $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->getPackageKey());
     if (isset($settings['realtimeIndexing']['enabled']) && $settings['realtimeIndexing']['enabled'] === TRUE) {
         $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectUpdated', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'indexObject');
         $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectPersisted', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'indexObject');
         $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectRemoved', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'removeObject');
     }
 }
 /**
  * Renders an HTML tag from a given asset.
  *
  * @param string $layout
  * @param int $columnNo
  * @return string
  */
 public function render($layout, $columnNo = 1)
 {
     $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'JohannesSteu.Bootstrap.GridSystem.Layouts');
     if (array_key_exists($layout, $settings)) {
         if (array_key_exists("col-" . $columnNo, $settings[$layout])) {
             return $settings[$layout]["col-" . $columnNo];
         }
     }
     return "";
 }
 /**
  * @return void
  */
 public function initializeObject()
 {
     $this->settings = $this->configurationManager->getConfiguration('Settings', 'TYPO3.Media');
     $domain = $this->domainRepository->findOneByActiveRequest();
     // Set active asset collection to the current site's asset collection, if it has one, on the first view if a matching domain is found
     if ($domain !== null && !$this->browserState->get('activeAssetCollection') && $this->browserState->get('automaticAssetCollectionSelection') !== true && $domain->getSite()->getAssetCollection() !== null) {
         $this->browserState->set('activeAssetCollection', $domain->getSite()->getAssetCollection());
         $this->browserState->set('automaticAssetCollectionSelection', true);
     }
 }
 /**
  * Prepares $this->nodeTypeManager with a fresh instance with all mocks and makes the given fixture data available as NodeTypes configuration
  *
  * @param array $nodeTypesFixtureData
  */
 protected function prepareNodeTypeManager(array $nodeTypesFixtureData)
 {
     $this->nodeTypeManager = new NodeTypeManager();
     $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
     $mockCache = $this->getMock(\TYPO3\Flow\Cache\Frontend\StringFrontend::class, [], [], '', false);
     $mockCache->expects($this->any())->method('get')->willReturn(null);
     $this->inject($this->nodeTypeManager, 'fullConfigurationCache', $mockCache);
     $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with('NodeTypes')->will($this->returnValue($nodeTypesFixtureData));
     $this->inject($this->nodeTypeManager, 'configurationManager', $this->mockConfigurationManager);
 }
예제 #18
0
 /**
  * @param string $providerName
  * @throws \InvalidArgumentException
  * @return array
  */
 protected function getConfiguredOptionsByProviderName($providerName)
 {
     if (!array_key_exists($providerName, $this->providerOptionsByProviderName)) {
         $providerOptions = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions', $providerName));
         if (!is_array($providerOptions)) {
             throw new \InvalidArgumentException(sprintf('The given provider name "%s" was not properly defined in the Settings (i.e. being defined and having a "providerOptions" key).', $providerName), 1383739910);
         }
         $this->providerOptionsByProviderName[$providerName] = $providerOptions;
     }
     return $this->providerOptionsByProviderName[$providerName];
 }
예제 #19
0
 /**
  * @return array
  */
 protected function getGuides()
 {
     $out = [];
     $chartSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.Charts');
     foreach ($chartSettings['Phases'] as $version => $phases) {
         foreach ($phases as $phaseName => $dates) {
             $out[] = ['fillAlpha' => 0.5, 'date' => $dates['start'], 'toDate' => $dates['end'], 'label' => $phaseName, 'position' => 'top', 'inside' => TRUE, 'fillColor' => $chartSettings['Colors'][$phaseName]];
         }
     }
     return $out;
 }
 public function setUp()
 {
     $this->policyService = new PolicyService();
     $this->mockConfigurationManager = $this->getMockBuilder(ConfigurationManager::class)->disableOriginalConstructor()->getMock();
     $this->mockConfigurationManager->expects($this->any())->method('getConfiguration')->with(ConfigurationManager::CONFIGURATION_TYPE_POLICY)->will($this->returnCallback(function () {
         return $this->mockPolicyConfiguration;
     }));
     $this->inject($this->policyService, 'configurationManager', $this->mockConfigurationManager);
     $this->mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock();
     $this->inject($this->policyService, 'objectManager', $this->mockObjectManager);
     $this->mockPrivilege = $this->getAccessibleMock(AbstractPrivilege::class, ['matchesSubject'], [], '', false);
 }
예제 #21
0
 /**
  * Initializes the controller
  */
 protected function initializeAction()
 {
     date_default_timezone_set('UTC');
     $context = $this->env->getContext();
     if ($context == 'Development') {
         $this->context = 'DEV';
     } else {
         $this->context = 'PRD';
     }
     $this->connection = new Es\ElasticSearchConnection();
     $this->connection->init();
     $this->sprintConfig = $this->ConfigurationManager->getConfiguration('Sprints');
 }
 /**
  * Validate a single configuration type
  *
  * @param string $configurationType the configuration typr to validate
  * @param string $path configuration path to validate, or NULL.
  * @param array $loadedSchemaFiles will be filled with a list of loaded schema files
  * @return \TYPO3\Flow\Error\Result
  * @throws Exception\SchemaValidationException
  */
 protected function validateSingleType($configurationType, $path, &$loadedSchemaFiles)
 {
     $availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes();
     if (in_array($configurationType, $availableConfigurationTypes) === FALSE) {
         throw new Exception\SchemaValidationException('The configuration type "' . $configurationType . '" was not found. Only the following configuration types are supported: "' . implode('", "', $availableConfigurationTypes) . '"', 1364984886);
     }
     $configuration = $this->configurationManager->getConfiguration($configurationType);
     // find schema files for the given type and path
     $schemaFileInfos = array();
     $activePackages = $this->packageManager->getActivePackages();
     foreach ($activePackages as $package) {
         $packageKey = $package->getPackageKey();
         $packageSchemaPath = \TYPO3\Flow\Utility\Files::concatenatePaths(array($package->getResourcesPath(), 'Private/Schema'));
         if (is_dir($packageSchemaPath)) {
             $packageSchemaFiles = \TYPO3\Flow\Utility\Files::readDirectoryRecursively($packageSchemaPath, '.schema.yaml');
             foreach ($packageSchemaFiles as $schemaFile) {
                 $schemaName = substr($schemaFile, strlen($packageSchemaPath) + 1, -strlen('.schema.yaml'));
                 $schemaNameParts = explode('.', str_replace('/', '.', $schemaName), 2);
                 $schemaType = $schemaNameParts[0];
                 $schemaPath = isset($schemaNameParts[1]) ? $schemaNameParts[1] : NULL;
                 if ($schemaType === $configurationType && ($path === NULL || strpos($schemaPath, $path) === 0)) {
                     $schemaFileInfos[] = array('file' => $schemaFile, 'name' => $schemaName, 'path' => $schemaPath, 'packageKey' => $packageKey);
                 }
             }
         }
     }
     if (count($schemaFileInfos) === 0) {
         throw new Exception\SchemaValidationException('No schema files found for configuration type "' . $configurationType . '"' . ($path !== NULL ? ' and path "' . $path . '".' : '.'), 1364985056);
     }
     $result = new Result();
     foreach ($schemaFileInfos as $schemaFileInfo) {
         $loadedSchemaFiles[] = $schemaFileInfo['file'];
         if ($schemaFileInfo['path'] !== NULL) {
             $data = \TYPO3\Flow\Utility\Arrays::getValueByPath($configuration, $schemaFileInfo['path']);
         } else {
             $data = $configuration;
         }
         if (empty($data)) {
             $result->addNotice(new Notice('No configuration found, skipping schema "%s".', 1364985445, array(substr($schemaFileInfo['file'], strlen(FLOW_PATH_ROOT)))));
         } else {
             $parsedSchema = \Symfony\Component\Yaml\Yaml::parse($schemaFileInfo['file']);
             $validationResultForSingleSchema = $this->schemaValidator->validate($data, $parsedSchema);
             if ($schemaFileInfo['path'] !== NULL) {
                 $result->forProperty($schemaFileInfo['path'])->merge($validationResultForSingleSchema);
             } else {
                 $result->merge($validationResultForSingleSchema);
             }
         }
     }
     return $result;
 }
 public function init()
 {
     $conf = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.Elasticsearch.Credentials');
     if (is_array($conf) && count($conf) > 0 && isset($conf['host']) && isset($conf['port']) && isset($conf['path']) && isset($conf['transport'])) {
         $elasticClientConfiguration = array('host' => $conf['host'], 'port' => $conf['port'], 'path' => $conf['path'], 'transport' => $conf['transport']);
         if (isset($conf['username']) && isset($conf['password'])) {
             $elasticClientConfiguration['headers'] = array('Authorization' => 'Basic ' . base64_encode($conf['username'] . ':' . $conf['password']) . '==');
         }
         $elasticaClient = new \Elastica\Client($elasticClientConfiguration);
         $this->index = $elasticaClient->getIndex($conf['index']);
     } else {
         throw new Exception('Could not load elastic-credentials! Please check your setting.yaml!');
     }
 }
 /**
  * Notify SSO servers about the logged out client
  *
  * All active authentication tokens of type SingleSignOnToken will be
  * used to get the registered global session id and send a request
  * to the session service on the SSO server.
  *
  * @return void
  */
 public function logout()
 {
     $allConfiguration = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow');
     $tokens = $this->securityContext->getAuthenticationTokensOfType('Flowpack\\SingleSignOn\\Client\\Security\\SingleSignOnToken');
     foreach ($tokens as $token) {
         $providerName = $token->getAuthenticationProviderName();
         $serverIdentifier = \TYPO3\Flow\Utility\Arrays::getValueByPath($allConfiguration, 'security.authentication.providers.' . $providerName . '.providerOptions.server');
         if ($serverIdentifier !== NULL) {
             $ssoClient = $this->ssoClientFactory->create();
             $ssoServer = $this->ssoServerFactory->create($serverIdentifier);
             $ssoServer->destroySession($ssoClient, $token->getGlobalSessionId());
         }
     }
 }
 /**
  * @param string $type
  * @return void
  */
 public function indexAction($type = 'Settings')
 {
     $availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes();
     $this->view->assignMultiple(array('type' => $type, 'availableConfigurationTypes' => $availableConfigurationTypes));
     if (in_array($type, $availableConfigurationTypes)) {
         $this->view->assign('configuration', $this->configurationManager->getConfiguration($type));
         try {
             $this->view->assign('validationResult', $this->configurationSchemaValidator->validate($type));
         } catch (\TYPO3\Flow\Configuration\Exception\SchemaValidationException $exception) {
             $this->addFlashMessage($exception->getMessage(), 'An error occurred during validation of the configuration.', Message::SEVERITY_ERROR, array(), 1412373972);
         }
     } else {
         $this->addFlashMessage('Configuration type not found.', '', Message::SEVERITY_ERROR, array(), 1412373998);
     }
 }
예제 #26
0
 /**
  * Update global Piwik settings
  *
  * @param array $piwik
  * @return void
  */
 public function updateAction(array $piwik)
 {
     $configurationPath = $this->packageManager->getPackage('Portachtzig.Neos.Piwik')->getConfigurationPath();
     $settings = $this->configurationSource->load($configurationPath . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
     $piwik['host'] = preg_replace("(^https?://)", "", $piwik['host']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.host', $piwik['host']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.protocol', $piwik['protocol']);
     $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.token_auth', $piwik['token_auth']);
     if (array_key_exists('idSite', $piwik)) {
         $settings = Arrays::setValueByPath($settings, 'Portachtzig.Neos.Piwik.idSite', $piwik['idSite']);
     }
     $this->configurationSource->save($configurationPath . ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settings);
     $this->configurationManager->flushConfigurationCache();
     $this->redirect('index');
 }
 /**
  * Returns a fresh or existing instance of the object specified by $objectName.
  *
  * This specialized get() method is able to do setter injection for properties
  * defined in the object configuration of the specified object.
  *
  * @param string $objectName The name of the object to return an instance of
  * @return object The object instance
  * @throws \TYPO3\Flow\Object\Exception\CannotBuildObjectException
  * @throws \TYPO3\Flow\Object\Exception\UnresolvedDependenciesException
  * @throws \TYPO3\Flow\Object\Exception\UnknownObjectException
  */
 public function get($objectName)
 {
     if (isset($this->objects[$objectName]['i'])) {
         return $this->objects[$objectName]['i'];
     }
     if (isset($this->objectConfigurations[$objectName]) && count($this->objectConfigurations[$objectName]->getArguments()) > 0) {
         throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because constructor injection is not available in the compile time Object Manager. Refactor your code to use setter injection instead. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '. Build stack: ' . implode(', ', $this->objectNameBuildStack), 1297090026);
     }
     if (!isset($this->objects[$objectName])) {
         throw new Exception\UnknownObjectException('Cannot build object "' . $objectName . '" because it is unknown to the compile time Object Manager.', 1301477694);
     }
     if ($this->objects[$objectName]['s'] !== Configuration::SCOPE_SINGLETON) {
         throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because the get() method in the compile time Object Manager only supports singletons.', 1297090027);
     }
     $this->objectNameBuildStack[] = $objectName;
     $object = parent::get($objectName);
     /** @var Configuration $objectConfiguration */
     $objectConfiguration = $this->objectConfigurations[$objectName];
     /** @var Property $property */
     foreach ($objectConfiguration->getProperties() as $propertyName => $property) {
         if ($property->getAutowiring() !== Configuration::AUTOWIRING_MODE_ON) {
             continue;
         }
         switch ($property->getType()) {
             case Property::PROPERTY_TYPES_STRAIGHTVALUE:
                 $value = $property->getValue();
                 break;
             case Property::PROPERTY_TYPES_CONFIGURATION:
                 $propertyValue = $property->getValue();
                 $value = $this->configurationManager->getConfiguration($propertyValue['type'], $propertyValue['path']);
                 break;
             case Property::PROPERTY_TYPES_OBJECT:
                 $propertyObjectName = $property->getValue();
                 if (!is_string($propertyObjectName)) {
                     throw new Exception\CannotBuildObjectException('The object definition of "' . $objectName . '::' . $propertyName . '" is too complex for the compile time Object Manager. You can only use plain object names, not factories and the like. Check configuration in ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . ' and objects which depend on ' . $objectName . '.', 1297099659);
                 }
                 $value = $this->get($propertyObjectName);
                 break;
             default:
                 throw new Exception\CannotBuildObjectException('Invalid property type.', 1297090029);
         }
         if (method_exists($object, $setterMethodName = 'inject' . ucfirst($propertyName))) {
             $object->{$setterMethodName}($value);
         } elseif (method_exists($object, $setterMethodName = 'set' . ucfirst($propertyName))) {
             $object->{$setterMethodName}($value);
         } else {
             throw new Exception\UnresolvedDependenciesException('Could not inject configured property "' . $propertyName . '" into "' . $objectName . '" because no injection method exists, but for compile time use this is required. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '.', 1297110953);
         }
     }
     $initializationLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleInitializationMethodName();
     if (method_exists($object, $initializationLifecycleMethodName)) {
         $object->{$initializationLifecycleMethodName}();
     }
     $shutdownLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleShutdownMethodName();
     if (method_exists($object, $shutdownLifecycleMethodName)) {
         $this->shutdownObjects[$object] = $shutdownLifecycleMethodName;
     }
     array_pop($this->objectNameBuildStack);
     return $object;
 }
 /**
  * Loads all node types into memory.
  *
  * @return void
  */
 protected function loadNodeTypes()
 {
     $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes');
     foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) {
         $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration);
     }
 }
 /**
  * Flushes caches as needed if settings, routes or policies have changed
  *
  * @param array $changedFiles A list of full paths to changed files
  * @return void
  * @see flushSystemCachesByChangedFiles()
  */
 protected function flushConfigurationCachesByChangedFiles(array $changedFiles)
 {
     $aopProxyClassRebuildIsNeeded = FALSE;
     $aopProxyClassInfluencers = '/(?:Policy|Objects|Settings)(?:\\..*)*\\.yaml/';
     $objectClassesCache = $this->getCache('Flow_Object_Classes');
     $objectConfigurationCache = $this->getCache('Flow_Object_Configuration');
     $caches = array('/Policy\\.yaml/' => array('Flow_Security_Authorization_Privilege_Method', 'Flow_Persistence_Doctrine', 'Flow_Persistence_Doctrine_Results', 'Flow_Aop_RuntimeExpressions'), '/Routes([^\\/]*)\\.yaml/' => array('Flow_Mvc_Routing_Route', 'Flow_Mvc_Routing_Resolve'), '/Views\\.yaml/' => array('Flow_Mvc_ViewConfigurations'));
     $cachesToFlush = array();
     foreach (array_keys($changedFiles) as $pathAndFilename) {
         foreach ($caches as $cacheFilePattern => $cacheNames) {
             if (preg_match($aopProxyClassInfluencers, $pathAndFilename) === 1) {
                 $aopProxyClassRebuildIsNeeded = TRUE;
             }
             if (preg_match($cacheFilePattern, $pathAndFilename) !== 1) {
                 continue;
             }
             foreach ($caches[$cacheFilePattern] as $cacheName) {
                 $cachesToFlush[$cacheName] = $cacheFilePattern;
             }
         }
     }
     foreach ($cachesToFlush as $cacheName => $cacheFilePattern) {
         $this->systemLogger->log(sprintf('A configuration file matching the pattern "%s" has been changed, flushing related cache "%s"', $cacheFilePattern, $cacheName), LOG_INFO);
         $this->getCache($cacheName)->flush();
     }
     $this->systemLogger->log('A configuration file has been changed, flushing compiled configuration cache', LOG_INFO);
     $this->configurationManager->flushConfigurationCache();
     if ($aopProxyClassRebuildIsNeeded) {
         $this->systemLogger->log('The configuration has changed, triggering an AOP proxy class rebuild.', LOG_INFO);
         $objectConfigurationCache->remove('allAspectClassesUpToDate');
         $objectConfigurationCache->remove('allCompiledCodeUpToDate');
         $objectClassesCache->flush();
     }
 }
 /**
  * Parses the given configuration path expression and sets $this->actualSettingValue
  * and $this->condition accordingly
  *
  * @param string $settingComparisonExpression The configuration expression (path + optional condition)
  * @return void
  * @throws \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException
  */
 protected function parseConfigurationOptionPath($settingComparisonExpression)
 {
     $settingComparisonExpression = preg_split(self::PATTERN_SPLITBYEQUALSIGN, $settingComparisonExpression);
     if (isset($settingComparisonExpression[1])) {
         $matches = array();
         preg_match(self::PATTERN_MATCHVALUEINQUOTES, $settingComparisonExpression[1], $matches);
         if (isset($matches['SingleQuotedString']) && $matches['SingleQuotedString'] !== '') {
             $this->condition = $matches['SingleQuotedString'];
         } elseif (isset($matches['DoubleQuotedString']) && $matches['DoubleQuotedString'] !== '') {
             $this->condition = $matches['DoubleQuotedString'];
         } else {
             throw new \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException('The given condition has a syntax error (Make sure to set quotes correctly). Got: "' . $settingComparisonExpression[1] . '"', 1230047529);
         }
     }
     $configurationKeys = preg_split('/\\./', $settingComparisonExpression[0]);
     if (count($configurationKeys) > 0) {
         $settingPackageKey = array_shift($configurationKeys);
         $settingValue = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settingPackageKey);
         foreach ($configurationKeys as $currentKey) {
             if (!isset($settingValue[$currentKey])) {
                 throw new \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException('The given configuration path in the pointcut designator "setting" did not exist. Got: "' . $settingComparisonExpression[0] . '"', 1230035614);
             }
             $settingValue = $settingValue[$currentKey];
         }
         $this->actualSettingValue = $settingValue;
     }
 }