<commit_before><?php
defined('B_PROLOG_INCLUDED') and (B_PROLOG_INCLUDED === true) or die();

use Bitrix\Main\Application;
use Bitrix\Main\IO\File;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\ModuleManager;

Loc::loadMessages(__FILE__);

if (class_exists('newkaliningrad_typografru')) {
    return;
}

class newkaliningrad_typografru extends CModule
{
    /** @var string */
    public $MODULE_ID;

    /** @var string */
    public $MODULE_VERSION;

    /** @var string */
    public $MODULE_VERSION_DATE;

    /** @var string */
    public $MODULE_NAME;

    /** @var string */
    public $MODULE_DESCRIPTION;

    /** @var string */
    public $MODULE_GROUP_RIGHTS;

    /** @var string */
    public $PARTNER_NAME;

    /** @var string */
    public $PARTNER_URI;

    public function __construct()
    {
        $this->MODULE_ID = 'newkaliningrad.typografru';
        include(__DIR__ . '/version.php');
        if (is_array($arModuleVersion) && array_key_exists('VERSION', $arModuleVersion))
        {
            $this->MODULE_VERSION = $arModuleVersion['VERSION'];
            $this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE'];
        }
        $this->MODULE_NAME = Loc::getMessage('NK_TYPOGRAF_MODULE_NAME');
        $this->MODULE_DESCRIPTION = Loc::getMessage('NK_TYPOGRAF_MODULE_DESCRIPTION');
        $this->MODULE_GROUP_RIGHTS = 'N';
        $this->PARTNER_NAME = Loc::getMessage('NK_PARTNER_NAME');
        $this->PARTNER_URI = "https://www.newkaliningrad.ru";
    }

    public function InstallFiles() {

        $rootDir = Application::getDocumentRoot().'/'. ltrim(Application::getPersonalRoot(), '/');
        CopyDirFiles(__DIR__ . '/images' , $rootDir . '/images');
        CopyDirFiles(__DIR__ . '/js' , $rootDir . '/js');
        CopyDirFiles(__DIR__ . '/tools' , $rootDir . '/tools');
    }

    public function UnInstallFiles () {
        $files = [
            'js' => '/js/' .$this->MODULE_ID. '/typograf.js',
            'img' => '/images/' .$this->MODULE_ID. '/typograf.gif',
            'request' => '/tools/' .$this->MODULE_ID. '/typograf.php'
        ];
        $rootDir = Application::getDocumentRoot().'/'. ltrim(Application::getPersonalRoot(), '/');

        foreach ($files as $file) {
            File::deleteFile($rootDir . $file);
        }
    }

    public function DoInstall()
    {
        $this->InstallFiles();
        ModuleManager::registerModule($this->MODULE_ID);
        $eventManager = \Bitrix\Main\EventManager::getInstance();<commit_msg>Fixed module files installtion<commit_after><?php
defined('B_PROLOG_INCLUDED') and (B_PROLOG_INCLUDED === true) or die();

use Bitrix\Main\Application;
use Bitrix\Main\IO\File;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\ModuleManager;

Loc::loadMessages(__FILE__);

if (class_exists('newkaliningrad_typografru')) {
    return;
}

class newkaliningrad_typografru extends CModule
{
    /** @var string */
    public $MODULE_ID;

    /** @var string */
    public $MODULE_VERSION;

    /** @var string */
    public $MODULE_VERSION_DATE;

    /** @var string */
    public $MODULE_NAME;

    /** @var string */
    public $MODULE_DESCRIPTION;

    /** @var string */
    public $MODULE_GROUP_RIGHTS;

    /** @var string */
    public $PARTNER_NAME;

    /** @var string */
    public $PARTNER_URI;

    public function __construct()
    {
        $this->MODULE_ID = 'newkaliningrad.typografru';
        include(__DIR__ . '/version.php');
        if (is_array($arModuleVersion) && array_key_exists('VERSION', $arModuleVersion))
        {
            $this->MODULE_VERSION = $arModuleVersion['VERSION'];
            $this->MODULE_VERSION_DATE = $arModuleVersion['VERSION_DATE'];
        }
        $this->MODULE_NAME = Loc::getMessage('NK_TYPOGRAF_MODULE_NAME');
        $this->MODULE_DESCRIPTION = Loc::getMessage('NK_TYPOGRAF_MODULE_DESCRIPTION');
        $this->MODULE_GROUP_RIGHTS = 'N';
        $this->PARTNER_NAME = Loc::getMessage('NK_PARTNER_NAME');
        $this->PARTNER_URI = "https://www.newkaliningrad.ru";
    }

    public function InstallFiles() {

        $rootDir = Application::getDocumentRoot().'/'. ltrim(Application::getPersonalRoot(), '/');
        CopyDirFiles(__DIR__ . '/images' , $rootDir . '/images', true, true);
        CopyDirFiles(__DIR__ . '/js' , $rootDir . '/js', true, true);
        CopyDirFiles(__DIR__ . '/tools' , $rootDir . '/tools', true, true);
    }

    public function UnInstallFiles () {
        $files = [
            'js' => '/js/' .$this->MODULE_ID. '/typograf.js',
            'img' => '/images/' .$this->MODULE_ID. '/typograf.gif',
            'request' => '/tools/' .$this->MODULE_ID. '/typograf.php'
        ];
        $rootDir = Application::getDocumentRoot().'/'. ltrim(Application::getPersonalRoot(), '/');

        foreach ($files as $file) {
            File::deleteFile($rootDir . $file);
        }
    }

    public function DoInstall()
    {
        $this->InstallFiles();
        ModuleManager::registerModule($this->MODULE_ID);
        $eventManager = \Bitrix\Main\EventManager::getInstance();
{'fraction_non_alphanumeric': 0.16189536031589338, 'fraction_numerical': 0.0, 'mean_word_length': 2.867175572519084, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2834005', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1552, 'n_words': 268}