<commit_before><?php
require_once 'Zend/Config/Ini.php';

class Vps_Config_Web extends Zend_Config_Ini
{
    public static function getInstance($section)
    {
        static $instances = array();
        if (!isset($instances[$section])) {
            require_once 'Vps/Config/Cache.php';
            $cache = Vps_Config_Cache::getInstance();
            $cacheId = 'config_'.str_replace('-', '_', $section);
            $configClass = Vps_Setup::$configClass;
            require_once str_replace('_', '/', $configClass).'.php';
            if(!$ret = $cache->load($cacheId)) {
                $ret = new $configClass($section);
                $mtime = time();
                $cache->save($ret, $cacheId);
            }
            $instances[$section] = $ret;
        }
        return $instances[$section];
    }

    public static function getInstanceMtime($section)
    {
        require_once 'Vps/Config/Cache.php';
        $cache = Vps_Config_Cache::getInstance();
        return $cache->test('config_'.str_replace('-', '_', $section));
    }

    public function __construct($section, $options = array())
    {
        if (isset($options['vpsPath'])) {
            $vpsPath = $options['vpsPath'];
        } else {
            $vpsPath = VPS_PATH;
        }
        if (isset($options['webPath'])) {
            $webPath = $options['webPath'];
        } else {
            $webPath = '.';
        }
        $vpsSection = 'vivid';

        $vpsConfigFull = new Zend_Config_Ini($vpsPath.'/config.ini', null);
        if (isset($vpsConfigFull->$section)) {
            $vpsSection = $section;
        }

        parent::__construct($vpsPath.'/config.ini', $vpsSection,
                        array('allowModifications'=>true));



        $this->_mergeWebConfig($webPath.'/application/config.ini', $section);

        $v = $this->application->vps->version;
        if (preg_match('#tags/vps/([^/]+)/config\\.ini#', $v, $m)) {
            $v = $m[1];
        } else if (preg_match('#branches/vps/([^/]+)/config\\.ini#', $v, $m)) {
            $v = 'Branch '.$m[1];
        } else if (preg_match('#trunk/vps/config\\.ini#', $v, $m)) {
            $v = 'Trunk';
        }
        $this->application->vps->version = $v;
        if (preg_match('/Revision: ([0-9]+)/', $this->application->vps->revision, $m)) {
            $this->application->vps->revision = (int)$m[1];
        }<commit_msg>vpsConfigSection zum auswählen der vps config section; nich tmehr vivid als standardwert<commit_after><?php
require_once 'Zend/Config/Ini.php';

class Vps_Config_Web extends Zend_Config_Ini
{
    public static function getInstance($section)
    {
        static $instances = array();
        if (!isset($instances[$section])) {
            require_once 'Vps/Config/Cache.php';
            $cache = Vps_Config_Cache::getInstance();
            $cacheId = 'config_'.str_replace('-', '_', $section);
            $configClass = Vps_Setup::$configClass;
            require_once str_replace('_', '/', $configClass).'.php';
            if(!$ret = $cache->load($cacheId)) {
                $ret = new $configClass($section);
                $mtime = time();
                $cache->save($ret, $cacheId);
            }
            $instances[$section] = $ret;
        }
        return $instances[$section];
    }

    public static function getInstanceMtime($section)
    {
        require_once 'Vps/Config/Cache.php';
        $cache = Vps_Config_Cache::getInstance();
        return $cache->test('config_'.str_replace('-', '_', $section));
    }

    public function __construct($section, $options = array())
    {
        if (isset($options['vpsPath'])) {
            $vpsPath = $options['vpsPath'];
        } else {
            $vpsPath = VPS_PATH;
        }
        if (isset($options['webPath'])) {
            $webPath = $options['webPath'];
        } else {
            $webPath = '.';
        }

        $vpsSection = false;
        $webConfig = new Zend_Config_Ini($webPath.'/config.ini', $section);
        if (!empty($webConfig->vpsConfigSection)) {
            $vpsSection = $webConfig->vpsConfigSection;
        } else {
            $vpsConfigFull = new Zend_Config_Ini($vpsPath.'/config.ini', null);
            if (isset($vpsConfigFull->$section)) {
                $vpsSection = $section;
            }
        }
        if (!$vpsSection) {
            throw new Vps_Exception("Add either '$section' to vps/config.ini or set vpsConfigSection in web config.ini");
        }

        parent::__construct($vpsPath.'/config.ini', $vpsSection,
                        array('allowModifications'=>true));



        $this->_mergeWebConfig($webPath.'/application/config.ini', $section);

        $v = $this->application->vps->version;
        if (preg_match('#tags/vps/([^/]+)/config\\.ini#', $v, $m)) {
            $v = $m[1];
        } else if (preg_match('#branches/vps/([^/]+)/config\\.ini#', $v, $m)) {
            $v = 'Branch '.$m[1];
        } else if (preg_match('#trunk/vps/config\\.ini#', $v, $m)) {
            $v = 'Trunk';
        }
        $this->application->vps->version = $v;
        if (preg_match('/Revision: ([0-9]+)/', $this->application->vps->revision, $m)) {
            $this->application->vps->revision = (int)$m[1];
        }
{'fraction_non_alphanumeric': 0.17899351887152115, 'fraction_numerical': 0.0019062142584826535, 'mean_word_length': 2.119500594530321, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5171843', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1633, 'n_words': 269}