From 124d21c4deee3a8dfb5d8396db18f3c1012e2a3d Mon Sep 17 00:00:00 2001 From: Ivan Gavryliuk Date: Thu, 17 May 2018 14:43:43 +0300 Subject: [PATCH] #27 Usage Update improvements --- modules/servers/solusvmpro/VERSION | 2 +- modules/servers/solusvmpro/lib/SolusVM.php | 2 +- modules/servers/solusvmpro/solusvmpro.php | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/servers/solusvmpro/VERSION b/modules/servers/solusvmpro/VERSION index 99eba4d..2582ddd 100644 --- a/modules/servers/solusvmpro/VERSION +++ b/modules/servers/solusvmpro/VERSION @@ -1 +1 @@ -4.1.0 \ No newline at end of file +4.1.1 \ No newline at end of file diff --git a/modules/servers/solusvmpro/lib/SolusVM.php b/modules/servers/solusvmpro/lib/SolusVM.php index df555d0..7545305 100644 --- a/modules/servers/solusvmpro/lib/SolusVM.php +++ b/modules/servers/solusvmpro/lib/SolusVM.php @@ -22,7 +22,7 @@ class SolusVM { protected $configOptionUsernamePrefix; protected $serviceid; protected $pid; - protected $configIni; + public $configIni; public $result = ''; public $rawResult = ''; public $cpHostname; diff --git a/modules/servers/solusvmpro/solusvmpro.php b/modules/servers/solusvmpro/solusvmpro.php index 54cbd15..7ef383e 100644 --- a/modules/servers/solusvmpro/solusvmpro.php +++ b/modules/servers/solusvmpro/solusvmpro.php @@ -1149,7 +1149,16 @@ function solusvmpro_UsageUpdate($params) { $solusvm = new SolusVM($params); - $ownerRows = Capsule::table('tblhosting')->where('server', $params['serverid'])->get(); + if (!isset($solusvm->configIni['enableUsageUpdate']) || !$solusvm->configIni['enableUsageUpdate']) { + return false; + } + $ownerRowsHosting = Capsule::table('tblhosting')->where('domainstatus', 'Active')->where('server', $params['serverid']); + + if (isset($solusvm->configIni['updateIntervalDay'])) { + $ownerRowsHosting->whereRaw('lastupdate < DATE_ADD(CURDATE(),INTERVAL -' . $solusvm->configIni['updateIntervalDay'] . ' DAY)'); + } + $ownerRows = $ownerRowsHosting->get(); + if ($ownerRows) { foreach ($ownerRows as $ownerRow) { if (!$ownerRow->id) {