@@ -11,48 +11,48 @@ |
||
11 | 11 | */ |
12 | 12 | class MaintenanceProxyExtension extends Extension |
13 | 13 | { |
14 | - /** |
|
15 | - * Configures required environment settings for Composer's use, applies to |
|
16 | - * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in |
|
17 | - * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer |
|
18 | - * is created |
|
19 | - */ |
|
20 | - public function onAfterBuild() |
|
21 | - { |
|
22 | - // Provide access for Composer's StreamContextFactory, since it creates its own stream context |
|
23 | - if ($proxy = $this->getCwpProxy()) { |
|
24 | - $_SERVER['CGI_HTTP_PROXY'] = $proxy; |
|
25 | - } |
|
26 | - } |
|
14 | + /** |
|
15 | + * Configures required environment settings for Composer's use, applies to |
|
16 | + * {@link \BringYourOwnIdeas\Maintenance\Util\ComposerLoader} and is applied before ComposerLoaderExtension in |
|
17 | + * bringyourownideas/silverstripe-composer-update-checker to ensure the proxy information is set before Composer |
|
18 | + * is created |
|
19 | + */ |
|
20 | + public function onAfterBuild() |
|
21 | + { |
|
22 | + // Provide access for Composer's StreamContextFactory, since it creates its own stream context |
|
23 | + if ($proxy = $this->getCwpProxy()) { |
|
24 | + $_SERVER['CGI_HTTP_PROXY'] = $proxy; |
|
25 | + } |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in |
|
30 | - * their Guzzle clients |
|
31 | - * |
|
32 | - * @param array $options |
|
33 | - */ |
|
34 | - public function updateClientOptions(&$options) |
|
35 | - { |
|
36 | - if ($proxy = $this->getCwpProxy()) { |
|
37 | - $options['proxy'] = $proxy; |
|
38 | - } |
|
39 | - } |
|
28 | + /** |
|
29 | + * Provide proxy options for {@link \BringYourOwnIdeas\Maintenance\Util\ApiLoader} instances to use in |
|
30 | + * their Guzzle clients |
|
31 | + * |
|
32 | + * @param array $options |
|
33 | + */ |
|
34 | + public function updateClientOptions(&$options) |
|
35 | + { |
|
36 | + if ($proxy = $this->getCwpProxy()) { |
|
37 | + $options['proxy'] = $proxy; |
|
38 | + } |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234` |
|
43 | - * |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - protected function getCwpProxy() |
|
47 | - { |
|
48 | - if (!defined('SS_OUTBOUND_PROXY') || !defined('SS_OUTBOUND_PROXY_PORT')) { |
|
49 | - return ''; |
|
50 | - } |
|
41 | + /** |
|
42 | + * Returns a formatted CWP proxy string, e.g. `tcp://proxy.cwp.govt.nz:1234` |
|
43 | + * |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + protected function getCwpProxy() |
|
47 | + { |
|
48 | + if (!defined('SS_OUTBOUND_PROXY') || !defined('SS_OUTBOUND_PROXY_PORT')) { |
|
49 | + return ''; |
|
50 | + } |
|
51 | 51 | |
52 | - return sprintf( |
|
53 | - 'tcp://%s:%d', |
|
54 | - SS_OUTBOUND_PROXY, |
|
55 | - SS_OUTBOUND_PROXY_PORT |
|
56 | - ); |
|
57 | - } |
|
52 | + return sprintf( |
|
53 | + 'tcp://%s:%d', |
|
54 | + SS_OUTBOUND_PROXY, |
|
55 | + SS_OUTBOUND_PROXY_PORT |
|
56 | + ); |
|
57 | + } |
|
58 | 58 | } |