Check additional inputs for the 'setConfig' action.

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@return void
542727
public function checkSetConfigInput()
    {
        
        $availableParameters = array('loaded', 'loadAtStartup', 'ghost');
        $defaults = array('extension' => null,
                          'configParameter' => null,
                          'configValue' => null);
                          
        $this->options = array_merge($defaults, $this->options);
        
        if ($this->options['configParameter'] == null){
            $this->error("Please provide the 'configParam' parameter.", true);
        }
        else if (!in_array($this->options['configParameter'], $availableParameters)){
            $this->error("Please provide a valid 'configParam' parameter value (" . implode("|", $availableParameters) . ").", true);
        }
        else if ($this->options['configValue'] === null){
            $this->error("Please provide the 'configValue' parameter.", true);
        }
        else if ($this->options['extension'] == null){
            $this->error("Please provide the 'extension' parameter.", true);
        }
    }
1230645
public function updateSettings()
    {
        foreach ($this->settings as $key => &$value)
        {
            if (!is_null(arg($key)))
            {
                $value = arg($key);
            }
        }
        $this->onSettingsUpdate();
        $this->saveSettings();
    }
1193134
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (true == $this->user_value || 1 == $this->user_value) {
                $this->user_value = 1;
                $this->is_valid = true;
            } elseif (false == $this->user_value || 0 == $this->user_value || '' == $this->user_value) {
                $this->user_value = 0;
                $this->is_valid = true;
            } elseif (false == $this->validator) {
                // This field does not get validated
                $this->is_valid = true;
            } else {
                $this->is_valid = false;
                $this->error = 'The provided value is not valid. Please enter a valid value.';
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
392369
protected function configure()
    {
        $this->setDefinition([
            new InputArgument('suite', InputArgument::OPTIONAL, 'suite to be tested'),
            new InputArgument('test', InputArgument::OPTIONAL, 'test to be run'),
            new InputOption('override', 'o', InputOption::VALUE_IS_ARRAY  | InputOption::VALUE_REQUIRED, 'Override config values'),
            new InputOption('ext', 'e', InputOption::VALUE_IS_ARRAY  | InputOption::VALUE_REQUIRED, 'Run with extension enabled'),
            new InputOption('report', '', InputOption::VALUE_NONE, 'Show output in compact style'),
            new InputOption('html', '', InputOption::VALUE_OPTIONAL, 'Generate html with results', 'report.html'),
            new InputOption('xml', '', InputOption::VALUE_OPTIONAL, 'Generate JUnit XML Log', 'report.xml'),
            new InputOption('phpunit-xml', '', InputOption::VALUE_OPTIONAL, 'Generate PhpUnit XML Log', 'phpunit-report.xml'),
            new InputOption('tap', '', InputOption::VALUE_OPTIONAL, 'Generate Tap Log', 'report.tap.log'),
            new InputOption('json', '', InputOption::VALUE_OPTIONAL, 'Generate Json Log', 'report.json'),
            new InputOption('colors', '', InputOption::VALUE_NONE, 'Use colors in output'),
            new InputOption(
                'no-colors',
                '',
                InputOption::VALUE_NONE,
                'Force no colors in output (useful to override config file)'
            ),
            new InputOption('silent', '', InputOption::VALUE_NONE, 'Only outputs suite names and final results'),
            new InputOption('steps', '', InputOption::VALUE_NONE, 'Show steps in output'),
            new InputOption('debug', 'd', InputOption::VALUE_NONE, 'Show debug and scenario output'),
            new InputOption(
                'coverage',
                '',
                InputOption::VALUE_OPTIONAL,
                'Run with code coverage'
            ),
            new InputOption(
                'coverage-html',
                '',
                InputOption::VALUE_OPTIONAL,
                'Generate CodeCoverage HTML report in path'
            ),
            new InputOption(
                'coverage-xml',
                '',
                InputOption::VALUE_OPTIONAL,
                'Generate CodeCoverage XML report in file'
            ),
            new InputOption(
                'coverage-text',
                '',
                InputOption::VALUE_OPTIONAL,
                'Generate CodeCoverage text report in file'
            ),
            new InputOption(
                'coverage-crap4j',
                '',
                InputOption::VALUE_OPTIONAL,
                'Generate CodeCoverage report in Crap4J XML format'
            ),
            new InputOption(
                'coverage-phpunit',
                '',
                InputOption::VALUE_OPTIONAL,
                'Generate CodeCoverage PHPUnit report in path'
            ),
            new InputOption('no-exit', '', InputOption::VALUE_NONE, 'Don\'t finish with exit code'),
            new InputOption(
                'group',
                'g',
                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
                'Groups of tests to be executed'
            ),
            new InputOption(
                'skip',
                's',
                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
                'Skip selected suites'
            ),
            new InputOption(
                'skip-group',
                'x',
                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
                'Skip selected groups'
            ),
            new InputOption(
                'env',
                '',
                InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED,
                'Run tests in selected environments.'
            ),
            new InputOption('fail-fast', 'f', InputOption::VALUE_NONE, 'Stop after first failure'),
            new InputOption('no-rebuild', '', InputOption::VALUE_NONE, 'Do not rebuild actor classes on start'),
            new InputOption(
                'seed',
                '',
                InputOption::VALUE_REQUIRED,
                'Define random seed for shuffle setting'
            ),

        ]);

        parent::configure();
    }
84600
public function check()
    {
        $result = true;

        $configurationSettings = [
            'Database.Host',
            'Database.Username',
            'Database.Password',
            'Database.Port',
            'Database.Name',
        ];

        foreach ($configurationSettings as $setting) {
            if ($this->configuration->hasConfigurationKey($setting) === false) {
                $this->missingConfiguration[] = $setting;
                $result = false;
            }
        }

        return $result;
    }
1270499
public function checkConfig()
    {
        $views = [
            $this->fullController,
            $this->action,
        ];

        $this->configIndex = implode('.', array_filter($views));

        return array_get(config('view-routing'), $this->configIndex);
    }
1233390
private function _checkConfig() {
        // Ftp configuration can be namespaced with the 'ftp' keyword
        if (isset($this->_config['ftp']))
            $this->_config = $this->_config['ftp'];

        // Check each configuration entry
        if (empty($this->_config) || !is_array($this->_config))
            throw new \InvalidArgumentException("Configuration should be an array");
        else if (empty($this->_config['host']))
            throw new \InvalidArgumentException("Ftp server host not specified in configuration");
        else if (empty($this->_config['port']))
            throw new \InvalidArgumentException("Ftp server port not specified in configuration");
        else if (empty($this->_config['user']))
            throw new \InvalidArgumentException("Ftp user not specified in configuration");
        else if (empty($this->_config['private_key']))
            throw new \InvalidArgumentException("Ftp user ssh private key not specified in configuration");
        else if (!is_readable($this->_baseDir.'/'.$this->_config['private_key']))
            throw new \InvalidArgumentException("Ftp user ssh private key not found or not readable at: ".$this->_baseDir.'/'.$this->_config['private_key']);
        else if (empty($this->_config['public_key']))
            throw new \InvalidArgumentException("Ftp user ssh public key not specified in configuration");
        else if (!is_readable($this->_baseDir.'/'.$this->_config['public_key']))
            throw new \InvalidArgumentException("Ftp user ssh public key not found or not readable at: ".$this->_baseDir.'/'.$this->_config['public_key']);
    }
927419
public function cmdSetConfig()
    {
        $key = $this->getParam(0);
        $value = $this->getParam(1);

        if (!isset($key) || !isset($value)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (!$this->config->set($key, $value)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
1005773
protected function configure()
    {
        $configureSettingGroup = $this->cliHelper->confirmAction('Would you like to change the settings?');
        if (!$configureSettingGroup) {
            return;
        }
        
        $this->configureSettings($this->configurationManager->getSettings());
    }
812823
protected function validateSettings()
    {
        if (isset($this->attributes[SectionParser::ERROR_INI])) {
            CmsException::mask($this, 200);
            Ini::parse($this->attributes[SectionParser::ERROR_INI]);
            CmsException::unmask();
        }
    }
395112
private static function setDefaultConfig() {
            if (!self::$defaults) {
                self::$defaults = [self::CFG_ERROR_LEVEL        => error_reporting(),
                                   self::CFG_LOG_ERROR_LOCATION => true];
            }
        }
400784
public function setConfigValue() {
    $this->requireTransaction();
    $session = $this->getSession();
    $request = $this->getRequest();
    $response = $this->getResponse();
    $persistenceFacade = $this->getPersistenceFacade();

    // load model
    $authUser = $this->principalFactory->getUser($session->getAuthUser());
    if ($authUser) {
      $configKey = $request->getValue('name');
      $configValue = $request->getValue('value');

      // find configuration
      $configObj = null;
      $configList = Node::filter($authUser->getValue('UserConfig'), null, null,
              ['name' => $configKey]);
      if (sizeof($configList) > 0) {
        $configObj = $configList[0];
      }
      else {
        $configObj = $persistenceFacade->create('UserConfig');
        $configObj->setValue('name', $configKey);
        $authUser->addNode($configObj);
      }

      // set value
      if ($configObj != null) {
        $configObj->setValue('value', $configValue);
      }
    }

    // success
    $response->setAction('ok');
  }
677355
private function setConfigValues()
    {
        if (isset($this->config['min_cache_file_size']) && is_numeric($this->config['min_cache_file_size'])) {
            $this->setMinCacheFileSize($this->config['min_cache_file_size']);
        }

        //Enable Log
        if (isset($this->config['enable_log']) && $this->isBool($this->config['enable_log'])) {
            $this->setEnableLog($this->config['enable_log']);
        }

        //Cache Expiration Time
        if (isset($this->config['cache_expiration_in_seconds'])) {
            $this->setCacheExpirationInSeconds($this->config['cache_expiration_in_seconds']);
        }

        // Path to store cache files
        if (isset($this->config['cache_path'])) {
            $this->setCachePath($this->config['cache_path']);
        }

        // Log file path
        if (isset($this->config['log_file_path']) && !empty($this->config['log_file_path'])) {
            $this->setLogFilePath($this->config['log_file_path']);
        }

        // Use $_SESSION while caching or not
        if (isset($this->config['use_session']) && $this->isBool($this->config['use_session'])) {
            $this->setUseSession($this->config['use_session']);
        }

        // Session exclude key
        if (isset($this->config['session_exclude_keys']) && is_array($this->config['session_exclude_keys'])) {
            $this->setSessionExcludeKeys($this->config['session_exclude_keys']);
        }

        // File Locking
        if (isset($this->config['file_lock']) && !empty($this->config['file_lock'])) {
            $this->setFileLock($this->config['file_lock']);
        }

        // Send HTTP headers
        if (isset($this->config['send_headers']) && $this->isBool($this->config['send_headers'])) {
            $this->setSendHeaders($this->config['send_headers']);
        }

        // Forward Last-Modified and ETag headers to cache item
        if (isset($this->config['forward_headers']) && $this->isBool($this->config['forward_headers'])) {
            $this->setForwardHeaders($this->config['forward_headers']);
        }

        // Enable Dry run mode
        if (isset($this->config['dry_run_mode']) && $this->isBool($this->config['dry_run_mode'])) {
            $this->setDryRunMode($this->config['dry_run_mode']);
        }
    }
316342
protected function configure()
    {
        $this
            ->setName('detect')
            ->setDefinition(
                [
                    new InputArgument('path', InputArgument::OPTIONAL, 'path of the project', null),
                    new InputOption(
                        'config-file',
                        'c',
                        InputOption::VALUE_REQUIRED,
                        'File path of the configuration file'
                    ),
                    new InputOption(
                        'format',
                        'f',
                        InputOption::VALUE_REQUIRED,
                        sprintf('Output format (%s)', implode(', ', $this->formats)),
                        $this->formats[0]
                    ),
                ]
            )
            ->setDescription('Detect coupling rules')
            ->setHelp($this->loadHelpContent());
    }
570902
protected function initConfig()
    {
        if (isset($this->settings) || $this->settings->exists('config')) {
            $this->config->setDefinition($this->settings->get('config'));
        }
    }
1243578
private function setPhpConfig()
    {
        if (function_exists('ini_set')) {
            if ($this->config->error->log) {
                ini_set('log_errors', true);
                ini_set('error_log', Rails::config()->log_file);
            }
        }
        
        if ($this->config['date']['timezone']) {
            date_default_timezone_set($this->config['date']['timezone']);
        } elseif (function_exists('ini_get')) {
            if (!ini_get('date.timezone') && !date_default_timezone_get()) {
                throw new Exception\RuntimeException(
                    "date.timezone directive doesn't seem to have a value. " .
                    "You are requested to either set a value in your php.ini or in your application's configuration (date->timezone)"
                );
            }
        }
        
        if ($this->config()->session->start && !Rails::cli()) {
            if ($session_name = $this->config()->session->name) {
                session_name($session_name);
            }
            session_start();
        }
        
        if ($paths = $this->config()->eager_load_paths->toArray()) {
            Rails::loader()->addPaths($paths);
            set_include_path(get_include_path() . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths));
        }
        
        set_error_handler('Rails::errorHandler', $this->config()->error->report_types);
    }
275334
private function isConfig()
    {
        if (empty($this->config['root']) || empty($this->config['files']) || empty($this->config['dst'])
            || empty($this->config['vi'])
        ) {
            $this->error('the config is error!');
            return false;
        }
        return true;
    }