diff options
81 files changed, 412 insertions, 229 deletions
@@ -1,3 +1,7 @@ +owncloud-news (1.001) +* Also use monospace for pre tag +* Fix bug that would prevent feed updates when feeds or folders are deleted + ownCloud-news (0.104) * Also html decode the links to the page to not break on nyaa torrents diff --git a/README.rst b/README.rst index 2fb59829c..65c063390 100644 --- a/README.rst +++ b/README.rst @@ -43,11 +43,6 @@ Should you have upgraded from a prior version, disable the CSS and JavaScript ca You can remove the line after a page reload -Update Notices --------------- -Should you have **updated from a version prior to 0.100** you'll have to run this SQL query to trigger a schema upgrade:: - - UPDATE oc_appconfig SET configvalue = '0.001' WHERE configkey = 'installed_version' AND appid = 'news' App Store --------- @@ -125,7 +120,7 @@ Official Unofficial ~~~~~~~~~~ * **Author**: `David Luhmer <https://github.com/David-Development>`_ -* **Link**: `Owncloud News Reader <http://luhmer.homelinux.com/wordpress/?p=126>`_ +* **Link**: `Owncloud News Reader <http://david-luhmer.de/wordpress/?p=126>`_ * **Google play Store**: `buy the App <https://play.google.com/store/apps/details?id=de.luhmer.owncloudnewsreader>`_ * **Status**: Beta * **Platform**: Android diff --git a/appinfo/info.xml b/appinfo/info.xml index ea3e03c93..9a493ad5b 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -5,6 +5,6 @@ <description>An RSS/Atom feed reader. Requires the App Framework app and backgroundjobs need to be enabled. See the README.rst in the apps top directory</description> <licence>AGPL</licence> <author>Alessandro Cosentino, Bernhard Posselt, Jan-Christoph Borchardt. Powered by SimplePie (Ryan Parman, Geoffrey Sneddon, Ryan McCue and contributors).</author> - <version>0.104</version> + <version>1.001</version> <require>5.0.6</require> </info> diff --git a/appinfo/version b/appinfo/version index c59d960ab..9aaba2386 100644 --- a/appinfo/version +++ b/appinfo/version @@ -1 +1 @@ -0.104
\ No newline at end of file +1.001
\ No newline at end of file diff --git a/backgroundjob/task.php b/backgroundjob/task.php index 9a21a662f..24470c1a6 100644 --- a/backgroundjob/task.php +++ b/backgroundjob/task.php @@ -35,9 +35,9 @@ class Task { static public function run() { $container = new DIContainer(); $container['FolderBusinessLayer']->purgeDeleted(); - $container['FeedBusinessLayer']->updateAll(); $container['FeedBusinessLayer']->purgeDeleted(); $container['ItemBusinessLayer']->autoPurgeOld(); + $container['FeedBusinessLayer']->updateAll(); } diff --git a/businesslayer/businesslayer.php b/businesslayer/businesslayer.php index 4ce6f1625..54b64d6a2 100644 --- a/businesslayer/businesslayer.php +++ b/businesslayer/businesslayer.php @@ -40,12 +40,27 @@ abstract class BusinessLayer { } + /** + * Delete an entity + * @param int $id the id of the entity + * @param string $userId the name of the user for security reasons + * @throws DoesNotExistException if the entity does not exist + * @throws MultipleObjectsReturnedException if more than one entity exists + */ public function delete($id, $userId){ $entity = $this->find($id, $userId); $this->mapper->delete($entity); } + /** + * Finds an entity by id + * @param int $id the id of the entity + * @param string $userId the name of the user for security reasons + * @throws DoesNotExistException if the entity does not exist + * @throws MultipleObjectsReturnedException if more than one entity exists + * @return Entity the entity + */ public function find($id, $userId){ try { return $this->mapper->find($id, $userId); @@ -56,4 +71,4 @@ abstract class BusinessLayer { } } -}
\ No newline at end of file +} diff --git a/businesslayer/feedbusinesslayer.php b/businesslayer/feedbusinesslayer.php index 53e0862a9..c0d0fdf21 100644 --- a/businesslayer/feedbusinesslayer.php +++ b/businesslayer/feedbusinesslayer.php @@ -59,15 +59,24 @@ class FeedBusinessLayer extends BusinessLayer { $this->autoPurgeMinimumInterval = $autoPurgeMinimumInterval; } - + /** + * Finds all feeds of a user + * @param string $userId the name of the user + * @return array of feeds + */ public function findAll($userId){ return $this->mapper->findAllFromUser($userId); } /** + * Creates a new feed + * @param string $feedUrl the url to the feed + * @param int $folderId the folder where it should be put into, 0 for root folder + * @param string $userId for which user the feed should be created * @throws BusinessLayerExistsException if the feed exists already * @throws BusinessLayerException if the url points to an invalid feed + * @return Feed the newly created feed */ public function create($feedUrl, $folderId, $userId){ // first try if the feed exists already @@ -76,10 +85,10 @@ class FeedBusinessLayer extends BusinessLayer { throw new BusinessLayerExistsException( $this->api->getTrans()->t('Can not add feed: Exists already')); } catch(DoesNotExistException $ex){} - + try { list($feed, $items) = $this->feedFetcher->fetch($feedUrl); - + // insert feed $feed->setFolderId($folderId); $feed->setUserId($userId); @@ -106,7 +115,7 @@ class FeedBusinessLayer extends BusinessLayer { // set unread count $feed->setUnreadCount($unreadCount); - + return $feed; } catch(FetcherException $ex){ $this->api->log($ex->getMessage()); @@ -117,8 +126,11 @@ class FeedBusinessLayer extends BusinessLayer { } - // FIXME: this method is not covered by any tests + /** + * Runs all the feed updates + */ public function updateAll(){ + // TODO: this method is not covered by any tests $feeds = $this->mapper->findAll(); foreach($feeds as $feed){ try { @@ -131,7 +143,11 @@ class FeedBusinessLayer extends BusinessLayer { /** + * Updates a single feed + * @param int $feedId the id of the feed that should be updated + * @param string $userId the id of the user * @throws BusinessLayerException if the feed does not exist + * @return Feed the updated feed entity */ public function update($feedId, $userId){ try { @@ -145,7 +161,7 @@ class FeedBusinessLayer extends BusinessLayer { list($feed, $items) = $this->feedFetcher->fetch( $existingFeed->getUrl()); - // insert items in reverse order because the first one is usually + // insert items in reverse order because the first one is usually // the newest item for($i=count($items)-1; $i>=0; $i--){ $item = $items[$i]; @@ -156,12 +172,12 @@ class FeedBusinessLayer extends BusinessLayer { $item->getGuidHash(), $feedId, $userId); // in case of an update the existing item has to be deleted - // if the pub_date changed because we sort by id on the + // if the pub_date changed because we sort by id on the // client side since this is the only reliable way to do it // to not get weird behaviour if((int)$existing->getPubDate() !== (int)$item->getPubDate()){ - // because the item is being replaced we need to keep + // because the item is being replaced we need to keep // status flags but we want the new entry to be unread $item->setStatus($existing->getStatus()); $item->setUnread(); @@ -181,9 +197,9 @@ class FeedBusinessLayer extends BusinessLayer { ': Not found or bad source'); $this->api->log($ex->getMessage()); } - + return $this->mapper->find($feedId, $userId); - + } catch (DoesNotExistException $ex){ throw new BusinessLayerException('Feed does not exist'); } @@ -191,6 +207,10 @@ class FeedBusinessLayer extends BusinessLayer { /** + * Moves a feed into a different folder + * @param int $feedId the id of the feed that should be moved + * @param int $folderId the id of the folder where the feed should be moved to + * @param string $userId the name of the user whose feed should be moved * @throws BusinessLayerException if the feed does not exist */ public function move($feedId, $folderId, $userId){ @@ -241,6 +261,8 @@ class FeedBusinessLayer extends BusinessLayer { /** * Use this to mark a feed as deleted. That way it can be undeleted + * @param int $feedId the id of the feed that should be deleted + * @param string $userId the name of the user for security reasons * @throws BusinessLayerException when feed does not exist */ public function markDeleted($feedId, $userId) { @@ -252,6 +274,8 @@ class FeedBusinessLayer extends BusinessLayer { /** * Use this to undo a feed deletion + * @param int $feedId the id of the feed that should be restored + * @param string $userId the name of the user for security reasons * @throws BusinessLayerException when feed does not exist */ public function unmarkDeleted($feedId, $userId) { @@ -265,7 +289,7 @@ class FeedBusinessLayer extends BusinessLayer { * Deletes all deleted feeds * @param string $userId if given it purges only feeds of that user * @param boolean $useInterval defaults to true, if true it only purges - * entries in a given interval to give the user a chance to undo the + * entries in a given interval to give the user a chance to undo the * deletion */ public function purgeDeleted($userId=null, $useInterval=true) { @@ -276,7 +300,7 @@ class FeedBusinessLayer extends BusinessLayer { $deleteOlderThan = $now - $this->autoPurgeMinimumInterval; } - $toDelete = $this->mapper->getToDelete($deleteOlderThan, $userId); + $toDelete = $this->mapper->getToDelete($deleteOlderThan, $userId); foreach ($toDelete as $feed) { $this->mapper->delete($feed); diff --git a/businesslayer/folderbusinesslayer.php b/businesslayer/folderbusinesslayer.php index 662b04b01..f5afe24ad 100644 --- a/businesslayer/folderbusinesslayer.php +++ b/businesslayer/folderbusinesslayer.php @@ -48,7 +48,11 @@ class FolderBusinessLayer extends BusinessLayer { $this->autoPurgeMinimumInterval = $autoPurgeMinimumInterval; } - + /** + * Returns all folders of a user + * @param string $userId the name of the user + * @return array of folders + */ public function findAll($userId) { return $this->mapper->findAllFromUser($userId); } @@ -63,8 +67,14 @@ class FolderBusinessLayer extends BusinessLayer { } } + /** + * Creates a new folder + * @param string $folderName the name of the folder + * @param string $userId the name of the user for whom it should be created + * @param int $parentId the parent folder id, deprecated we dont nest folders * @throws BusinessLayerExistsException if name exists already + * @return Folder the newly created folder */ public function create($folderName, $userId, $parentId=0) { $this->allowNoNameTwice($folderName, $userId); @@ -88,20 +98,27 @@ class FolderBusinessLayer extends BusinessLayer { /** + * Renames a folder + * @param int $folderId the id of the folder that should be deleted + * @param string $folderName the new name of the folder + * @param string $userId the name of the user for security reasons * @throws BusinessLayerExistsException if name exists already * @throws BusinessLayerException if the folder does not exist + * @return Folder the updated folder */ public function rename($fol |