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