Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp-module-proxystatistics
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp-module-proxystatistics
Commits
29fef316
Verified
Commit
29fef316
authored
1 year ago
by
Dominik Frantisek Bucik
Browse files
Options
Downloads
Patches
Plain Diff
feat:
Cron enable/disable flag
Configuration option 'cronEnabled' to enable/disable cron.
parent
f10c5886
No related branches found
No related tags found
No related merge requests found
Pipeline
#354810
canceled
1 year ago
Stage: .pre
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config-templates/module_proxystatistics.php
+12
-4
12 additions, 4 deletions
config-templates/module_proxystatistics.php
hooks/hook_cron.php
+7
-1
7 additions, 1 deletion
hooks/hook_cron.php
lib/Config.php
+10
-0
10 additions, 0 deletions
lib/Config.php
with
29 additions
and
5 deletions
config-templates/module_proxystatistics.php
+
12
−
4
View file @
29fef316
...
...
@@ -104,9 +104,17 @@ $config = [
*/
//'apiWritePasswordHash' => password_hash('ap1Wr1T3rP@S$'),
'ignoredIds'
=>
[
'IDP'
=>
[
'spentityid1'
,
'spentityid2'
,
'spentityid3'
,],
'SP'
=>
[
'idpentityid1'
,
'idpentityid2'
,
'idpentityid3'
,],
],
/*
* List of IDP and/or SP EntityIDs for which the login statistic will be ignored even
* when requested to be instered into the storage. By default lists are empty
*/
//'ignoredIds' => [
// 'IDP' => ['spentityid1', 'spentityid2', 'spentityid3',],
// 'SP' => ['idpentityid1', 'idpentityid2', 'idpentityid3',],
//],
/*
* Enabled or disables CRON hook (aggregating the stats). By default is enabled.
*/
//'cronEnabled' => false,
];
This diff is collapsed.
Click to expand it.
hooks/hook_cron.php
+
7
−
1
View file @
29fef316
...
...
@@ -3,6 +3,7 @@
declare
(
strict_types
=
1
);
use
SimpleSAML\Logger
;
use
SimpleSAML\Module\proxystatistics\Config
;
use
SimpleSAML\Module\proxystatistics\DatabaseCommand
;
/**
...
...
@@ -18,8 +19,13 @@ function proxystatistics_hook_cron(&$croninfo)
return
;
}
Logger
::
info
(
'cron [proxystatistics]: Running cron in cron tag ['
.
$croninfo
[
'tag'
]
.
'] '
);
$config
=
Config
::
getInstance
();
if
(
!
$config
->
isCronEnabled
())
{
Logger
::
debug
(
'cron [proxystatistics]: Skipping cron - disabled by confiuration'
);
return
;
}
Logger
::
info
(
'cron [proxystatistics]: Running cron in cron tag ['
.
$croninfo
[
'tag'
]
.
'] '
);
try
{
$dbCmd
=
new
DatabaseCommand
();
$dbCmd
->
aggregate
();
...
...
This diff is collapsed.
Click to expand it.
lib/Config.php
+
10
−
0
View file @
29fef316
...
...
@@ -43,6 +43,8 @@ class Config
private
const
IGNORED_IDS
=
'ignoredIds'
;
private
const
CRON_ENABLED
=
'cronEnabled'
;
private
$config
;
private
$store
;
...
...
@@ -67,6 +69,8 @@ class Config
private
$ignoredIds
;
private
$cronEnabled
;
private
static
$instance
;
private
function
__construct
()
...
...
@@ -79,6 +83,7 @@ class Config
$this
->
keepPerUser
=
$this
->
config
->
getIntegerRange
(
self
::
KEEP_PER_USER
,
31
,
1827
,
31
);
$this
->
requiredAuthSource
=
$this
->
config
->
getString
(
self
::
REQUIRE_AUTH_SOURCE
,
''
);
$this
->
idAttribute
=
$this
->
config
->
getString
(
self
::
USER_ID_ATTRIBUTE
,
'uid'
);
$this
->
cronEnabled
=
$this
->
config
->
getBoolean
(
self
::
CRON_ENABLED
,
true
);
$this
->
apiWriteEnabled
=
$this
->
config
->
getBoolean
(
self
::
API_WRITE_ENABLED
,
false
);
$this
->
ignoredIds
=
$this
->
config
->
getArray
(
self
::
IGNORED_IDS
,
[]);
if
(
$this
->
apiWriteEnabled
)
{
...
...
@@ -172,4 +177,9 @@ class Config
{
return
$this
->
ignoredIds
;
}
public
function
isCronEnabled
()
{
return
$this
->
cronEnabled
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment