Skip to content

Commit

Permalink
Add curl timeout option
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Martel committed Jul 19, 2018
1 parent ffb4ccd commit 304df95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FeedsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options =
} else {
$this->simplepie->strip_attributes(false);
}
if (isset($this->config['curl.timeout']) && is_int($this->config['curl.timeout'])) {
$this->simplepie->set_timeout($this->config['curl.timeout']);
}
if (isset($options) && is_array($options)) {
if (isset($options['curl.options']) && is_array($options['curl.options'])) {
$this->simplepie->set_curl_options($this->simplepie->curl_options + $options['curl.options']);
Expand All @@ -53,6 +56,9 @@ public function make($feed_url = [], $limit = 0, $force_feed = false, $options =
if (isset($options['strip_attribute.tags']) && is_array($options['strip_attribute.tags'])) {
$this->simplepie->strip_attributes($options['strip_attribute.tags']);
}
if (isset($options['curl.timeout']) && is_int($options['curl.timeout'])) {
$this->simplepie->set_timeout($options['curl.timeout']);
}
}
$this->simplepie->init();

Expand Down
2 changes: 2 additions & 0 deletions src/config/feeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@
|
*/
'curl.options' => null,

'curl.timeout' => null,

];

0 comments on commit 304df95

Please sign in to comment.