Skip to content
Snippets Groups Projects
Commit 6c5e3c5e authored by Phy's avatar Phy
Browse files

Update check supports HTTPS

If SSL is not supported, a HTTP request will be made. In the log the request type will be indicated, but on the frontend no additional message would be shown (I think it's better to notify admins about non-SSL situations, but currently when this fetch encounter error, no error message will be shown, so it's better not to add any warning).
parent d5d08c05
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,14 @@
* @author Andreas Gohr <andi@splitbrain.org>
*/
if(!defined('DOKU_INC')) die('meh.');
if(!defined('DOKU_MESSAGEURL')) define('DOKU_MESSAGEURL','http://update.dokuwiki.org/check/');
if(!defined('DOKU_MESSAGEURL')){
if(in_array('ssl', stream_get_transports())) {
define('DOKU_MESSAGEURL','https://update.dokuwiki.org/check/');
}else{
define('DOKU_MESSAGEURL','http://update.dokuwiki.org/check/');
}
}
/**
* Check for new messages from upstream
......@@ -22,11 +29,12 @@ function checkUpdateMessages(){
$cf = getCacheName($updateVersion, '.updmsg');
$lm = @filemtime($cf);
$is_http = substr(DOKU_MESSAGEURL, 0, 5) != 'https';
// check if new messages needs to be fetched
if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.DOKU_SCRIPT)){
@touch($cf);
dbglog("checkUpdateMessages(): downloading messages to ".$cf);
dbglog("checkUpdateMessages(): downloading messages to ".$cf.($is_http?' (without SSL)':' (with SSL)'));
$http = new DokuHTTPClient();
$http->timeout = 12;
$resp = $http->get(DOKU_MESSAGEURL.$updateVersion);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment