forked from opennode/opennode-whmcs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron_reduction.php
25 lines (21 loc) · 1.11 KB
/
cron_reduction.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
require_once ("configuration.php");
require_once ("includes/hooks/inc/oms_config.php");
require_once ("Classes/Autoloader.php");
try {
// Check MySQL Configuration
$db_conn = mysql_connect($db_host, $db_username, $db_password);
if (empty($db_conn))
throw new Exception('Unable to connect to DB');
$db_select = @mysql_select_db($db_name, $db_conn);
if (empty($db_select))
throw new Exception('Unable to select WHMCS database');
} catch (Exception $e) {
echo 'Error: ', $e -> getMessage(), "\n";
}
global $product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url, $oms_usage_db;
$whmcsDbService = new \Opennode\Whmcs\Service\WhmcsDbService();
$whmcsExternalService = new \Opennode\Whmcs\Service\WhmcsExternalService($whmcs_admin_user, $whmcs_admin_password, $whmcs_api_url, $oms_usage_db);
$omsReduction = new \Opennode\Whmcs\Service\OmsReductionService($product_core_name, $product_disk_name, $product_memory_name, $oms_usage_db, $whmcsExternalService, $whmcsDbService);
$omsReduction -> reduce_users_credit();
?>