/** * @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); } }
/** * Validate the given configuration * * <b>Validate all configuration</b> * ./flow configuration:validate * * <b>Validate configuration at a certain subtype</b> * ./flow configuration:validate --type Settings --path TYPO3.Flow.persistence * * You can retrieve the available configuration types with: * ./flow configuration:listtypes * * @param string $type Configuration type to validate * @param string $path path to the subconfiguration separated by "." like "TYPO3.Flow" * @param boolean $verbose if TRUE, output more verbose information on the schema files which were used * @return void */ public function validateCommand($type = null, $path = null, $verbose = false) { if ($type === null) { $this->outputLine('Validating <b>all</b> configuration'); } else { $this->outputLine('Validating <b>' . $type . '</b> configuration' . ($path !== null ? ' on path <b>' . $path . '</b>' : '')); } $this->outputLine(); $validatedSchemaFiles = array(); try { $result = $this->configurationSchemaValidator->validate($type, $path, $validatedSchemaFiles); } catch (SchemaValidationException $exception) { $this->outputLine('<b>Exception:</b>'); $this->outputFormatted($exception->getMessage(), array(), 4); $this->quit(2); return; } if ($verbose) { $this->outputLine('<b>Loaded Schema Files:</b>'); foreach ($validatedSchemaFiles as $validatedSchemaFile) { $this->outputLine('- ' . substr($validatedSchemaFile, strlen(FLOW_PATH_ROOT))); } $this->outputLine(); if ($result->hasNotices()) { $notices = $result->getFlattenedNotices(); $this->outputLine('<b>%d notices:</b>', array(count($notices))); /** @var Notice $notice */ foreach ($notices as $path => $pathNotices) { foreach ($pathNotices as $notice) { $this->outputLine(' - %s -> %s', array($path, $notice->render())); } } $this->outputLine(); } } if ($result->hasErrors()) { $errors = $result->getFlattenedErrors(); $this->outputLine('<b>%d errors were found:</b>', array(count($errors))); /** @var Error $error */ foreach ($errors as $path => $pathErrors) { foreach ($pathErrors as $error) { $this->outputLine(' - %s -> %s', array($path, $error->render())); } } $this->quit(1); } else { $this->outputLine('<b>All Valid!</b>'); } }
/** * Validate the given configuration * * <b>Validate all configuration</b> * ./flow configuration:validate * * <b>Validate configuration at a certain subtype</b> * ./flow configuration:validate --type Settings --path TYPO3.Flow.persistence * * You can retrieve the available configuration types with: * ./flow configuration:listtypes * * @param string $type Configuration type to validate * @param string $path path to the subconfiguration separated by "." like "TYPO3.Flow" * @param boolean $verbose if TRUE, output more verbose information on the schema files which were used * @return void */ public function validateCommand($type = NULL, $path = NULL, $verbose = FALSE) { if ($type === NULL) { $this->outputLine('Validating <b>all</b> configuration'); } else { $this->outputLine('Validating <b>' . $type . '</b> configuration' . ($path !== NULL ? ' on path <b>' . $path . '</b>' : '')); } $this->outputLine(); try { $validatedSchemaFiles = array(); $result = $this->configurationSchemaValidator->validate($type, $path, $validatedSchemaFiles); } catch (\TYPO3\Flow\Configuration\Exception\SchemaValidationException $exception) { $this->outputLine('<b>Error:</b>'); $this->outputFormatted($exception->getMessage(), array(), 4); $this->quit(2); } if ($verbose) { $this->outputLine('Loaded Schema Files:'); foreach ($validatedSchemaFiles as $validatedSchemaFile) { $this->outputLine('- ' . substr($validatedSchemaFile, strlen(FLOW_PATH_ROOT))); } $this->outputLine(); } if ($result->hasErrors()) { $errors = $result->getFlattenedErrors(); $this->outputLine('<b>%s errors were found:</b>', array(count($errors))); foreach ($errors as $path => $pathErrors) { foreach ($pathErrors as $error) { $this->outputLine(' - %s -> %s', array($path, $error->render())); } } $this->quit(1); } else { $this->outputLine('<b>All Valid!</b>'); $this->quit(0); } }