protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $application = $input->getArgument('application'); // TODO: this should be USER or optionally GROUP/USER or ALL when generating everything $directories = $input->getArgument('directories'); $files = array(); foreach ($directories as $dir) { $filelist = FileOperation::getAllFilesByExtension(Paths::$db . Paths::$separator . Paths::$defaultGroup . Paths::$separator . $dir, 'yml'); if ($filelist !== false) { $files = array_merge($files, $filelist); } else { user_error('No such site: ' . $dir, E_USER_WARNING); //return false; } } //ApplicationsDB::LoadAll(); $configScopes = ApplicationsDB::LoadApplication($application); $settingsDB = new ConfigScopes\SettingsDB(); // merging the defaults $settingsDB->mergeFromYAML(Paths::$db . Paths::$separator . Paths::$hypoconf . Paths::$separator . Paths::$defaultUser . Paths::$separator . 'config.yml', false, true, true); //true for compilation // merging the files $settingsDB->mergeFromYAMLs($files, 'nginx/server', true, true, false, true); //true for compilation //var_dump($settingsDB->DB); ApplicationsDB::LoadConfig($settingsDB->DB); $parsedFile = $configScopes->parseTemplateRecursively($application); // echo PHP_EOL.$parsedFile; $output->writeln($parsedFile); }
protected function execute(Console\Input\InputInterface $input, Console\Output\OutputInterface $output) { $application = $input->getArgument('application'); // $output->writeln('Hello World!'); LogCLI::Message('Listing available settings: ', 0); $configScopesNginx = ApplicationsDB::LoadApplication($application); // $settingsNginx = ApplicationsDB::GetSettingsList('nginx', 'server'); $settingsNginx = ApplicationsDB::GetSettingsList($application); $settings = ArrayTools::GetMultiDimentionalElements($settingsNginx, true, true); // $settings = ArrayTools::GetMultiDimentionalElementsWithChildren(&$settingsNginx); foreach ($settings as $setting) { LogCLI::MessageResult(LogCLI::BLUE . $setting, 0, LogCLI::INFO); } LogCLI::Result(LogCLI::OK); }
public static function GenerateParsed($arguments) { $configScopesNginx = ApplicationsDB::LoadApplication('nginx'); foreach ($arguments['file'] as $dir) { $fileslist = FileOperation::getAllFilesByExtension(Paths::$db . Paths::$separator . Paths::$defaultGroup . Paths::$separator . $dir, 'yml'); if (!isset($fileslist) || $fileslist !== false) { foreach ($fileslist as $file) { $files[] = $file; } } else { // user_error('No such site: '.$arguments['file'], E_USER_ERROR); user_error('No such site: ' . $dir, E_USER_WARNING); return false; } } $nginx = new ConfigScopes\SettingsDB(); $nginx->mergeFromYAML(Paths::$db . Paths::$separator . Paths::$hypoconf . Paths::$separator . Paths::$defaultUser . Paths::$separator . 'config.yml', false, true, true); //true for compilation $nginx->mergeFromYAMLs($files, 'server', true, true); //true for compilation ApplicationsDB::LoadConfig(&$nginx->DB); $parsedFile = $configScopesNginx->parseTemplateRecursively('nginx'); echo PHP_EOL . $parsedFile; }