Skip to content

Commit

Permalink
New feature #8659: Configurable proxy for comfort update
Browse files Browse the repository at this point in the history
Dev: New config variables for proxy host and port
  • Loading branch information
mfaber committed Apr 11, 2014
1 parent 188181e commit 93277ec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions application/config/config-defaults.php
Expand Up @@ -552,6 +552,16 @@
*/
$config['updatenotification'] = 'both';

// Proxy settings for ComfortUpdate
/**
* Set these if you are behind a proxy and want to update LS using ComfortUpdate
*
* $proxy_host_name Your proxy server name (string)
* $proxy_host_port Your proxy server port (int)
*/
$config['proxy_host_name'] = '';
$config['proxy_host_port'] = 80;


// === Advanced Setup
// The following parameters need information from config.php
Expand Down
13 changes: 13 additions & 0 deletions application/controllers/admin/update.php
Expand Up @@ -106,6 +106,8 @@ private function _readChangelog(httpRequestIt $http)

private function _requestChangelog(httpRequestIt $http, $buildnumber, $updaterversion)
{
$http->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$http->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);
$http->timeout = 0;
$http->data_timeout = 0;
$http->user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
Expand All @@ -118,6 +120,8 @@ private function _requestChangelog(httpRequestIt $http, $buildnumber, $updaterve

private function _requestChangedFiles(httpRequestIt $http, $buildnumber, $updaterversion)
{
$http->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$http->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);
$http->timeout = 0;
$http->data_timeout = 0;
$http->user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
Expand Down Expand Up @@ -344,6 +348,9 @@ function step4()
$downloaderror=false;
Yii::import('application.libraries.admin.http.httpRequestIt');
$http=new httpRequestIt;

$http->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$http->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);

// Allow redirects
$http->follow_redirect=1;
Expand Down Expand Up @@ -453,6 +460,9 @@ private function _RunUpdaterUpdate()
Yii::import('application.libraries.admin.http.httpRequestIt');
$oHTTPRequest=new httpRequestIt;

$oHTTPRequest->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$oHTTPRequest->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);

/* Connection timeout */
$oHTTPRequest->timeout=0;
/* Data transfer timeout */
Expand Down Expand Up @@ -505,6 +515,9 @@ private function _RunUpdaterUpdate()
Yii::import('application.libraries.admin.http.httpRequestIt');
$oHTTPRequest=new httpRequestIt;

$oHTTPRequest->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$oHTTPRequest->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);

// Allow redirects
$oHTTPRequest->follow_redirect=1;
/* Connection timeout */
Expand Down
2 changes: 2 additions & 0 deletions application/helpers/common_helper.php
Expand Up @@ -5602,6 +5602,8 @@ function getUpdateInfo()
Yii::import('application.libraries.admin.http.httpRequestIt');
$http=new httpRequestIt;

$http->proxy_host_name = Yii::app()->getConfig("proxy_host_name","");
$http->proxy_host_port = Yii::app()->getConfig("proxy_host_port",80);
$http->timeout=0;
$http->data_timeout=0;
$http->user_agent="LimeSurvey ".Yii::app()->getConfig("versionnumber")." build ".Yii::app()->getConfig("buildnumber");
Expand Down

0 comments on commit 93277ec

Please sign in to comment.