Load settings from an ini File

@param string $iniFile Path to an ini file containing the settings

@throws \Genesis\Exceptions\InvalidArgument()
969635
public static function loadSettings($iniFile)
    {
        if (!file_exists($iniFile)) {
            throw new \Genesis\Exceptions\InvalidArgument(
                'The provided configuration file is invalid or inaccessible!'
            );
        }

        $settings = parse_ini_file($iniFile, true);

        foreach ($settings['Genesis'] as $option => $value) {
            if (array_key_exists($option, self::$vault)) {
                self::$vault[$option] = $value;
            }
        }

        foreach ($settings['Interfaces'] as $option => $value) {
            if (array_key_exists($option, self::$interfaces)) {
                self::$interfaces[$option] = $value;
            }
        }
    }
1111005
public function init () {
        parent::init();
        if ( $this->folder === NULL ) {
            throw new InvalidConfigException( 'FolderDependency::$folder must be set' );
        }
        if ( !is_array( $this->folder ) ) {
            $this->folder = (array) $this->folder;
        }
        if ( !$this->folder ) {
            throw new InvalidConfigException( 'FolderDependency::$folder must be the path to the folder' );
        }
        foreach ( $this->folder as $i => $folder ) {
            $folder = FileHelper::normalizePath( Yii::getAlias( $folder ) );
            if ( !is_dir( $folder ) ) {
                throw new InvalidConfigException( 'FolderDependency::$folder must be the path to the folder' );
            }
            $this->folder[ $i ] = $folder;
        }
    }
986950
private void init() throws ConfigFileIOException {
        this.props = new Properties();
        log.info("Reading config file: {}", this.configFile);
        boolean ok = true;
        try {
            // El fichero esta en el CLASSPATH
            this.props.load(SystemConfig.class.getResourceAsStream(this.configFile));
        } catch (Exception e) {
            log.warn("File not found in the Classpath");
            try {
                this.props.load(new FileInputStream(this.configFile));
            } catch (IOException ioe) {
                log.error("Can't open file: {}", ioe.getLocalizedMessage());
                ok = false;
                ioe.printStackTrace();
                throw new ConfigFileIOException(ioe.getLocalizedMessage());
            }
        }
        if (ok) {
            log.info("Configuration loaded successfully");
            if (log.isDebugEnabled()) {
                log.debug(this.toString());
            }
        }
    }
160710
protected function loadConfiguration($configFile = false)
    {
        if ($configFile === false) {
            return;
        }
        echo "\nLoad configuration";

        $configuration = require $configFile;

        foreach ($configuration as $name => $value) {
            if ($this->module->canSetProperty($name) == true) {
                $this->module->$name = $value;
            } else {
                throw new InvalidConfigException("Invalid configuration. Unknown configuration option '{$name}'");
            }
        }
        $this->module->loadComponents();
    }
1318054
protected function loadIniFile( $fileName )
	{
		if( self::$iniQuickLoad )
		{
			$array	= parse_ini_file( $fileName, TRUE );
			foreach( $array as $sectionName => $sectionData )
				foreach( $sectionData as $key => $value )
					$this->pairs[$sectionName.".".$key]	= $value;
		}
		else
		{
			$pattern	= '@^(string|integer|int|double|boolean|bool).*$@';
			$reader		= new FS_File_INI_Reader( $fileName, TRUE );
			$comments	= $reader->getComments();
			foreach( $reader->getProperties() as $sectionName => $sectionData )
			{
				foreach( $sectionData as $key => $value )
				{
					if( isset( $comments[$sectionName][$key] ) )
					{
						$matches	= array();
						if( preg_match_all( $pattern, $comments[$sectionName][$key], $matches ) )
						{
							$type		= $matches[1][0];
							settype( $value, $type );
						}
					}
					$this->pairs[$sectionName.".".$key]	= $value;
				}
			}
		}
	}
1306371
public function load(InputInterface $input): ConfigInterface
    {
        $configFile = $input->getOption('config');
        if (!$configFile || !$this->filesystem->fileExists($configFile)) {
            throw InvalidArgumentException::invalidConfigFile();
        }
        $config = include $configFile;
        if (!$config instanceof ConfigInterface) {
            throw InvalidArgumentException::invalidConfigFile();
        }

        return $config;
    }
149969
protected function loadClient(): void
    {
        if (self::$client === null) {
            $options = $this->options;

            if (!isset($options['servlet_address'])) {
                throw new Exception\InvalidArgumentException(__METHOD__.' Missing required parameter servlet_address');
            }

            $connection = static::parseServletUrl($options['servlet_address']);

            $params = new ArrayObject([
                Client::PARAM_JAVA_HOSTS => $connection['servlet_host'],
                Client::PARAM_JAVA_SERVLET => $connection['servlet_uri'],
                Client::PARAM_JAVA_AUTH_USER => $connection['auth_user'],
                Client::PARAM_JAVA_AUTH_PASSWORD => $connection['auth_password'],
                Client::PARAM_JAVA_DISABLE_AUTOLOAD => $options['java_disable_autoload'],
                Client::PARAM_JAVA_PREFER_VALUES => $options['java_prefer_values'],
                Client::PARAM_JAVA_SEND_SIZE => $options['java_send_size'],
                Client::PARAM_JAVA_RECV_SIZE => $options['java_recv_size'],
                Client::PARAM_JAVA_LOG_LEVEL => $options['java_log_level'],
                Client::PARAM_XML_PARSER_FORCE_SIMPLE_PARSER => $options['force_simple_xml_parser'],
                Client::PARAM_USE_PERSISTENT_CONNECTION => $options['use_persistent_connection']
            ]);

            self::$client = new Client($params, $this->logger);

            // Added in order to work with custom exceptions
            self::getClient()->throwExceptionProxyFactory = new Proxy\DefaultThrowExceptionProxyFactory(self::$client, $this->logger);

            $this->bootstrap();
        }
    }
50683
private function _parseIni($iniFile)
    {
        $aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
        $tmpArray = array();
        foreach ($aParsedIni as $key=>$value) {
            if (strpos($key, ':') !== false) {
                $sections = explode(':', $key);
                if (count($sections) != 2) {
                    throw new Exception('Malformed section header!');
                }
                $currentSection = trim($sections[0]);
                $parentSection = trim($sections[1]);
                $value = array_merge_recursive(
                    $aParsedIni[$parentSection],
                    $aParsedIni[$key]
                );
                $aParsedIni[$currentSection] = $value;
                unset($aParsedIni[$key]);
                $key = $currentSection;
            }
            if (is_array($value)) {
                foreach ($value as $vk=>$vv) {
                    $newKey = $key.".".$vk;
                    $tmpArray[$newKey] = $vv;
                    if (
                           is_string($vv) &&
                           preg_match_all('/\${([a-zA-Z0-9\.]+)}/', $vv, $match)
                        ) {
                        if (!isset($match[1])) {
                            continue;
                        }
                        $variableKey = $match[1];
                        foreach ($variableKey as &$var) {
                            if (strpos($var, '.') === false) {
                                $var = $key . '.' . $var;
                            }
                        }
                        $this->_varDeps[$newKey] = $variableKey;
                    }
                }
            }
        }
        if (!empty($tmpArray)) {
            $aParsedIni = $tmpArray;
        }
        foreach ($aParsedIni as $key=>$value) {    //extract parsed array keys
            if (array_key_exists($key, $this->_varDeps)) {
                $deps = &$this->_varDeps;
                $value = preg_replace_callback(
                    '/\${([a-zA-Z0-9\.]+)}/',
                    function ($match) use ($key, $aParsedIni, &$deps) {
                        return $aParsedIni[array_shift($deps[$key])];
                    },
                    $value
                );
                $aParsedIni[$key] = $value;
            }
            $this->_tmpValue = $value;//set temporay value to current ini value
            $aXKey = explode($this->_delimiter, $key);    //get ini key segments
            //set object properties recursively based on parsed ini
            $this->_recursiveInit($this->_obj, $aXKey);
        }
    }
687618
public function loadConfigurationFile($file)
    {
        if (!file_exists($file)) {
            throw new \InvalidArgumentException(sprintf('Configuration file "%s" not found', $file));
        }
        $this->loadedConfig = Yaml::parse(file_get_contents($file));

        return $this;
    }
372118
public static function init($configFile = null)
    {
        if (!version_compare(PHP_VERSION, '5.6.0', '>=')) {
            Daemon::log('PHP >= 5.6.0 required.');
            return;
        }

        //run without composer
        if (!function_exists('setTimeout')) {
            require 'PHPDaemon/Utils/func.php';
        }

        Daemon::initSettings();
        FileSystem::init();
        Daemon::$runName = basename($_SERVER['argv'][0]);

        $error = false;
        $argv = $_SERVER['argv'];
        $runmode = isset($argv[1]) ? str_replace('-', '', $argv[1]) : '';
        $args = Bootstrap::getArgs($argv);

        if (!isset(self::$params[$runmode]) && !in_array($runmode, self::$commands)) {
            if ('' !== $runmode) {
                echo('Unrecognized command: ' . $runmode . "\n");
            }

            self::printUsage();
            exit;
        } elseif ('help' === $runmode) {
            self::printHelp();
            exit;
        }

        $n = null;
        if ('log' === $runmode) {
            if (isset($args['n'])) {
                $n = $args['n'];
                unset($args['n']);
            } else {
                $n = 20;
            }
        }

        if (isset($configFile)) {
            Daemon::$config->configfile->setHumanValue($configFile);
        }
        if (isset($args['configfile'])) {
            Daemon::$config->configfile->setHumanValue($args['configfile']);
        }

        if (!Daemon::$config->loadCmdLineArgs($args)) {
            $error = true;
        }

        if (!Daemon::loadConfig(Daemon::$config->configfile->value)) {
            $error = true;
        }

        if ('log' === $runmode) {
            passthru('tail -n ' . $n . ' -f ' . escapeshellarg(Daemon::$config->logstorage->value));
            exit;
        }

        if (extension_loaded('apc') && ini_get('apc.enabled')) {
            Daemon::log('Detected pecl-apc extension enabled. Usage of bytecode caching (APC/eAccelerator/xcache/...)  makes no sense at all in case of using phpDaemon \'cause phpDaemon includes files just in time itself.');
        }

        if (isset(Daemon::$config->locale->value) && Daemon::$config->locale->value !== '') {
            setlocale(LC_ALL, array_map('trim', explode(',', Daemon::$config->locale->value)));
        }

        if (Daemon::$config->autoreimport->value && !is_callable('runkit_import')) {
            Daemon::log('[WARN] runkit extension not found. You should install it or disable --auto-reimport. Non-critical error.');
        }

        if (!is_callable('posix_kill')) {
            Daemon::log('[EMERG] Posix not found. You should compile PHP without \'--disable-posix\'.');
            $error = true;
        }

        if (!is_callable('pcntl_signal')) {
            Daemon::log('[EMERG] PCNTL not found. You should compile PHP with \'--enable-pcntl\'.');
            $error = true;
        }

        if (extension_loaded('libevent')) {
            Daemon::log('[EMERG] libevent extension found. You have to remove libevent.so extension.');
            $error = true;
        }

        $eventVer = '1.6.1';
        $eventVerType = 'stable';
        if (!Daemon::loadModuleIfAbsent('event', $eventVer . '-' . $eventVerType)) {
            Daemon::log('[EMERG] event extension >= ' . $eventVer . ' not found (or OUTDATED). You have to install it. `pecl install http://pecl.php.net/get/event`');
            $error = true;
        }

        if (!is_callable('socket_create')) {
            Daemon::log('[EMERG] Sockets extension not found. You should compile PHP with \'--enable-sockets\'.');
            $error = true;
        }

        if (!is_callable('shmop_open')) {
            Daemon::log('[EMERG] Shmop extension not found. You should compile PHP with \'--enable-shmop\'.');
            $error = true;
        }

        if (!isset(Daemon::$config->user)) {
            Daemon::log('[EMERG] You must set \'user\' parameter.');
            $error = true;
        }

        if (!isset(Daemon::$config->path)) {
            Daemon::log('[EMERG] You must set \'path\' parameter (path to your application resolver).');
            $error = true;
        }

        if (!file_exists(Daemon::$config->pidfile->value)) {
            if (!touch(Daemon::$config->pidfile->value)) {
                Daemon::log('[EMERG] Couldn\'t create pid-file \'' . Daemon::$config->pidfile->value . '\'.');
                $error = true;
            }

            Bootstrap::$pid = 0;
        } elseif (!is_file(Daemon::$config->pidfile->value)) {
            Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be a regular file.');
            Bootstrap::$pid = false;
            $error = true;
        } elseif (!is_writable(Daemon::$config->pidfile->value)) {
            Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be writable.');
            $error = true;
        } elseif (!is_readable(Daemon::$config->pidfile->value)) {
            Daemon::log('Pid-file \'' . Daemon::$config->pidfile->value . '\' must be readable.');
            Bootstrap::$pid = false;
            $error = true;
        } else {
            Bootstrap::$pid = (int)file_get_contents(Daemon::$config->pidfile->value);
        }

        if (Daemon::$config->chroot->value !== '/') {
            if (posix_getuid() != 0) {
                Daemon::log('You must have the root privileges to change root.');
                $error = true;
            }
        }

        $pathList = preg_split('~\s*;\s*~', Daemon::$config->path->value);
        $found = false;
        foreach ($pathList as $path) {
            if (@is_file($path)) {
                Daemon::$appResolverPath = $path;
                $found = true;
                break;
            }
        }
        if (!$found) {
            Daemon::log('Your application resolver \'' . Daemon::$config->path->value . '\' is not available (config directive \'path\').');
            $error = true;
        }

        Daemon::$appResolver = require Daemon::$appResolverPath;

        if (isset(Daemon::$config->group->value) && is_callable('posix_getgid')) {
            if (($sg = posix_getgrnam(Daemon::$config->group->value)) === false) {
                Daemon::log('Unexisting group \'' . Daemon::$config->group->value . '\'. You have to replace config-variable \'group\' with existing group-name.');
                $error = true;
            } elseif (($sg['gid'] != posix_getgid()) && (posix_getuid() != 0)) {
                Daemon::log('You must have the root privileges to change group.');
                $error = true;
            }
        }

        if (isset(Daemon::$config->user->value) && is_callable('posix_getuid')) {
            if (($su = posix_getpwnam(Daemon::$config->user->value)) === false) {
                Daemon::log('Unexisting user \'' . Daemon::$config->user->value . '\', user not found. You have to replace config-variable \'user\' with existing username.');
                $error = true;
            } elseif (($su['uid'] != posix_getuid()) && (posix_getuid() != 0)) {
                Daemon::log('You must have the root privileges to change user.');
                $error = true;
            }
        }

        if (isset(Daemon::$config->minspareworkers->value)
            && Daemon::$config->minspareworkers->value > 0
            && isset(Daemon::$config->maxspareworkers->value)
            && Daemon::$config->maxspareworkers->value > 0
        ) {
            if (Daemon::$config->minspareworkers->value > Daemon::$config->maxspareworkers->value) {
                Daemon::log('\'minspareworkers\' cannot be greater than \'maxspareworkers\'.');
                $error = true;
            }
        }

        if (isset(Daemon::$config->addincludepath->value)) {
            ini_set(
                'include_path',
                ini_get('include_path') . ':' . implode(':', Daemon::$config->addincludepath->value)
            );
        }

        if (isset(Daemon::$config->minworkers->value) && isset(Daemon::$config->maxworkers->value)) {
            if (Daemon::$config->minworkers->value > Daemon::$config->maxworkers->value) {
                Daemon::$config->minworkers->value = Daemon::$config->maxworkers->value;
            }
        }

        if ($runmode === 'start') {
            if ($error === false) {
                Bootstrap::start();
            } else {
                exit(6);
            }
        } elseif ($runmode === 'runworker') {
            if ($error === false) {
                Bootstrap::runworker();
            } else {
                exit(6);
            }
        } elseif ($runmode === 'status' || $runmode === 'fullstatus') {
            $status = Bootstrap::$pid && Thread\Generic::ifExistsByPid(Bootstrap::$pid);
            echo '[STATUS] phpDaemon ' . Daemon::$version . ' is ' . ($status ? 'running' : 'NOT running') . ' (' . Daemon::$config->pidfile->value . ").\n";

            if ($status && ($runmode === 'fullstatus')) {
                echo 'Uptime: ' . DateTime::diffAsText(filemtime(Daemon::$config->pidfile->value), time()) . "\n";

                Daemon::$shm_wstate = new ShmEntity(Daemon::$config->pidfile->value, Daemon::SHM_WSTATE_SIZE, 'wstate');

                $stat = Daemon::getStateOfWorkers();

                echo "State of workers:\n";
                echo "\tTotal: " . $stat['alive'] . "\n";
                echo "\tIdle: " . $stat['idle'] . "\n";
                echo "\tBusy: " . $stat['busy'] . "\n";
                echo "\tShutdown: " . $stat['shutdown'] . "\n";
                echo "\tPre-init: " . $stat['preinit'] . "\n";
                echo "\tInit: " . $stat['init'] . "\n";
            }

            echo "\n";
        } elseif ($runmode === 'update') {
            if ((!Bootstrap::$pid) || (!posix_kill(Bootstrap::$pid, SIGHUP))) {
                echo '[UPDATE] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
            }
        } elseif ($runmode === 'reopenlog') {
            if ((!Bootstrap::$pid) || (!posix_kill(Bootstrap::$pid, SIGUSR1))) {
                echo '[REOPEN-LOG] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
            }
        } elseif ($runmode === 'reload') {
            if ((!Bootstrap::$pid) || (!posix_kill(Bootstrap::$pid, SIGUSR2))) {
                echo '[RELOAD] ERROR. It seems that phpDaemon is not running' . (Bootstrap::$pid ? ' (PID ' . Bootstrap::$pid . ')' : '') . ".\n";
            }
        } elseif ($runmode === 'restart') {
            if ($error === false) {
                Bootstrap::stop(2);
                Bootstrap::start();
            }
        } elseif ($runmode === 'hardrestart') {
            Bootstrap::stop(3);
            Bootstrap::start();
        } elseif ($runmode === 'ipcpath') {
            $i = Daemon::$appResolver->getInstanceByAppName('\PHPDaemon\IPCManager\IPCManager');
            echo $i->getSocketUrl() . PHP_EOL;
        } elseif ($runmode === 'configtest') {
            $term = new Terminal;
            $term->enableColor();

            echo "\n";

            $rows = [];

            $rows[] = [
                'parameter' => 'PARAMETER',
                'value' => 'VALUE',
                '_color' => '37',
                '_bold' => true,
            ];

            foreach (Daemon::$config as $name => $entry) {
                if (!$entry instanceof Generic) {
                    continue;
                }

                $row = [
                    'parameter' => $name,
                    'value' => var_export($entry->humanValue, true),
                ];

                if ($entry->defaultValue != $entry->humanValue) {
                    $row['value'] .= ' (' . var_export($entry->defaultValue, true) . ')';
                }

                $rows[] = $row;
            }

            $term->drawtable($rows);

            echo "\n";
        } elseif ($runmode === 'stop') {
            Bootstrap::stop();
        } elseif ($runmode === 'gracefulstop') {
            Bootstrap::stop(4);
        } elseif ($runmode === 'hardstop') {
            echo '[HARDSTOP] Sending SIGINT to ' . Bootstrap::$pid . '... ';

            $ok = Bootstrap::$pid && posix_kill(Bootstrap::$pid, SIGINT);

            echo $ok ? 'OK.' : 'ERROR. It seems that phpDaemon is not running.';

            if ($ok) {
                $i = 0;

                while ($r = Thread\Generic::ifExistsByPid(Bootstrap::$pid)) {
                    usleep(500000);

                    if ($i === 9) {
                        echo "\nphpDaemon master-process hasn't finished. Sending SIGKILL... ";
                        posix_kill(Bootstrap::$pid, SIGKILL);
                        sleep(0.2);
                        if (!Thread\Generic::ifExistsByPid(Bootstrap::$pid)) {
                            echo " Oh, his blood is on my hands :'(";
                        } else {
                            echo "ERROR: Process alive. Permissions?";
                        }

                        break;
                    }

                    ++$i;
                }
            }

            echo "\n";
        }
    }
774370
private function readConfigurationFile(string $configFilename): void
  {
    // Read the configuration file.
    $settings = parse_ini_file($configFilename, true);

    // Set default values.
    if (!isset($settings['wrapper']['lob_as_string']))
    {
      $settings['wrapper']['lob_as_string'] = false;
    }

    if (!isset($settings['wrapper']['strict_types']))
    {
      $settings['wrapper']['strict_types'] = true;
    }

    $this->wrapperClassName = self::getSetting($settings, false, 'wrapper', 'wrapper_class');
    if ($this->wrapperClassName!==null)
    {
      $this->parentClassName  = self::getSetting($settings, true, 'wrapper', 'parent_class');
      $this->nameMangler      = self::getSetting($settings, true, 'wrapper', 'mangler_class');
      $this->wrapperFilename  = self::getSetting($settings, true, 'wrapper', 'wrapper_file');
      $this->lobAsString      = !empty(self::getSetting($settings, true, 'wrapper', 'lob_as_string'));
      $this->metadataFilename = self::getSetting($settings, true, 'loader', 'metadata');
      $this->wrapperClassType = self::getSetting($settings, true, 'wrapper', 'wrapper_type');
      $this->strictTypes      = !empty(self::getSetting($settings, true, 'wrapper', 'strict_types'));
    }
  }
14077
public function setOnDiskConfiguration(?string $configFile = null): ConfigurationBuilder
    {
        $this->configFile = $configFile;

        if ($this->configFile) {
            if (file_exists($path = getcwd() . '/' . $this->configFile)) {
                $this->configFile = $path;
            }

            if (!file_exists($this->configFile)) {
                throw new \InvalidArgumentException('The specified config file is not a valid file.');
            }

            $info = pathinfo($this->configFile);

            $fileExt = strtolower($info['extension']);

            switch ($fileExt) {
                case 'xml':
                    $diskConfig = $this->loadXmlFile($this->configFile);
                    break;

                case 'yml':
                case 'yaml':
                    $diskConfig = Yaml::parse(file_get_contents($this->configFile));
                    break;

                default:
                    throw new \InvalidArgumentException(
                        sprintf(
                            'The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]',
                            $fileExt
                        )
                    );
            }

            $this->configParams = array_merge($this->configParams, $diskConfig);
        }

        return $this;
    }
1027840
function findInputFiles( &$inputFiles, &$iniFile )
    {
        $iniFile = __DIR__ . "/../../../";
        if ( $this->RootDir !== false )
            $iniFile .= eZDir::path( array( $this->RootDir, $this->FileName ) );
        else
            $iniFile .= eZDir::path( array( $this->FileName ) );

        $inputFiles = array();

        if ( $this->FileName === 'override.ini' )
        {
            eZExtension::prependExtensionSiteAccesses( false, $this, true, false, false );
        }

        if ( file_exists( $iniFile ) )
            $inputFiles[] = $iniFile;

        // try the same file name with '.append.php' replace with '.append'
        if ( strpos($iniFile, '.append.php') !== false && preg_match('#^(.+.append).php$#i', $iniFile, $matches ) && file_exists( $matches[1] ) )
            $inputFiles[] = $matches[1];

        if ( strpos($iniFile, '.php') === false && file_exists ( $iniFile . '.php' ) )
            $inputFiles[] = $iniFile . '.php';

        if ( $this->DirectAccess )
        {
            if ( file_exists ( $iniFile . '.append' ) )
            {
                // recursion eZDebug::writeStrict( "INI files with *.ini.append suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $iniFile.append", __METHOD__ );
                $inputFiles[] = $iniFile . '.append';
            }

            if ( file_exists ( $iniFile . '.append.php' ) )
                $inputFiles[] = $iniFile . '.append.php';
        }
        else
        {
            $overrideDirs = $this->overrideDirs();
            $fileName = $this->FileName;
            $rootDir = $this->RootDir;
            foreach ( $overrideDirs as $overrideDirItem )
            {
                $overrideDir = $overrideDirItem[0];
                $isGlobal = $overrideDirItem[1];
                if ( $isGlobal )
                    $overrideFile = eZDir::path( array( $overrideDir, $fileName ) );
                 else
                    $overrideFile = eZDir::path( array( $rootDir, $overrideDir, $fileName ) );

                if ( file_exists( $overrideFile . '.php' ) )
                {
                    // recursion eZDebug::writeStrict( "INI files with *.ini.php suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $overrideFile.php", __METHOD__ );
                    $inputFiles[] = $overrideFile . '.php';
                }

                if ( file_exists( $overrideFile ) )
                {
                    $inputFiles[] = $overrideFile;
                }

                if ( file_exists( $overrideFile . '.append.php' ) )
                {
                    $inputFiles[] = $overrideFile . '.append.php';
                }

                if ( file_exists( $overrideFile . '.append' ) )
                {
                    // recursion eZDebug::writeStrict( "INI files with *.ini.append suffix is DEPRECATED, use *.ini or *.ini.append.php instead: $overrideFile.append", __METHOD__ );
                    $inputFiles[] = $overrideFile . '.append';
                }
            }
        }
    }
871884
public function load(string $path, string ...$paths): void
    {
        array_unshift($paths, $path);
        foreach ($paths as $path) {
            if (!is_readable($path) || is_dir($path) || ($contents = parse_ini_file($path, false)) === false) {
                throw new InvalidArgumentException("{$path} is not a readable file.");
            }
            $this->populate($contents);
        }
    }
727565
public static function loadINI($filepath,$prefix_path=null){
    $results = parse_ini_file($filepath,true);
    if($results) {
      $results = static::filterWith(["load.ini", "load"], $results);
      static::loadArray($results,$prefix_path);
    }
  }
1115475
public function reload($defaultSettingsFiles = array(), $userSettingsFile = null)
    {
        if (!empty($defaultSettingsFiles)
            || !empty($userSettingsFile)
        ) {
            $this->resetSettingsChain($defaultSettingsFiles, $userSettingsFile);
        }

        $reader = new IniReader();
        foreach ($this->settingsChain as $file => $ignore) {
            if (is_readable($file)) {
                try {
                    $contents = $reader->readFile($file);
                    $this->settingsChain[$file] = $this->decodeValues($contents);
                } catch (IniReadingException $ex) {
                    throw new IniReadingException('Unable to read INI file {' . $file . '}: ' . $ex->getMessage() . "\n Your host may have disabled parse_ini_file().");
                }

                $this->decodeValues($this->settingsChain[$file]);
            }
        }

        $merged = $this->mergeFileSettings();
        // remove reference to $this->settingsChain... otherwise dump() or compareElements() will never notice a difference
        // on PHP 7+ as they would be always equal
        $this->mergedSettings = $this->copy($merged);
    }
592021
private function loadXmlFile(string $configFile): array
    {
        $xml = simplexml_load_file($configFile);
        $configArr = [];

        if (isset($xml->name)) {
            $configArr['name'] = (string) $xml->name;
        }

        if (isset($xml->database['name'])) {
            $configArr['database'] = (string) $xml->database['name'];
        }

        if (isset($xml->collection['name'])) {
            $configArr['collection_name'] = (string) $xml->collection['name'];
        }

        if (isset($xml->{'migrations-namespace'})) {
            $configArr['migrations_namespace'] = (string) $xml->{'migrations-namespace'};
        }

        if (isset($xml->{'migrations-directory'})) {
            $configArr['migrations_directory'] = (string) $xml->{'migrations-directory'};
        }

        if (isset($xml->{'migrations-script-directory'})) {
            $configArr['migrations_script_directory'] = (string) $xml->{'migrations-script-directory'};
        }

        if (isset($xml->migrations->migration)) {
            foreach ($xml->migrations->migration as $migration) {
                $configArr['migrations'][] = [
                    'version' => $migration['version'],
                    'class' => $migration['class'],
                ];
            }
        }

        return $configArr;
    }