Refactor project structure

This commit is contained in:
Thilina Hasantha
2018-04-29 17:46:42 +02:00
parent 889baf124c
commit e3a7e18d9c
5513 changed files with 32 additions and 27 deletions

22
core/crons/cron.php Normal file
View 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
View 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
View File

@@ -0,0 +1,3 @@
<?php
include dirname(__FILE__).'/include.cron.php';
echo "CLIENT_NAME : ".CLIENT_NAME."\r\n";

View 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");