feat(cron): add scheduled jobs configuration in admin (#59)

* feat(cron): add database schedule jobs instead of file

* feat(cron): add scheduled jobs configuration in admin (#59)

* reformat: fix codestyle (#59)

* reformat: fix codestyle (#59)

* feat: disable cron debug (#59)
This commit is contained in:
2026-02-09 19:51:16 +03:00
parent 0295a4b28b
commit c0ca0c731d
31 changed files with 947 additions and 345 deletions

View File

@@ -5,7 +5,6 @@ use Console\ApplicationFactory;
use Console\Commands\CacheClearCommand;
use Console\Commands\CustomerCountsCommand;
use Console\Commands\PulseSendEventsCommand;
use Console\Commands\ScheduleListCommand;
use Console\Commands\ScheduleRunCommand;
use Console\Commands\VersionCommand;
use Console\Commands\ImagesWarmupCacheCommand;
@@ -21,7 +20,7 @@ if (PHP_SAPI !== 'cli') {
}
$baseDir = __DIR__;
$debug = true;
$debug = false;
if (is_readable($baseDir . '/oc_telegram_shop.phar')) {
require_once "phar://{$baseDir}/oc_telegram_shop.phar/vendor/autoload.php";
@@ -33,8 +32,6 @@ if (is_readable($baseDir . '/oc_telegram_shop.phar')) {
throw new RuntimeException('Unable to locate application directory.');
}
date_default_timezone_set('UTC');
// Get Settings from Database
$host = DB_HOSTNAME;
$username = DB_USERNAME;
@@ -46,11 +43,14 @@ $dsn = "mysql:host=$host;port=$port;dbname=$dbName";
$pdo = new PDO($dsn, $username, $password);
$connection = new MySqlConnection($pdo);
$raw = $connection->select("SELECT value FROM `{$prefix}setting` WHERE `key` = 'module_telecart_settings'");
$timezone = $connection->select("SELECT value FROM `{$prefix}setting` WHERE `key` = 'config_timezone'");
$timezone = $timezone[0]['value'] ?? 'UTC';
$json = json_decode($raw[0]['value'], true, 512, JSON_THROW_ON_ERROR);
$items = Arr::mergeArraysRecursively($json, [
'app' => [
'shop_base_url' => HTTPS_CATALOG, // for catalog: HTTPS_SERVER, for admin: HTTPS_CATALOG
'language_id' => 1,
'oc_timezone' => $timezone,
],
'paths' => [
'images' => DIR_IMAGE,
@@ -96,7 +96,6 @@ $app->boot();
$console = new Application('TeleCart', module_version());
$console->add($app->get(VersionCommand::class));
$console->add($app->get(ScheduleRunCommand::class));
$console->add($app->get(ScheduleListCommand::class));
$console->add($app->get(PulseSendEventsCommand::class));
$console->add($app->get(ImagesWarmupCacheCommand::class));
$console->add($app->get(ImagesCacheClearCommand::class));