Skip to content

Commit f5f9bd3

Browse files
author
Vítězslav Dvořák
committed
Allow Schedule Job Run #2
1 parent 8c1ed63 commit f5f9bd3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/scheduler.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
* Multi Flexi - Cron Scheduled actions executor.
4+
* Multi Flexi - Use Cron to schedule periodical actions.
55
*
66
* @author Vítězslav Dvořák <info@vitexsoftware.cz>
77
* @copyright 2020-2024 Vitex Software
@@ -13,6 +13,7 @@
1313
\MultiFlexi\Configuration,
1414
\Ease\Anonym,
1515
\Ease\Shared;
16+
use GO\Scheduler;
1617

1718
require_once '../vendor/autoload.php';
1819
Shared::init(['DB_CONNECTION', 'DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD'], '../.env');
@@ -41,9 +42,17 @@
4142
$companys = $companer->listingQuery();
4243
$customConfig = new Configuration();
4344
if ($interval) {
45+
46+
if ($interval == 'i') {
47+
$scheduler = new Scheduler();
48+
#TODO: #2
49+
$scheduler->run();
50+
}
51+
4452
$ap2c = new \MultiFlexi\RunTemplate();
4553
foreach ($companys as $company) {
4654
LogToSQL::singleton()->setCompany($company['id']);
55+
4756
$appsForCompany = $ap2c->getColumnsFromSQL(['id', 'interv'], ['company_id' => $company['id'], 'interv' => $interval]);
4857
if (empty($appsForCompany) && ($interval != 'i')) {
4958
$companer->addStatusMessage(sprintf(_('No applications to run for %s in interval %s'), $company['name'], $interval), 'debug');
@@ -61,6 +70,6 @@
6170
}
6271
}
6372
} else {
64-
echo "interval y/m/w/d/h missing\n";
73+
echo "interval i/y/m/w/d/h missing\n";
6574
exit(1);
6675
}

0 commit comments

Comments
 (0)