Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SWITCHwayf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Rousse
SWITCHwayf
Commits
3cd24441
Commit
3cd24441
authored
Jun 25, 2018
by
Guillaume Rousse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a single options, accepting two syntaxes
parent
b4865866
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
26 deletions
+12
-26
bin/update-metadata.php
bin/update-metadata.php
+12
-26
No files found.
bin/update-metadata.php
View file @
3cd24441
...
@@ -30,11 +30,7 @@ Argument Description
...
@@ -30,11 +30,7 @@ Argument Description
--metadata-idp-file <file> File containing Service Providers
--metadata-idp-file <file> File containing Service Providers
--metadata-sp-file <file> File containing Identity Providers
--metadata-sp-file <file> File containing Identity Providers
--min-idp-count <count> Minimum expected number of IdPs in metadata
--min-idp-count <count> Minimum expected number of IdPs in metadata
--min-idp-quota <quota> Minimum expected number of IdPs in metadata,
as a percentage of current number
--min-sp-count <count> Minimum expected number of SPs in metadata
--min-sp-count <count> Minimum expected number of SPs in metadata
--min-sp-quota <quoat> Minimum expected number of SPs in metadata,
as a percentage of current number
--language <locale> Language locale, e.g. 'en', 'jp', ...
--language <locale> Language locale, e.g. 'en', 'jp', ...
--verbose | -v Verbose mode
--verbose | -v Verbose mode
--help | -h Print this man page
--help | -h Print this man page
...
@@ -54,9 +50,7 @@ $longopts = array(
...
@@ -54,9 +50,7 @@ $longopts = array(
"metadata-idp-file:"
,
"metadata-idp-file:"
,
"metadata-sp-file:"
,
"metadata-sp-file:"
,
"min-idp-count:"
,
"min-idp-count:"
,
"min-idp-quota:"
,
"min-sp-count:"
,
"min-sp-count:"
,
"min-sp-quota:"
,
"language:"
,
"language:"
,
"verbose"
,
"verbose"
,
"help"
,
"help"
,
...
@@ -91,36 +85,28 @@ if (!isset($options['metadata-idp-file'])) {
...
@@ -91,36 +85,28 @@ if (!isset($options['metadata-idp-file'])) {
}
}
if
(
isset
(
$options
[
'min-sp-count'
]))
{
if
(
isset
(
$options
[
'min-sp-count'
]))
{
if
(
!
is_numeric
(
$options
[
'min-sp-count'
]))
{
if
(
preg_match
(
'/^(\d+)%$/'
,
$options
[
'min-sp-count'
],
$matches
))
{
exit
(
"Exiting: invalid value for --min-sp-count parameter
\n
"
);
}
else
{
$minSPCount
=
$options
[
'min-sp-count'
];
}
}
elseif
(
isset
(
$options
[
'min-sp-quota'
]))
{
if
(
!
is_numeric
(
$options
[
'min-sp-quota'
]))
{
exit
(
"Exiting: invalid value for --min-sp-quota parameter
\n
"
);
}
else
{
require_once
(
$metadataSPFile
);
require_once
(
$metadataSPFile
);
$SPCount
=
count
(
$metadataSProviders
);
$SPCount
=
count
(
$metadataSProviders
);
$minSPCount
=
floor
(
$SPCount
*
$options
[
'min-sp-quota'
]
/
100
);
$minSPCount
=
floor
(
$SPCount
*
$matches
[
1
]
/
100
);
}
elseif
(
preg_match
(
'/^\d+$/'
,
$options
[
'min-sp-count'
]))
{
$minSPCount
=
$options
[
'min-sp-count'
];
}
else
{
exit
(
"Exiting: invalid value for --min-sp-count parameter
\n
"
);
}
}
}
else
{
}
else
{
$minSPCount
=
0
;
$minSPCount
=
0
;
}
}
if
(
isset
(
$options
[
'min-idp-count'
]))
{
if
(
isset
(
$options
[
'min-idp-count'
]))
{
if
(
!
is_numeric
(
$options
[
'min-idp-count'
]))
{
if
(
preg_match
(
'/^(\d+)%$/'
,
$options
[
'min-idp-count'
],
$matches
))
{
exit
(
"Exiting: invalid value for --min-idp-count parameter
\n
"
);
}
else
{
$minIDPCount
=
$options
[
'min-idp-count'
];
}
}
elseif
(
isset
(
$options
[
'min-idp-quota'
]))
{
if
(
!
is_numeric
(
$options
[
'min-idp-quota'
]))
{
exit
(
"Exiting: invalid value for --min-idp-quota parameter
\n
"
);
}
else
{
require_once
(
$metadataIDPFile
);
require_once
(
$metadataIDPFile
);
$IDPCount
=
count
(
$metadataIDProviders
);
$IDPCount
=
count
(
$metadataIDProviders
);
$minIDPCount
=
floor
(
$IDPCount
*
$options
[
'min-idp-quota'
]
/
100
);
$minIDPCount
=
floor
(
$IDPCount
*
$matches
[
1
]
/
100
);
}
elseif
(
preg_match
(
'/^\d+$/'
,
$options
[
'min-idp-count'
]))
{
$minIDPCount
=
$options
[
'min-idp-count'
];
}
else
{
exit
(
"Exiting: invalid value for --min-idp-count parameter
\n
"
);
}
}
}
else
{
}
else
{
$minIDPCount
=
0
;
$minIDPCount
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment