<commit_before><?php
class Vps_Component_Cache_Meta_Static_ComponentLink extends Vps_Component_Cache_Meta_Static_Model
{
    public function __construct($model, $pattern = '{id}')
    {
        parent::__construct($model, $pattern);
    }

    public static function getDeleteWhere($pattern, $row)
    {
        $ret = parent::getDeleteWhere($pattern, $row);
        $ret['type'] = array('componentlink');
        if ($row->getModel() instanceof Vpc_Root_Category_GeneratorModel) {
            $ret['db_id'] = array_merge(
                array($ret['db_id']),
                self::_getRecursiveIds($ret['db_id'], $row->getModel())
            );
        }
        return $ret;
    }

    private static function _getRecursiveIds($parentId, $model)
    {
        $ret = $model->getIds(
            $model->select()->whereEquals('parent_id', $parentId)
        );
        foreach ($ret as $id) {
            $ret = array_merge($ret, self::_getRecursiveIds($id, $model));
        }
        return $ret;
    }
}<commit_msg>Cache loeschen ComponentLink-Meta an aktuelle Schreibweise angepasst<commit_after><?php
class Vps_Component_Cache_Meta_Static_ComponentLink extends Vps_Component_Cache_Meta_Static_Model
{
    public function __construct($model, $pattern = '{id}')
    {
        parent::__construct($model, $pattern);
    }

    public static function getDeleteWhere($pattern, $row)
    {
        $ret = parent::getDeleteWhere($pattern, $row);
        $ret['type'] = array('componentLink');
        if ($row->getModel() instanceof Vpc_Root_Category_GeneratorModel) {
            $ret['db_id'] = array_merge(
                array($ret['db_id']),
                self::_getRecursiveIds($ret['db_id'], $row->getModel())
            );
        }
        return $ret;
    }

    private static function _getRecursiveIds($parentId, $model)
    {
        $ret = $model->getIds(
            $model->select()->whereEquals('parent_id', $parentId)
        );
        foreach ($ret as $id) {
            $ret = array_merge($ret, self::_getRecursiveIds($id, $model));
        }
        return $ret;
    }
}
{'fraction_non_alphanumeric': 0.14163090128755365, 'fraction_numerical': 0.0, 'mean_word_length': 2.667832167832168, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2973313', 'n_tokens_mistral': 631, 'n_tokens_neox': 630, 'n_words': 110}