Skip to content
Snippets Groups Projects
Commit 92ca36ed authored by Andreas Gohr's avatar Andreas Gohr Committed by GitHub
Browse files

Merge pull request #2095 from phy25/update-check-ssl-nofallback

Update check supports HTTPS (without fallback)
parents 96713c27 6c5e3c5e
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,14 @@ ...@@ -6,7 +6,14 @@
* @author Andreas Gohr <andi@splitbrain.org> * @author Andreas Gohr <andi@splitbrain.org>
*/ */
if(!defined('DOKU_INC')) die('meh.'); 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 * Check for new messages from upstream
...@@ -22,11 +29,12 @@ function checkUpdateMessages(){ ...@@ -22,11 +29,12 @@ function checkUpdateMessages(){
$cf = getCacheName($updateVersion, '.updmsg'); $cf = getCacheName($updateVersion, '.updmsg');
$lm = @filemtime($cf); $lm = @filemtime($cf);
$is_http = substr(DOKU_MESSAGEURL, 0, 5) != 'https';
// check if new messages needs to be fetched // check if new messages needs to be fetched
if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.DOKU_SCRIPT)){ if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.DOKU_SCRIPT)){
@touch($cf); @touch($cf);
dbglog("checkUpdateMessages(): downloading messages to ".$cf); dbglog("checkUpdateMessages(): downloading messages to ".$cf.($is_http?' (without SSL)':' (with SSL)'));
$http = new DokuHTTPClient(); $http = new DokuHTTPClient();
$http->timeout = 12; $http->timeout = 12;
$resp = $http->get(DOKU_MESSAGEURL.$updateVersion); $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