Skip to content
Snippets Groups Projects
Commit 51cb4090 authored by Tomasz Wolniewicz's avatar Tomasz Wolniewicz
Browse files

adding the possibility to filter out federations which have some problems but...

adding the possibility to filter out federations which have some problems but are not under the close expiry threat


(cherry picked from commit 870121e7)
parent 2bd71ca2
No related branches found
No related tags found
1 merge request!13adding the possibility to filter out federations which have some problems but...
......@@ -297,7 +297,7 @@ class API {
}
break;
case 'only_errors':
if ($optValue != 1) {
if ($optValue != 1 && $optValue != 2) {
$optValue = 0;
}
case 'details':
......@@ -577,8 +577,8 @@ class API {
'arg' => 'only_errors',
'required' => FALSE,
'default' => '0',
'values' => '0, 1',
'description' => '0 - show all; 1 - only federations with feed problems including close to expiry'],
'values' => '0, 1, 2',
'description' => '0 - show all; 1 - only federations with feed problems including close to expiry; 2 - show only federations with expiry time below the set valid_sec value'],
[
'arg' => 'valid_sec',
'required' => FALSE,
......@@ -611,7 +611,7 @@ class API {
Utils::debug(5, $this->opts, "OPTS: ", "\n");
$edugain = new eduGAIN(5, $this->fed_id, true);
$edugain->load_federations_state();
if ($this->opts['only_errors'] == 1) {
if ($this->opts['only_errors'] > 0) {
$out = [];
if ($this->opts['valid_sec'] > 0) {
$sec = $this->opts['valid_sec'];
......@@ -619,8 +619,15 @@ class API {
$sec = VALIDITY_WARNING_THRESHOLD;
}
foreach ($edugain->FEDS as $fed) {
if ($fed['feed_problem'] > 0 || $fed['valid_sec'] < $sec) {
$out[$fed['code']] = $fed;
if ($this->opts['only_errors'] == 2) {
if ($fed['valid_sec'] < $sec) {
$out[$fed['code']] = $fed;
}
}
if ($this->opts['only_errors'] == 1) {
if ($fed['valid_sec'] < $sec || $fed['feed_problem'] > 0 ) {
$out[$fed['code']] = $fed;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment