diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-22 10:49:34 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-22 10:49:45 +0200 |
commit | cc3fa38cee2e24dacb940ec5d7ca41e593aa824a (patch) | |
tree | 376eeb6910fc24d14f19992ab4a3d64aa1189448 /appinfo | |
parent | 720db05f884817ef3683acb697ab89b76a8e3f91 (diff) |
fix tests
Diffstat (limited to 'appinfo')
-rw-r--r-- | appinfo/application.php | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/appinfo/application.php b/appinfo/application.php index 0faceb5be..be903b120 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -51,7 +51,7 @@ use \OCA\News\Db\MapperFactory; use \OCA\News\Utility\OPMLExporter; use \OCA\News\Utility\Updater; use \OCA\News\Utility\PicoFeedClientFactory; -use \OCA\News\Utility\FaviconFetcher; +use \OCA\News\Utility\ProxyConfigParser; use \OCA\News\Fetcher\Fetcher; use \OCA\News\Fetcher\FeedFetcher; @@ -413,6 +413,7 @@ class Application extends App { // FIXME: move this into a separate class for testing? $config = $c->query('Config'); $appConfig = $c->query('AppConfig'); + $proxy = $c->query('ProxyConfigParser'); $pico = new PicoFeedConfig(); $pico->setClientUserAgent( @@ -424,26 +425,23 @@ class Application extends App { ->setContentFiltering(false); // proxy settings - $proxy = \OCP\Config::getSystemValue('proxy'); - if ($proxy) { - // we need to filter out the port -.- - $url = new \Net_URL2($proxy); - $port = $url->getPort(); - $url->setPort(false); - $host = $url->getUrl(); + $proxySettings = $proxy->parse(); + $host = $proxySettings['host']; + $port = $proxySettings['port']; + $user = $proxySettings['user']; + $password = $proxySettings['password']; + + if ($host) { + $pico->setProxyHostname($host); if ($port) { $pico->setProxyPort($port); } - - $pico->setProxyHostname($host); } - $proxyAuth = \OCP\Config::getSystemValue('proxyuserpwd'); - if ($proxyAuth) { - $auth = explode(':', $proxyAuth, 2); - $pico->setProxyUsername($auth[0]) - ->setProxyPassword($auth[1]); + if ($user) { + $pico->setProxyUsername($user) + ->setProxyPassword($password); } return $pico; @@ -484,6 +482,12 @@ class Application extends App { return new OPMLExporter(); }); + $container->registerService('ProxyConfigParser', function($c) { + return new ProxyConfigParser( + $c->query('CoreConfig') + ); + }); + $container->registerService('Updater', function($c) { return new Updater( $c->query('FolderService'), |