Refactor project structure
This commit is contained in:
22
core/crons/cron.php
Normal file
22
core/crons/cron.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
include dirname(__FILE__).'/include.cron.php';
|
||||
|
||||
$cron = new \Model\Cron();
|
||||
$crons = $cron->Find("status = ?",array('Enabled'));
|
||||
|
||||
if(!$crons){
|
||||
\Utils\LogManager::getInstance()->info(CLIENT_NAME." error :".$cron->ErrorMsg());
|
||||
}
|
||||
|
||||
\Utils\LogManager::getInstance()->info(CLIENT_NAME." cron count :".count($crons));
|
||||
foreach($crons as $cron){
|
||||
$count++;
|
||||
$iceCron = new \Classes\Cron\IceCron($cron);
|
||||
\Utils\LogManager::getInstance()->info(CLIENT_NAME." check cron :".$cron->name);
|
||||
if($iceCron->isRunNow()){
|
||||
\Utils\LogManager::getInstance()->info(CLIENT_NAME." execute cron :".$cron->name);
|
||||
$iceCron->execute();
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
18
core/crons/cronRunner.php
Normal file
18
core/crons/cronRunner.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
if(php_sapi_name() != 'cli'){
|
||||
exit();
|
||||
}
|
||||
include dirname(__FILE__)."/../config.base.php";
|
||||
ini_set('error_log',CRON_LOG);
|
||||
$opts = getopt('f:p:');
|
||||
$file = $opts['f'];
|
||||
$basePath = $opts['p'];
|
||||
|
||||
include(dirname(__FILE__) . "/../Classes/CronUtils.php");
|
||||
|
||||
$cronUtils = \Classes\Cron\CronUtils::getInstance($basePath, $file);
|
||||
|
||||
echo "Cron Runner created \r\n";
|
||||
|
||||
$cronUtils->run();
|
||||
|
||||
3
core/crons/echo.php
Normal file
3
core/crons/echo.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include dirname(__FILE__).'/include.cron.php';
|
||||
echo "CLIENT_NAME : ".CLIENT_NAME."\r\n";
|
||||
11
core/crons/include.cron.php
Normal file
11
core/crons/include.cron.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
if(php_sapi_name() != 'cli'){
|
||||
exit();
|
||||
}
|
||||
|
||||
define('CLIENT_PATH',dirname(__FILE__)."/..");
|
||||
|
||||
include (APP_BASE_PATH."config.base.php");
|
||||
|
||||
include (APP_BASE_PATH."include.common.php");
|
||||
include(APP_BASE_PATH."server.includes.inc.php");
|
||||
Reference in New Issue
Block a user