diff options
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | 10 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/config/services.yml | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php index 8891887b..1ac8feb1 100644 --- a/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php +++ b/src/Wallabag/CoreBundle/Helper/HttpClientFactory.php | |||
@@ -6,6 +6,7 @@ use Graby\Ring\Client\SafeCurlHandler; | |||
6 | use GuzzleHttp\Client; | 6 | use GuzzleHttp\Client; |
7 | use GuzzleHttp\Cookie\CookieJar; | 7 | use GuzzleHttp\Cookie\CookieJar; |
8 | use GuzzleHttp\Event\SubscriberInterface; | 8 | use GuzzleHttp\Event\SubscriberInterface; |
9 | use Psr\Log\LoggerInterface; | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Builds and configures the Guzzle HTTP client. | 12 | * Builds and configures the Guzzle HTTP client. |
@@ -19,6 +20,7 @@ class HttpClientFactory | |||
19 | private $cookieJar; | 20 | private $cookieJar; |
20 | 21 | ||
21 | private $restrictedAccess; | 22 | private $restrictedAccess; |
23 | private $logger; | ||
22 | 24 | ||
23 | /** | 25 | /** |
24 | * HttpClientFactory constructor. | 26 | * HttpClientFactory constructor. |
@@ -26,12 +28,14 @@ class HttpClientFactory | |||
26 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber | 28 | * @param \GuzzleHttp\Event\SubscriberInterface $authenticatorSubscriber |
27 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar | 29 | * @param \GuzzleHttp\Cookie\CookieJar $cookieJar |
28 | * @param string $restrictedAccess this param is a kind of boolean. Values: 0 or 1 | 30 | * @param string $restrictedAccess this param is a kind of boolean. Values: 0 or 1 |
31 | * @param LoggerInterface $logger | ||
29 | */ | 32 | */ |
30 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess) | 33 | public function __construct(SubscriberInterface $authenticatorSubscriber, CookieJar $cookieJar, $restrictedAccess, LoggerInterface $logger) |
31 | { | 34 | { |
32 | $this->authenticatorSubscriber = $authenticatorSubscriber; | 35 | $this->authenticatorSubscriber = $authenticatorSubscriber; |
33 | $this->cookieJar = $cookieJar; | 36 | $this->cookieJar = $cookieJar; |
34 | $this->restrictedAccess = $restrictedAccess; | 37 | $this->restrictedAccess = $restrictedAccess; |
38 | $this->logger = $logger; | ||
35 | } | 39 | } |
36 | 40 | ||
37 | /** | 41 | /** |
@@ -39,8 +43,10 @@ class HttpClientFactory | |||
39 | */ | 43 | */ |
40 | public function buildHttpClient() | 44 | public function buildHttpClient() |
41 | { | 45 | { |
46 | $this->logger->log('debug', 'Restricted access config enabled?', array('enabled' => (int) $this->restrictedAccess)); | ||
47 | |||
42 | if (0 === (int) $this->restrictedAccess) { | 48 | if (0 === (int) $this->restrictedAccess) { |
43 | return null; | 49 | return; |
44 | } | 50 | } |
45 | 51 | ||
46 | // we clear the cookie to avoid websites who use cookies for analytics | 52 | // we clear the cookie to avoid websites who use cookies for analytics |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 036735ec..51d6ab47 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -74,6 +74,7 @@ services: | |||
74 | - "@bd_guzzle_site_authenticator.authenticator_subscriber" | 74 | - "@bd_guzzle_site_authenticator.authenticator_subscriber" |
75 | - "@wallabag_core.guzzle.cookie_jar" | 75 | - "@wallabag_core.guzzle.cookie_jar" |
76 | - '@=service(''craue_config'').get(''restricted_access'')' | 76 | - '@=service(''craue_config'').get(''restricted_access'')' |
77 | - '@logger' | ||
77 | 78 | ||
78 | wallabag_core.guzzle.cookie_jar: | 79 | wallabag_core.guzzle.cookie_jar: |
79 | class: GuzzleHttp\Cookie\FileCookieJar | 80 | class: GuzzleHttp\Cookie\FileCookieJar |