EngineGP/cron.php

47 lines
1.5 KiB
PHP
Raw Normal View History

2023-03-04 23:45:46 +00:00
<?php
2023-04-28 20:21:32 +00:00
date_default_timezone_set('Europe/Moscow');
@ini_set('display_errors', TRUE);
@ini_set('html_errors', TRUE);
@ini_set('error_reporting', E_ALL);
define('EGP', TRUE);
define('DIR', __DIR__ . '/');
define('SYS', DIR . 'system/');
define('TPL', DIR . 'template/');
define('TEMP', DIR . 'temp/');
define('FILES', DIR . 'files/');
define('DATA', SYS . 'data/');
define('LIB', SYS . 'library/');
define('ENG', SYS . 'engine/');
define('SEC', SYS . 'sections/');
define('CRON', LIB . 'cron/');
2023-04-28 20:21:32 +00:00
$start_point = $_SERVER['REQUEST_TIME'];
$mcache = new Memcache;
2023-05-05 01:17:19 +00:00
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: не удалось создать связь с Memcache.' . PHP_EOL);
2023-04-28 20:21:32 +00:00
// Composer
if (!file_exists(DIR . 'vendor/autoload.php')) {
2023-04-28 20:21:32 +00:00
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
}
require(DIR . 'vendor/autoload.php');
2023-04-28 20:21:32 +00:00
// Настройки
2023-05-05 01:17:19 +00:00
include(DATA . 'config.php');
include(DATA . 'engine.php');
include(DATA . 'mysql.php');
include(DATA . 'params.php');
2023-04-28 20:21:32 +00:00
// Проверка ключа и указания параметра
2023-05-05 01:17:19 +00:00
if ($argv[1] != $cfg['cron_key'])
2023-04-28 20:21:32 +00:00
exit('Invalid cron key' . PHP_EOL);
$task = $argv[2];
// Библиотеки
2023-05-05 01:17:19 +00:00
include(LIB . 'sql.php');
include(LIB . 'html.php');
include(LIB . 'system.php');
include(LIB . 'cron.php');
2023-03-04 23:45:46 +00:00
?>