Add a notification for 'limited mode'.

Former-commit-id: dce72c7a9ea452029e5650a2012ff35cc6eca9b8
This commit is contained in:
Ramon Novoa 2019-03-26 11:53:03 +01:00
parent d740b32810
commit c25143c27e
1 changed files with 21 additions and 1 deletions

View File

@ -234,6 +234,7 @@ class ConsoleSupervisor
/* /*
* Check license. * Check license.
* NOTIF.LICENSE.EXPIRATION * NOTIF.LICENSE.EXPIRATION
* NOTIF.LICENSE.LIMITED
*/ */
$this->checkLicense(); $this->checkLicense();
@ -537,6 +538,9 @@ class ConsoleSupervisor
} }
switch ($data['type']) { switch ($data['type']) {
case 'NOTIF.LICENSE.LIMITED':
$max_age = 0;
break;
case 'NOTIF.LICENSE.EXPIRATION': case 'NOTIF.LICENSE.EXPIRATION':
case 'NOTIF.FILES.ATTACHMENT': case 'NOTIF.FILES.ATTACHMENT':
case 'NOTIF.FILES.DATAIN': case 'NOTIF.FILES.DATAIN':
@ -684,11 +688,27 @@ class ConsoleSupervisor
$days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24)); $days_to_expiry = ((strtotime($license['expiry_date']) - time()) / (60 * 60 * 24));
// Limited mode.
if (isset($config['limited_mode'])) {
// Warn user if license is going to expire in 15 days or less.
$this->notify(
[
'type' => 'NOTIF.LICENSE.LIMITED',
'title' => __('Limited mode.'),
'message' => io_safe_output($config['limited_mode']),
'url' => 'index.php?sec=gsetup&sec2=godmode/setup/license',
]
);
} else {
$this->cleanNotifications('NOTIF.LICENSE.LIMITED');
}
// Expiry.
if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) { if (($days_to_expiry <= 15) && ($days_to_expiry > 0)) {
// Warn user if license is going to expire in 15 days or less. // Warn user if license is going to expire in 15 days or less.
$this->notify( $this->notify(
[ [
'type' => 'NOTIF.LICENSE_EXPIRATION', 'type' => 'NOTIF.LICENSE.EXPIRATION',
'title' => __('License is going to expire.'), 'title' => __('License is going to expire.'),
'message' => __( 'message' => __(
'Your license is going to expire in %d days. Please contact sales.', 'Your license is going to expire in %d days. Please contact sales.',