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

class Vps_Config_Web extends Zend_Config_Ini
{
    public function __construct($section)
    {
        $vpsSection = 'vivid';

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

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

        $this->_mergeWebConfig($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];
        }
        foreach ($this->path as $k=>$i) {
            $this->path->$k = str_replace(array('%libraryPath%', '%vpsPath%'),
                                            array($this->libraryPath, VPS_PATH),
                                            $i);
        }
        foreach ($this->includepath as $k=>$i) {
            $this->includepath->$k = str_replace(array('%libraryPath%', '%vpsPath%'),
                                            array($this->libraryPath, VPS_PATH),
                                            $i);
        }
    }

    protected function _mergeWebConfig($section)
    {
        $this->_mergeFile('application/config.ini', $section);
    }

    protected final function _mergeFile($file, $section)
    {
        $webSection = 'vivid';
        $webConfigFull = new Zend_Config_Ini($file, null);
        if (isset($webConfigFull->$section)) {
            $webSection = $section;
        }
        $webConfig = new Zend_Config_Ini($file, $webSection);
        return $this->merge($webConfig);
    }
}<commit_msg>es muss nicht vivid vorhanden sein, fallback zu production<commit_after><?php
require_once 'Zend/Config/Ini.php';

class Vps_Config_Web extends Zend_Config_Ini
{
    public function __construct($section)
    {
        $vpsSection = 'vivid';

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

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

        $this->_mergeWebConfig($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];
        }
        foreach ($this->path as $k=>$i) {
            $this->path->$k = str_replace(array('%libraryPath%', '%vpsPath%'),
                                            array($this->libraryPath, VPS_PATH),
                                            $i);
        }
        foreach ($this->includepath as $k=>$i) {
            $this->includepath->$k = str_replace(array('%libraryPath%', '%vpsPath%'),
                                            array($this->libraryPath, VPS_PATH),
                                            $i);
        }
    }

    protected function _mergeWebConfig($section)
    {
        $this->_mergeFile('application/config.ini', $section);
    }

    protected final function _mergeFile($file, $section)
    {
        $webConfigFull = new Zend_Config_Ini($file, null);
        if (isset($webConfigFull->$section)) {
            $webSection = $section;
        } else if (isset($webConfigFull->vivid)) {
            $webSection = 'vivid';
        } else {
            $webSection = 'production';
        }
        return $this->merge(new Zend_Config_Ini($file, $webSection));
    }
}
{'fraction_non_alphanumeric': 0.17443987197073615, 'fraction_numerical': 0.002286236854138089, 'mean_word_length': 1.8820816864295125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2178673', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1346, 'n_words': 216}