From ccdc6f489eb9e4f1777109b76c13ff2608bdce76 Mon Sep 17 00:00:00 2001 From: Kocmonavtik <61938582+Kocmonavtik@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:23:57 +0300 Subject: [PATCH] Removing outdated functionality (Configuration management cron) (#269) --- CHANGELOG.md | 3 + intaro.retailcrm/description.ru | 3 +- intaro.retailcrm/export/export_setup.php | 6 +- intaro.retailcrm/install/index.php | 85 +--------------------- intaro.retailcrm/install/version.php | 4 +- intaro.retailcrm/lang/en/install/step5.php | 5 +- intaro.retailcrm/lang/ru/install/step5.php | 5 +- 7 files changed, 12 insertions(+), 99 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77151519..c0af19fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2022-12-02 v.6.1.10 +- Удаление управления конфигурацией cron + ## 2022-12-01 v.6.1.9 - Исправление ошибки создания клиента без email по истории - Добавление передачи комментария к статусу заказа в CRM diff --git a/intaro.retailcrm/description.ru b/intaro.retailcrm/description.ru index 778a2608..1a6a0f04 100644 --- a/intaro.retailcrm/description.ru +++ b/intaro.retailcrm/description.ru @@ -1,2 +1 @@ -- Исправление ошибки создания клиента без email по истории -- Добавление передачи комментария к статусу заказа в CRM \ No newline at end of file +- Удаление устаревшего функционала управления конфигурацией cron \ No newline at end of file diff --git a/intaro.retailcrm/export/export_setup.php b/intaro.retailcrm/export/export_setup.php index 3f9375f8..88217c55 100644 --- a/intaro.retailcrm/export/export_setup.php +++ b/intaro.retailcrm/export/export_setup.php @@ -494,10 +494,8 @@ if ($STEP === 1) {


-

-
-
-
+   +


  diff --git a/intaro.retailcrm/install/index.php b/intaro.retailcrm/install/index.php index 632773e8..d0285c67 100644 --- a/intaro.retailcrm/install/index.php +++ b/intaro.retailcrm/install/index.php @@ -966,12 +966,6 @@ class intaro_retailcrm extends CModule $filename = $_POST['SETUP_FILE_NAME']; } - if (!isset($_POST['TYPE_LOADING'])) { - $typeLoading = 0; - } else { - $typeLoading = $_POST['TYPE_LOADING']; - } - if (!isset($_POST['maxOffersValue'])) { $maxOffers = null; } else { @@ -984,7 +978,7 @@ class intaro_retailcrm extends CModule $profileName = $_POST['SETUP_PROFILE_NAME']; } - if ($typeLoading !== 'none' && $profileName == '') { + if ($profileName == '') { $arResult['errCode'] = 'ERR_FIELDS_PROFILE'; } @@ -1098,7 +1092,7 @@ class intaro_retailcrm extends CModule $agentId = null; - if ($typeLoading === 'agent') { + if (isset($_POST['NEED_CATALOG_AGENT'])) { $dateAgent = new DateTime(); $intAgent = new DateInterval('PT60S'); // PT60S - 60 sec; $dateAgent->add($intAgent); @@ -1133,81 +1127,6 @@ class intaro_retailcrm extends CModule ); } - if ('cron' === $typeLoading) { - include($this->INSTALL_PATH . '/../lib/vendor/symfony/component/process/phpexecutablefinder.php'); - include($this->INSTALL_PATH . '/../lib/vendor/symfony/component/process/executablefinder.php'); - - $agent_period = 24; - $finder = new PhpExecutableFinder(); - $agent_php_path = $finder->find(); - - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS . 'cron_frame.php')) { - CheckDirPath($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS); - $tmp_file_size = filesize($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS_DEF . 'cron_frame.php'); - $fp = fopen($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS_DEF . 'cron_frame.php', 'rb'); - $tmp_data = fread($fp, $tmp_file_size); - fclose($fp); - - $tmp_data = str_replace('#DOCUMENT_ROOT#', $_SERVER['DOCUMENT_ROOT'], $tmp_data); - $tmp_data = str_replace('#PHP_PATH#', $agent_php_path, $tmp_data); - - $fp = fopen($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS . 'cron_frame.php', 'ab'); - fwrite($fp, $tmp_data); - fclose($fp); - } - - $cfg_data = ''; - if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/crontab.cfg')) { - $cfg_file_size = filesize($_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/crontab.cfg'); - $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/crontab.cfg', 'rb'); - $cfg_data = fread($fp, $cfg_file_size); - fclose($fp); - } - - CheckDirPath($_SERVER['DOCUMENT_ROOT'] . CATALOG_PATH2EXPORTS . 'logs/'); - - if ($arProfile['IN_CRON'] == 'Y') { - // remove - $cfg_data = preg_replace('#^.*?' - . preg_quote(CATALOG_PATH2EXPORTS) - . 'cron_frame.php +' - . $profileId - . ' *>.*?$#im', '', $cfg_data); - } else { - $strTime = '0 */' . $agent_period . ' * * * '; - if (strlen($cfg_data) > 0) { - $cfg_data .= "\n"; - } - - $cfg_data .= $strTime - . $agent_php_path - . ' -f ' - . $_SERVER['DOCUMENT_ROOT'] - . CATALOG_PATH2EXPORTS - . 'cron_frame.php ' - . $profileId - . ' >' - . $_SERVER['DOCUMENT_ROOT'] - . CATALOG_PATH2EXPORTS - . 'logs/' - . $profileId - . ".txt\n"; - } - - CCatalogExport::Update($profileId, [ - 'IN_CRON' => 'Y', - ]); - - CheckDirPath($_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/'); - $cfg_data = preg_replace("#[\r\n]{2,}#im", "\n", $cfg_data); - $fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/crontab.cfg', 'wb'); - fwrite($fp, $cfg_data); - fclose($fp); - - $arRetval = []; - @exec('crontab ' . $_SERVER['DOCUMENT_ROOT'] . '/bitrix/crontab/crontab.cfg', $arRetval, $return_var); - } - $api_host = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_HOST_OPTION, 0); $api_key = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_KEY_OPTION, 0); $api_version = COption::GetOptionString($this->MODULE_ID, $this->CRM_API_VERSION, 0); diff --git a/intaro.retailcrm/install/version.php b/intaro.retailcrm/install/version.php index 234d7f73..75996097 100644 --- a/intaro.retailcrm/install/version.php +++ b/intaro.retailcrm/install/version.php @@ -1,6 +1,6 @@ '6.1.9', - 'VERSION_DATE' => '2022-12-01 11:30:00' + 'VERSION' => '6.1.10', + 'VERSION_DATE' => '2022-12-02 13:00:00' ]; diff --git a/intaro.retailcrm/lang/en/install/step5.php b/intaro.retailcrm/lang/en/install/step5.php index 7478c97a..0d1dc1c6 100644 --- a/intaro.retailcrm/lang/en/install/step5.php +++ b/intaro.retailcrm/lang/en/install/step5.php @@ -12,10 +12,7 @@ $MESS ['PAYMENT_Y'] = 'Paid'; $MESS ['PAYMENT_N'] = 'Not paid'; $MESS ['CANCELED'] = 'Is «Cancelled»'; $MESS ['INFO_1'] = ' Set the correspondence between 1C-Bitrix data books and RetailCRM data books.'; -$MESS ['LOAD_PERIOD'] = 'Export catalog periodically'; -$MESS ['NOT_LOADING'] = 'No'; -$MESS ['CRON_LOADING'] = 'By CRON every 24 hours'; -$MESS ['AGENT_LOADING'] = 'By Agent every 24 hours (by default)'; +$MESS ['AGENT_LOADING'] = 'Export catalog periodically (By Agent every 24 hours)'; $MESS ['LOAD_NOW'] = 'Export now'; $MESS ['LOAD_NOW_MSG'] = 'The generation will start after you click "Finish installation". This may take some time'; diff --git a/intaro.retailcrm/lang/ru/install/step5.php b/intaro.retailcrm/lang/ru/install/step5.php index 7213cb15..dbe277e0 100644 --- a/intaro.retailcrm/lang/ru/install/step5.php +++ b/intaro.retailcrm/lang/ru/install/step5.php @@ -12,10 +12,7 @@ $MESS ['PAYMENT_Y'] = 'Оплачен'; $MESS ['PAYMENT_N'] = 'Не оплачен'; $MESS ['CANCELED'] = 'Флаг «Отменен»'; $MESS ['INFO_1'] = ' Задайте соответствие между справочниками 1C-Битрикс и справочниками RetailCRM.'; -$MESS ['LOAD_PERIOD'] = 'Выгружать каталог периодически'; -$MESS ['NOT_LOADING'] = 'Нет'; -$MESS ['CRON_LOADING'] = 'С помощью CRON каждые 24 часа'; -$MESS ['AGENT_LOADING'] = 'Агентом каждые 24 часа (по умолчанию)'; +$MESS ['AGENT_LOADING'] = 'Выгружать каталог периодически (Агентом каждые 24 часа)'; $MESS ['LOAD_NOW'] = 'Выгрузить сейчас'; $MESS ['LOAD_NOW_MSG'] = 'Генерация начнется после нажатия "Завершить установку". Это может занять некоторое время'; $MESS ['PROFILE_NAME'] = 'Имя профиля:';