Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
b8cbe157
Commit
b8cbe157
authored
8 years ago
by
Thijs Kinkhorst
Browse files
Options
Downloads
Patches
Plain Diff
Version checking: do not poll github when running master, and store result in session.
parent
e8ee8c83
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/core/www/frontpage_config.php
+26
-19
26 additions, 19 deletions
modules/core/www/frontpage_config.php
with
26 additions
and
19 deletions
modules/core/www/frontpage_config.php
+
26
−
19
View file @
b8cbe157
...
...
@@ -70,27 +70,34 @@ $allLinks = array(
);
SimpleSAML\Module
::
callHooks
(
'frontpage'
,
$allLinks
);
// check for updates
if
(
$config
->
getBoolean
(
'admin.checkforupdates'
,
true
))
{
$api_url
=
'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases'
;
$ch
=
curl_init
(
$api_url
.
'/latest'
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_USERAGENT
,
'SimpleSAMLphp'
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
2
);
$response
=
curl_exec
(
$ch
);
if
(
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
)
===
200
)
{
$latest
=
json_decode
(
$response
,
true
);
$current
=
$config
->
getVersion
();
if
(
$current
!==
'master'
&&
version_compare
(
$current
,
ltrim
(
$latest
[
'tag_name'
],
'v'
),
'lt'
))
{
$outdated
=
true
;
$warnings
[]
=
array
(
'{core:frontpage:warnings_outdated}'
,
array
(
'%LATEST_URL%'
=>
$latest
[
'html_url'
])
);
// Check for updates. Store the remote result in the session so we
// don't need to fetch it on every access of this page.
$current
=
$config
->
getVersion
();
if
(
$config
->
getBoolean
(
'admin.checkforupdates'
,
true
)
&&
$current
!==
'master'
)
{
$latest
=
$session
->
getData
(
"core:latest_simplesamlphp_version"
,
"version"
);
if
(
!
$latest
)
{
$api_url
=
'https://api.github.com/repos/simplesamlphp/simplesamlphp/releases'
;
$ch
=
curl_init
(
$api_url
.
'/latest'
);
curl_setopt
(
$ch
,
CURLOPT_RETURNTRANSFER
,
1
);
curl_setopt
(
$ch
,
CURLOPT_USERAGENT
,
'SimpleSAMLphp'
);
curl_setopt
(
$ch
,
CURLOPT_TIMEOUT
,
2
);
$response
=
curl_exec
(
$ch
);
if
(
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
)
===
200
)
{
$latest
=
json_decode
(
$response
,
true
);
$session
->
setData
(
"core:latest_simplesamlphp_version"
,
"version"
,
$latest
);
}
curl_close
(
$ch
);
}
if
(
$latest
&&
version_compare
(
$current
,
ltrim
(
$latest
[
'tag_name'
],
'v'
),
'lt'
))
{
$outdated
=
true
;
$warnings
[]
=
array
(
'{core:frontpage:warnings_outdated}'
,
array
(
'%LATEST_URL%'
=>
$latest
[
'html_url'
])
);
}
curl_close
(
$ch
);
}
$enablematrix
=
array
(
...
...
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