Skip to content
Snippets Groups Projects

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

1 file
+ 13
6
Compare changes
  • Side-by-side
  • Inline
+ 13
6
@@ -297,7 +297,7 @@ class API {
@@ -297,7 +297,7 @@ class API {
}
}
break;
break;
case 'only_errors':
case 'only_errors':
if ($optValue != 1) {
if ($optValue != 1 && $optValue != 2) {
$optValue = 0;
$optValue = 0;
}
}
case 'details':
case 'details':
@@ -577,8 +577,8 @@ class API {
@@ -577,8 +577,8 @@ class API {
'arg' => 'only_errors',
'arg' => 'only_errors',
'required' => FALSE,
'required' => FALSE,
'default' => '0',
'default' => '0',
'values' => '0, 1',
'values' => '0, 1, 2',
'description' => '0 - show all; 1 - only federations with feed problems including close to expiry'],
'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',
'arg' => 'valid_sec',
'required' => FALSE,
'required' => FALSE,
@@ -611,7 +611,7 @@ class API {
@@ -611,7 +611,7 @@ class API {
Utils::debug(5, $this->opts, "OPTS: ", "\n");
Utils::debug(5, $this->opts, "OPTS: ", "\n");
$edugain = new eduGAIN(5, $this->fed_id, true);
$edugain = new eduGAIN(5, $this->fed_id, true);
$edugain->load_federations_state();
$edugain->load_federations_state();
if ($this->opts['only_errors'] == 1) {
if ($this->opts['only_errors'] > 0) {
$out = [];
$out = [];
if ($this->opts['valid_sec'] > 0) {
if ($this->opts['valid_sec'] > 0) {
$sec = $this->opts['valid_sec'];
$sec = $this->opts['valid_sec'];
@@ -619,8 +619,15 @@ class API {
@@ -619,8 +619,15 @@ class API {
$sec = VALIDITY_WARNING_THRESHOLD;
$sec = VALIDITY_WARNING_THRESHOLD;
}
}
foreach ($edugain->FEDS as $fed) {
foreach ($edugain->FEDS as $fed) {
if ($fed['feed_problem'] > 0 || $fed['valid_sec'] < $sec) {
if ($this->opts['only_errors'] == 2) {
$out[$fed['code']] = $fed;
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;
 
}
}
}
}
}
Loading