<commit_before><?php
class Vps_Update_35000 extends Vps_Update
{
    public function update()
    {
        parent::update();

        $db = Vps_Registry::get('db');

        $fields = array();

        $dir = new DirectoryIterator('application/models');
        foreach ($dir as $file) {
            if ($file->isDir() || $file->isDot()) continue;
            $name = substr($file, 0, -4);
            if ($name != '.direc' && is_instance_of($name, 'Vps_Model_Abstract')) {
                try {
                    $model = Vps_Model_Abstract::getInstance($name);
                    $fields = array_merge($fields, $this->_getFieldModelData($model));
                } catch (Exception $e) {
                    echo "Model $name konnte nicht auf Vps_Model_Field geprueft werden.";
                }
            }
        }

        foreach (Vpc_Abstract::getComponentClasses() as $class) {
            if (is_instance_of($class, 'Vpc_Basic_Text_Component')) {
                $model = Vpc_Basic_Text_Component::getTextModel($class);
            } else {
                $model = Vpc_Abstract::createOwnModel($class);
            }
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }

            $model = Vpc_Abstract::createChildModel($class);
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }

            $model = Vpc_Abstract::createFormModel($class);
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }
        }

        if ($db->fetchOne("SHOW TABLES LIKE 'vps_enquiries'")) {
            $fields['vps_enquiries'] = array('serialized_mail_vars', 'serialized_mail_essentials');
        }

        $db->query("SET NAMES utf8");
        foreach ($fields as $tablename => $fieldnames) {
            // checken, ob das feld wirklich in der datenbank-tabelle existiert
            // wenn das entsprechende feld nicht existiert, würde sonst ein fehler auftreten.<commit_msg>das 35000er fuer Text StylesModel anpassen<commit_after><?php
class Vps_Update_35000 extends Vps_Update
{
    public function update()
    {
        parent::update();

        $db = Vps_Registry::get('db');

        $fields = array();

        $dir = new DirectoryIterator('application/models');
        foreach ($dir as $file) {
            if ($file->isDir() || $file->isDot()) continue;
            $name = substr($file, 0, -4);
            if ($name != '.direc' && is_instance_of($name, 'Vps_Model_Abstract')) {
                try {
                    $model = Vps_Model_Abstract::getInstance($name);
                    $fields = array_merge($fields, $this->_getFieldModelData($model));
                } catch (Exception $e) {
                    echo "Model $name konnte nicht auf Vps_Model_Field geprueft werden.";
                }
            }
        }

        foreach (Vpc_Abstract::getComponentClasses() as $class) {
            if (is_instance_of($class, 'Vpc_Basic_Text_Component')) {
                $model = Vpc_Basic_Text_Component::getTextModel($class);
            } else {
                $model = Vpc_Abstract::createOwnModel($class);
            }
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }

            if (is_instance_of($class, 'Vpc_Basic_Text_Component')) {
                if (Vpc_Abstract::hasSetting($class, 'stylesModel')) {
                    $stylesModel = Vpc_Abstract::getSetting($class, 'stylesModel');
                    $stylesModel = Vps_Model_Abstract::getInstance($stylesModel);
                    $fields = array_merge($fields, $this->_getFieldModelData($stylesModel));
                }
                $model = Vpc_Basic_Text_Component::getTextModel($class);
            }

            $model = Vpc_Abstract::createChildModel($class);
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }

            $model = Vpc_Abstract::createFormModel($class);
            if ($model) {
                $fields = array_merge($fields, $this->_getFieldModelData($model));
            }
        }

        if ($db->fetchOne("SHOW TABLES LIKE 'vps_enquiries'")) {
            $fields['vps_enquiries'] = array('serialized_mail_vars', 'serialized_mail_essentials');
        }

        $db->query("SET NAMES utf8");
        foreach ($fields as $tablename => $fieldnames) {
            // checken, ob das feld wirklich in der datenbank-tabelle existiert
            // wenn das entsprechende feld nicht existiert, würde sonst ein fehler auftreten.
{'fraction_non_alphanumeric': 0.12963355221351408, 'fraction_numerical': 0.004448210124973522, 'mean_word_length': 2.0347043701799485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '4291659', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1301, 'n_words': 256}