1
0
mirror of synced 2024-11-24 22:36:07 +03:00

Removing outdated functionality (Configuration management cron) (#269)

This commit is contained in:
Kocmonavtik 2022-12-07 11:23:57 +03:00 committed by GitHub
parent 6f5cd18a07
commit ccdc6f489e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 99 deletions

View File

@ -1,3 +1,6 @@
## 2022-12-02 v.6.1.10
- Удаление управления конфигурацией cron
## 2022-12-01 v.6.1.9
- Исправление ошибки создания клиента без email по истории
- Добавление передачи комментария к статусу заказа в CRM

View File

@ -1,2 +1 @@
- Исправление ошибки создания клиента без email по истории
- Добавление передачи комментария к статусу заказа в CRM
- Удаление устаревшего функционала управления конфигурацией cron

View File

@ -494,10 +494,8 @@ if ($STEP === 1) {
<br><br><br>
<?php
if ($isSetupModulePage) { ?>
<font class="text"><?=GetMessage('LOAD_PERIOD');?><br><br></font>
<input type="radio" name="TYPE_LOADING" value="none" onclick="checkProfile(this);"><?=GetMessage('NOT_LOADING')?><Br>
<input type="radio" name="TYPE_LOADING" value="cron" onclick="checkProfile(this);"><?=GetMessage('CRON_LOADING')?><Br>
<input type="radio" name="TYPE_LOADING" value="agent" checked onclick="checkProfile(this);"><?=GetMessage('AGENT_LOADING')?><Br>
<span class="text"><?=GetMessage('AGENT_LOADING')?>&nbsp;</span>
<input type="checkbox" name="NEED_CATALOG_AGENT" value="agent" onclick="checkProfile(this);"><Br>
<br>
<br>
<span class="text"><?=GetMessage('LOAD_NOW')?>&nbsp;</span>

View File

@ -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);

View File

@ -1,6 +1,6 @@
<?php
$arModuleVersion = [
'VERSION' => '6.1.9',
'VERSION_DATE' => '2022-12-01 11:30:00'
'VERSION' => '6.1.10',
'VERSION_DATE' => '2022-12-02 13:00:00'
];

View File

@ -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';

View File

@ -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'] = 'Имя профиля:';