Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
ca922c24
Commit
ca922c24
authored
Jan 13, 2016
by
Andrew Nicols
Browse files
Merge branch 'MDL-51710-master' of
git://github.com/FMCorz/moodle
parents
9ef63865
2a5920c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
repository/s3/lib.php
View file @
ca922c24
...
...
@@ -43,6 +43,7 @@ class repository_s3 extends repository {
* @param array $options
*/
public
function
__construct
(
$repositoryid
,
$context
=
SYSCONTEXTID
,
$options
=
array
())
{
global
$CFG
;
parent
::
__construct
(
$repositoryid
,
$context
,
$options
);
$this
->
access_key
=
get_config
(
's3'
,
'access_key'
);
$this
->
secret_key
=
get_config
(
's3'
,
'secret_key'
);
...
...
@@ -52,6 +53,26 @@ class repository_s3 extends repository {
}
$this
->
s
=
new
S3
(
$this
->
access_key
,
$this
->
secret_key
,
false
,
$this
->
endpoint
);
$this
->
s
->
setExceptions
(
true
);
// Port of curl::__construct().
if
(
!
empty
(
$CFG
->
proxyhost
))
{
if
(
empty
(
$CFG
->
proxyport
))
{
$proxyhost
=
$CFG
->
proxyhost
;
}
else
{
$proxyhost
=
$CFG
->
proxyhost
.
':'
.
$CFG
->
proxyport
;
}
$proxytype
=
CURLPROXY_HTTP
;
$proxyuser
=
null
;
$proxypass
=
null
;
if
(
!
empty
(
$CFG
->
proxyuser
)
and
!
empty
(
$CFG
->
proxypassword
))
{
$proxyuser
=
$CFG
->
proxyuser
;
$proxypass
=
$CFG
->
proxypassword
;
}
if
(
!
empty
(
$CFG
->
proxytype
)
&&
$CFG
->
proxytype
==
'SOCKS5'
)
{
$proxytype
=
CURLPROXY_SOCKS5
;
}
$this
->
s
->
setProxy
(
$proxyhost
,
$proxyuser
,
$proxypass
,
$proxytype
);
}
}
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment