Commit d1347800 authored by Guillaume Rousse's avatar Guillaume Rousse

test external files existence first

parent 3cd24441
...@@ -86,9 +86,13 @@ if (!isset($options['metadata-idp-file'])) { ...@@ -86,9 +86,13 @@ if (!isset($options['metadata-idp-file'])) {
if (isset($options['min-sp-count'])) { if (isset($options['min-sp-count'])) {
if (preg_match('/^(\d+)%$/', $options['min-sp-count'], $matches)) { if (preg_match('/^(\d+)%$/', $options['min-sp-count'], $matches)) {
require_once($metadataSPFile); if (file_exists($metadataSPFile)) {
$SPCount = count($metadataSProviders); require_once($metadataSPFile);
$minSPCount = floor($SPCount * $matches[1] / 100); $SPCount = count($metadataSProviders);
$minSPCount = floor($SPCount * $matches[1] / 100);
} else {
$minSPCount = 0;
}
} elseif (preg_match('/^\d+$/', $options['min-sp-count'])) { } elseif (preg_match('/^\d+$/', $options['min-sp-count'])) {
$minSPCount = $options['min-sp-count']; $minSPCount = $options['min-sp-count'];
} else { } else {
...@@ -100,9 +104,13 @@ if (isset($options['min-sp-count'])) { ...@@ -100,9 +104,13 @@ if (isset($options['min-sp-count'])) {
if (isset($options['min-idp-count'])) { if (isset($options['min-idp-count'])) {
if (preg_match('/^(\d+)%$/', $options['min-idp-count'], $matches)) { if (preg_match('/^(\d+)%$/', $options['min-idp-count'], $matches)) {
require_once($metadataIDPFile); if (file_exists($metadataIDPFile)) {
$IDPCount = count($metadataIDProviders); require_once($metadataIDPFile);
$minIDPCount = floor($IDPCount * $matches[1] / 100); $IDPCount = count($metadataIDProviders);
$minIDPCount = floor($IDPCount * $matches[1] / 100);
} else {
$minIDPCount = 0;
}
} elseif (preg_match('/^\d+$/', $options['min-idp-count'])) { } elseif (preg_match('/^\d+$/', $options['min-idp-count'])) {
$minIDPCount = $options['min-idp-count']; $minIDPCount = $options['min-idp-count'];
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment