<commit_before><?php

/**
 * Item name
 *
 * Info
 *
 * @author <NAME> <<EMAIL>>
 * @link http://inji.ru/
 * @copyright 2015 <NAME>
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
 */
class Exchange1cController extends adminController {

    function reExchangeAction() {

        $reExchange = Exchange1c\Exchange::get((int) $_GET['item_pk']);

        $exchange = new \Exchange1c\Exchange();
        $exchange->type = $reExchange->type;
        $exchange->save();
        $exchange->path = App::$primary->path . '/tmp/Exchange1c/' . date('Y-m-d') . '/' . $exchange->id;
        Tools::createDir($exchange->path);
        $exchange->save();

        foreach ($reExchange->files as $reFile) {
            if (strpos($reFile->name, '/')) {
                Tools::createDir($exchange->path . '/' . substr($reFile->name, 0, strrpos($reFile->name, '/')));
            }
            copy($reExchange->path . '/' . $reFile->name, $exchange->path . '/' . $reFile->name);
        }
        foreach ($reExchange->logs as $reLog) {
            if (!in_array($reLog->info, ['import'])) {
                continue;
            }
            $_GET = json_decode($reLog->query,true);

            $log = new \Exchange1c\Exchange\Log();
            $log->exchange_id = $exchange->id;
            $log->type = 'mode';
            $log->info = $reLog->info;
            $log->status = 'process';
            $log->query = $reLog->query;
            $log->save();


            $modeClass = 'Exchange1c\Mode\\' . ucfirst(strtolower($log->info));
            if (!class_exists($modeClass)) {
                $log->status = 'failure';
                $log->info = 'mode class ' . $modeClass . ' not found';
                $log->date_end = date('Y-m-d H:i:s');
                $log->save();
            }
            $mode = new $modeClass;
            $mode->exchange = $exchange;
            $mode->log = $log;
            $mode->process();
        }
        Tools::redirect('/admin/exchange1c/Exchange');
    }

}<commit_msg>copy dir without db rows fetch<commit_after><?php

/**
 * Item name
 *
 * Info
 *
 * @author <NAME> <<EMAIL>>
 * @link http://inji.ru/
 * @copyright 2015 <NAME>
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
 */
class Exchange1cController extends adminController {

    function reExchangeAction() {

        $reExchange = Exchange1c\Exchange::get((int) $_GET['item_pk']);

        $exchange = new \Exchange1c\Exchange();
        $exchange->type = $reExchange->type;
        $exchange->save();
        $exchange->path = App::$primary->path . '/tmp/Exchange1c/' . date('Y-m-d') . '/' . $exchange->id;
        Tools::createDir($exchange->path);
        $exchange->save();

        Tools::copyFiles($reExchange->path, $exchange->path);

        foreach ($reExchange->logs as $reLog) {
            if (!in_array($reLog->info, ['import'])) {
                continue;
            }
            $_GET = json_decode($reLog->query, true);

            $log = new \Exchange1c\Exchange\Log();
            $log->exchange_id = $exchange->id;
            $log->type = 'mode';
            $log->info = $reLog->info;
            $log->status = 'process';
            $log->query = $reLog->query;
            $log->save();


            $modeClass = 'Exchange1c\Mode\\' . ucfirst(strtolower($log->info));
            if (!class_exists($modeClass)) {
                $log->status = 'failure';
                $log->info = 'mode class ' . $modeClass . ' not found';
                $log->date_end = date('Y-m-d H:i:s');
                $log->save();
            }
            $mode = new $modeClass;
            $mode->exchange = $exchange;
            $mode->log = $log;
            $mode->process();
        }
        Tools::redirect('/admin/exchange1c/Exchange');
    }

}
{'fraction_non_alphanumeric': 0.18635170603674542, 'fraction_numerical': 0.006036745406824147, 'mean_word_length': 1.8805744520030234, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 78, 'https://': 2, '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': '4825133', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1137, 'n_words': 194}