ez-pro/cron.php
2025-11-13 19:04:05 +03:00

48 lines
1.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use Bitrix\Main\Loader;
use Bitrix\Sender\MailingManager;
$_SERVER['DOCUMENT_ROOT'] = __DIR__ . '/s1';
const CACHED_b_event = false;
const NO_KEEP_STATISTIC = true;
const BX_NO_ACCELERATOR_RESET = true;
const CHK_EVENT = true;
const NOT_CHECK_PERMISSIONS = true;
try {
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include.php');
foreach (GetModuleEvents('main', 'OnProlog', true) as $arEvent) {
ExecuteModuleEventEx($arEvent);
}
ignore_user_abort(true);
$key = $argv[1] ?? '';
if (!isset($key)) {
throw new Exception('Не указан тип cron задачи');
}
switch ($key) {
case 'main':
CAgent::CheckAgents();
define('BX_CRONTAB_SUPPORT', true);
define('BX_CRONTAB', true);
CEvent::CheckEvents();
if (Loader::includeModule('sender')) {
MailingManager::checkPeriod(false);
MailingManager::checkSend();
}
break;
default:
throw new Exception('Не найден тип ' . $key . ' для cron задачи');
}
CMain::FinalActions();
} catch (Exception $e) {
die($e);
}