Fix Cron for

This commit is contained in:
Ibnu Maksum
2024-01-15 10:22:03 +07:00
parent f38da8d3c0
commit 5867a0c9ca
5 changed files with 40 additions and 17 deletions

View File

@ -35,16 +35,16 @@ if (php_sapi_name() !== 'cli') {
echo "<pre>";
}
if(!file_exists('../config.php')){
if (!file_exists('../config.php')) {
die("config.php file not found");
}
if(!file_exists('orm.php')){
if (!file_exists('orm.php')) {
die("orm.php file not found");
}
if(!file_exists('uploads/notifications.default.json')){
if (!file_exists('uploads/notifications.default.json')) {
die("uploads/notifications.default.json file not found");
}
@ -68,7 +68,13 @@ $_notifmsg_default = json_decode(file_get_contents('uploads/notifications.defaul
//register all plugin
foreach (glob(File::pathFixer("plugin/*.php")) as $filename) {
include $filename;
try{
include $filename;
} catch(Throwable $e){
//ignore plugin error
}catch(Exception $e){
//ignore plugin error
}
}
$result = ORM::for_table('tbl_appconfig')->find_many();
@ -137,7 +143,7 @@ foreach ($d as $ds) {
// autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
if ($p && $p['enabled'] && $c['balance'] >= $p['price'] && $p['allow_purchase'] =='yes') {
if ($p && $p['enabled'] && $c['balance'] >= $p['price'] && $p['allow_purchase'] == 'yes') {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance
Balance::min($ds['customer_id'], $p['price']);
@ -156,7 +162,8 @@ foreach ($d as $ds) {
} else {
echo "no renewall | balance $config[enable_balance] auto_renewal $c[auto_renewal]\n";
}
} else echo " : ACTIVE \r\n";
} else
echo " : ACTIVE \r\n";
} else {
$date_now = strtotime(date("Y-m-d H:i:s"));
$expiration = strtotime($ds['expiration'] . ' ' . $ds['time']);
@ -191,7 +198,7 @@ foreach ($d as $ds) {
// autorenewal from deposit
if ($config['enable_balance'] == 'yes' && $c['auto_renewal']) {
if ($p && $p['enabled'] && $c['balance'] >= $p['price']&& $p['allow_purchase'] =='yes') {
if ($p && $p['enabled'] && $c['balance'] >= $p['price'] && $p['allow_purchase'] == 'yes') {
if (Package::rechargeUser($ds['customer_id'], $p['routers'], $p['id'], 'Customer', 'Balance')) {
// if success, then get the balance
Balance::min($ds['customer_id'], $p['price']);
@ -206,6 +213,7 @@ foreach ($d as $ds) {
}
}
}
} else echo " : ACTIVE \r\n";
} else
echo " : ACTIVE \r\n";
}
}