diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 15:31:17 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2016-03-25 19:48:06 +0100 |
commit | 0d5c4e438e001ef21dfae69df4ae186b697d2efc (patch) | |
tree | 82e00390f6bac6fbcb1bb09479982167b5e792f4 /service/feedservice.php | |
parent | f7520a8fe7191475668904f5f8c1816df25e2e5a (diff) |
add basic basic auth support
Diffstat (limited to 'service/feedservice.php')
-rw-r--r-- | service/feedservice.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/service/feedservice.php b/service/feedservice.php index a6ebc27cb..19c0a3b4b 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -89,14 +89,20 @@ class FeedService extends Service { * folder * @param string $userId for which user the feed should be created * @param string $title if given, this is used for the opml feed title + * @param string $basicAuthUser if given, basic auth is set for this feed + * @param string $basicAuthPassword if given, basic auth is set for this + * feed. Ignored if user is null or an empty string * @throws ServiceConflictException if the feed exists already * @throws ServiceNotFoundException if the url points to an invalid feed * @return Feed the newly created feed */ - public function create($feedUrl, $folderId, $userId, $title=null){ + public function create($feedUrl, $folderId, $userId, $title=null, + $basicAuthUser=null, $basicAuthPassword=null){ // first try if the feed exists already try { - list($feed, $items) = $this->feedFetcher->fetch($feedUrl); + list($feed, $items) = $this->feedFetcher->fetch($feedUrl, true, + null, null, false, $basicAuthUser, + $basicAuthPassword); // try again if feed exists depending on the reported link try { @@ -109,6 +115,8 @@ class FeedService extends Service { // insert feed $itemCount = count($items); + $feed->setBasicAuthUser($basicAuthUser); + $feed->setBasicAuthPassword($basicAuthPassword); $feed->setFolderId($folderId); $feed->setUserId($userId); $feed->setArticlesPerUpdate($itemCount); @@ -198,7 +206,9 @@ class FeedService extends Service { false, $existingFeed->getLastModified(), $existingFeed->getEtag(), - $existingFeed->getFullTextEnabled() + $existingFeed->getFullTextEnabled(), + $existingFeed->getBasicAuthUser(), + $existingFeed->getBasicAuthPassword() ); // if there is no feed it means that no update took place |