From 06367d8b81407fc2948e0f666b38f4de2dffbd89 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 25 Jun 2014 11:22:08 +0200 Subject: style fixes --- appinfo/app.php | 4 +- appinfo/application.php | 6 +- articleenhancer/enhancer.php | 7 +- articleenhancer/xpatharticleenhancer.php | 17 ++--- config/appconfig.php | 6 +- controller/entityapiserializer.php | 4 +- controller/feedapicontroller.php | 73 ++++++++++--------- controller/feedcontroller.php | 108 ++++++++++++++++------------ controller/folderapicontroller.php | 49 +++++++------ controller/foldercontroller.php | 79 +++++++++++--------- controller/itemapicontroller.php | 120 +++++++++++++++++-------------- controller/itemcontroller.php | 75 ++++++++++--------- controller/jsonhttperror.php | 2 +- db/feed.php | 2 - db/item.php | 5 -- db/mapperfactory.php | 4 +- fetcher/fetcher.php | 2 + service/feedservice.php | 5 +- service/itemservice.php | 1 - templates/part.content.php | 2 +- templates/part.items.php | 4 +- 21 files changed, 324 insertions(+), 251 deletions(-) diff --git a/appinfo/app.php b/appinfo/app.php index e50525a5c..cacd0637d 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -13,6 +13,8 @@ namespace OCA\News\AppInfo; +use \OCA\News\Config\DependencyException; + $container = new Application(); $config = $container->getAppConfig(); @@ -24,7 +26,7 @@ $config->registerHooks(); // check for correct app dependencies try { $config->testDependencies(); -} catch(\OCA\News\Config\DependencyException $e) { +} catch(DependencyException $e) { $logger = $container->getLogger(); $params = $container->getLoggerParameters(); $logger->emergency($e->getMessage(), $params); diff --git a/appinfo/application.php b/appinfo/application.php index d2e846ded..ddc3cb903 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -15,6 +15,8 @@ namespace OCA\News\AppInfo; use \OC\Files\View; use \OCP\AppFramework\App; +use \OCP\Util; +use \OCP\User; use \OCA\News\Config\AppConfig; @@ -260,7 +262,7 @@ class Application extends App { $c->query('L10N'), $c->query('ServerContainer')->getURLGenerator(), phpversion(), - implode('.', \OCP\Util::getVersion()), + implode('.', Util::getVersion()), $apps, $extensions, $c->query('DatabaseType') @@ -275,7 +277,7 @@ class Application extends App { }); $container->registerService('UserId', function() { - return \OCP\User::getUser(); + return User::getUser(); }); $container->registerService('Logger', function($c) { diff --git a/articleenhancer/enhancer.php b/articleenhancer/enhancer.php index f9b4d5d64..9aa2153d1 100644 --- a/articleenhancer/enhancer.php +++ b/articleenhancer/enhancer.php @@ -50,9 +50,10 @@ class Enhancer { } - /** - * @param string $url - */ + /** + * @param string $url + * @return string + */ private function removeTrailingSlash($url) { if($url[strlen($url)-1] === '/') { return substr($url, 0, -1); diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index ecde135bf..2499476e9 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -21,20 +21,21 @@ use \OCA\News\Utility\Config; class XPathArticleEnhancer implements ArticleEnhancer { - private $feedRegex; private $fileFactory; private $maximumTimeout; private $config; private $regexXPathPair; - /** - * @param SimplePieFileFactory a factory for getting a simple pie file instance - * @param array $regexXPathPair an associative array containing regex to - * match the url and the xpath that should be used for it to extract the - * page - * @param int $maximumTimeout maximum timeout in seconds, defaults to 10 sec - */ + /** + * @param \OCA\News\Utility\SimplePieAPIFactory $fileFactory + * @param array $regexXPathPair an associative array containing regex to + * match the url and the xpath that should be used for it to extract the + * page + * @param \OCA\News\Utility\Config $config + * @internal param \OCA\News\ArticleEnhancer\a $SimplePieFileFactory factory for getting a simple pie file instance + * @internal param int $maximumTimeout maximum timeout in seconds, defaults to 10 sec + */ public function __construct(SimplePieAPIFactory $fileFactory, array $regexXPathPair, Config $config){ $this->regexXPathPair = $regexXPathPair; diff --git a/config/appconfig.php b/config/appconfig.php index 4315569d6..456b3d2e3 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -19,6 +19,8 @@ use OCP\BackgroundJob\IJobList; use OCP\INavigationManager; use OCP\IL10N; use OCP\IURLGenerator; +use \OCP\Backgroundjob; +use \OCP\Util; // Used to parse app.json file, should be in core at some point @@ -136,7 +138,7 @@ class AppConfig { // FIXME: this is temporarily static because core jobs are not public // yet, therefore legacy code foreach ($this->config['jobs'] as $job) { - \OCP\Backgroundjob::addRegularTask($job, 'run'); + Backgroundjob::addRegularTask($job, 'run'); } } @@ -152,7 +154,7 @@ class AppConfig { $reaction = explode('::', $react); // config is written like HookNamespace::method => Class::method - \OCP\Util::connectHook($listener[0], $listener[1], $reaction[0], + Util::connectHook($listener[0], $listener[1], $reaction[0], $reaction[1]); } } diff --git a/controller/entityapiserializer.php b/controller/entityapiserializer.php index eb60bc7c5..5153d9aa3 100644 --- a/controller/entityapiserializer.php +++ b/controller/entityapiserializer.php @@ -26,11 +26,13 @@ class EntityApiSerializer { /** * Call toAPI() method on all entities. Works on - * @param mixed $data: + * + * @param mixed $data : * * Entity * * Entity[] * * array('level' => Entity[]) * * Response + * @return array|mixed */ public function serialize($data) { diff --git a/controller/feedapicontroller.php b/controller/feedapicontroller.php index 4ba3b9be5..f0af19f4a 100644 --- a/controller/feedapicontroller.php +++ b/controller/feedapicontroller.php @@ -60,7 +60,6 @@ class FeedApiController extends ApiController { public function index() { $result = [ - 'feeds' => [], 'starredCount' => $this->itemService->starredCount($this->userId), 'feeds' => $this->feedService->findAll($this->userId) ]; @@ -76,14 +75,15 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param string $url - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param string $url + * @param int $folderId + * @return array|mixed|\OCP\AppFramework\Http\JSONResponse + */ public function create($url, $folderId=0) { try { $this->feedService->purgeDeleted($this->userId, false); @@ -107,19 +107,22 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($feedId) { try { $this->feedService->delete($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } @@ -136,37 +139,43 @@ class FeedApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param int $folderId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function move($feedId, $folderId) { try { $this->feedService->move($feedId, $folderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $feedTitle - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $feedTitle + * @return \OCP\AppFramework\Http\JSONResponse + */ public function rename($feedId, $feedTitle) { try { $this->feedService->rename($feedId, $feedTitle, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/feedcontroller.php b/controller/feedcontroller.php index 3b9ab5cf9..d62b05c45 100644 --- a/controller/feedcontroller.php +++ b/controller/feedcontroller.php @@ -118,13 +118,14 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param string $url - * @param int $parentFolderId - * @param string $title - */ + /** + * @NoAdminRequired + * + * @param string $url + * @param int $parentFolderId + * @param string $title + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function create($url, $parentFolderId, $title){ try { // we need to purge deleted feeds if a feed is created to @@ -150,28 +151,33 @@ class FeedController extends Controller { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_UNPROCESSABLE_ENTITY); } + } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function delete($feedId){ try { $this->feedService->markDeleted($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function update($feedId){ try { $feed = $this->feedService->update($feedId, $this->userId); @@ -190,43 +196,51 @@ class FeedController extends Controller { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param int $parentFolderId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param int $parentFolderId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function move($feedId, $parentFolderId){ try { $this->feedService->move($feedId, $parentFolderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param string $feedTitle - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param string $feedTitle + * @return \OCP\AppFramework\Http\JSONResponse + */ public function rename($feedId, $feedTitle) { try { $this->feedService->rename($feedId, $feedTitle, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param array $json - */ + /** + * @NoAdminRequired + * + * @param array $json + * @return array + */ public function import($json) { $feed = $this->feedService->importArticles($json, $this->userId); @@ -240,12 +254,13 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param int $highestItemId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param int $highestItemId + * @return array + */ public function read($feedId, $highestItemId){ $this->itemService->readFeed($feedId, $highestItemId, $this->userId); @@ -260,17 +275,20 @@ class FeedController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $feedId - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @return \OCP\AppFramework\Http\JSONResponse + */ public function restore($feedId){ try { $this->feedService->unmarkDeleted($feedId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/folderapicontroller.php b/controller/folderapicontroller.php index 666f4cfa2..84f1dbdf5 100644 --- a/controller/folderapicontroller.php +++ b/controller/folderapicontroller.php @@ -58,13 +58,14 @@ class FolderApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param string $name - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param string $name + * @return array|mixed|\OCP\AppFramework\Http\JSONResponse + */ public function create($name) { try { $this->folderService->purgeDeleted($this->userId, false); @@ -79,29 +80,33 @@ class FolderApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($folderId) { try { $this->folderService->delete($folderId, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * @param int $folderId - * @param string $name - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * @param int $folderId + * @param string $name + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function update($folderId, $name) { try { $this->folderService->rename($folderId, $name, $this->userId); @@ -113,6 +118,8 @@ class FolderApiController extends ApiController { } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/foldercontroller.php b/controller/foldercontroller.php index 576fee422..9488a7d6c 100644 --- a/controller/foldercontroller.php +++ b/controller/foldercontroller.php @@ -57,26 +57,30 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - * @param bool $open - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @param bool $open + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function open($folderId, $open) { try { $this->folderService->open($folderId, $open, $this->userId); } catch(ServiceNotFoundException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param string $folderName - */ + /** + * @NoAdminRequired + * + * @param string $folderName + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function create($folderName) { try { // we need to purge deleted folders if a folder is created to @@ -95,26 +99,30 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function delete($folderId) { try { $this->folderService->markDeleted($folderId, $this->userId); } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param string $folderName - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param string $folderName + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function rename($folderName, $folderId) { try { $folder = $this->folderService->rename($folderId, $folderName, @@ -129,14 +137,16 @@ class FolderController extends Controller { } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + } - /** - * @NoAdminRequired - * - * @param int $folderId - * @param int $highestItemId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @param int $highestItemId + * @return array + */ public function read($folderId, $highestItemId) { $this->itemService->readFolder($folderId, $highestItemId, $this->userId); @@ -144,17 +154,20 @@ class FolderController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $folderId - */ + /** + * @NoAdminRequired + * + * @param int $folderId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function restore($folderId) { try { $this->folderService->unmarkDeleted($folderId, $this->userId); } catch (ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } diff --git a/controller/itemapicontroller.php b/controller/itemapicontroller.php index 40366a936..ff66de951 100644 --- a/controller/itemapicontroller.php +++ b/controller/itemapicontroller.php @@ -39,18 +39,19 @@ class ItemApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $type - * @param int $id - * @param bool $getRead - * @param int $batchSize - * @param int $offset - * @param int $oldestFirst - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $type + * @param int $id + * @param bool $getRead + * @param int $batchSize + * @param int $offset + * @param bool $oldestFirst + * @return array|mixed + */ public function index($type, $id, $getRead, $batchSize=20, $offset=0, $oldestFirst=false) { return $this->serializer->serialize( @@ -62,15 +63,16 @@ class ItemApiController extends ApiController { } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $type - * @param int $id - * @param int $lastModified - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $type + * @param int $id + * @param int $lastModified + * @return array|mixed + */ public function updated($type, $id, $lastModified=0) { return $this->serializer->serialize( $this->itemService->findAllNew($id, $type, $lastModified, @@ -85,28 +87,32 @@ class ItemApiController extends ApiController { } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $itemId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $itemId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function read($itemId) { return $this->setRead(true, $itemId); } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $itemId - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $itemId + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function unread($itemId) { return $this->setRead(false, $itemId); } @@ -118,30 +124,34 @@ class ItemApiController extends ApiController { } catch(ServiceNotFoundException $ex){ return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $guidHash - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $guidHash + * @return \OCP\AppFramework\Http\JSONResponse + */ public function star($feedId, $guidHash) { return $this->setStarred(true, $feedId, $guidHash); } - /** - * @NoAdminRequired - * @NoCSRFRequired - * @CORS - * - * @param int $feedId - * @param string $guidHash - */ + /** + * @NoAdminRequired + * @NoCSRFRequired + * @CORS + * + * @param int $feedId + * @param string $guidHash + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function unstar($feedId, $guidHash) { return $this->setStarred(false, $feedId, $guidHash); } @@ -178,7 +188,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function readMultiple($items) { - return $this->setMultipleRead(true, $items); + $this->setMultipleRead(true, $items); } @@ -190,7 +200,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function unreadMultiple($items) { - return $this->setMultipleRead(false, $items); + $this->setMultipleRead(false, $items); } @@ -214,7 +224,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function starMultiple($items) { - return $this->setMultipleStarred(true, $items); + $this->setMultipleStarred(true, $items); } @@ -226,7 +236,7 @@ class ItemApiController extends ApiController { * @param int[] item ids */ public function unstarMultiple($items) { - return $this->setMultipleStarred(false, $items); + $this->setMultipleStarred(false, $items); } diff --git a/controller/itemcontroller.php b/controller/itemcontroller.php index 30677d9fc..bbfcaeb56 100644 --- a/controller/itemcontroller.php +++ b/controller/itemcontroller.php @@ -46,14 +46,15 @@ class ItemController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $type - * @param int $id - * @param int $limit - * @param int $offset - */ + /** + * @NoAdminRequired + * + * @param int $type + * @param int $id + * @param int $limit + * @param int $offset + * @return array + */ public function index($type, $id, $limit=50, $offset=0) { $showAll = $this->settings->getUserValue($this->userId, $this->appName, 'showAll') === '1'; @@ -92,13 +93,14 @@ class ItemController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $type - * @param int $id - * @param int $lastModified - */ + /** + * @NoAdminRequired + * + * @param int $type + * @param int $id + * @param int $lastModified + * @return array + */ public function newItems($type, $id, $lastModified=0) { $showAll = $this->settings->getUserValue($this->userId, $this->appName, 'showAll') === '1'; @@ -120,13 +122,14 @@ class ItemController extends Controller { } - /** - * @NoAdminRequired - * - * @param int $feedId - * @param string $guidHash - * @param bool $isStarred - */ + /** + * @NoAdminRequired + * + * @param int $feedId + * @param string $guidHash + * @param bool $isStarred + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function star($feedId, $guidHash, $isStarred){ try { $this->itemService->star($feedId, $guidHash, $isStarred, @@ -134,29 +137,35 @@ class ItemController extends Controller { } catch(ServiceException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $itemId - * @param bool $isRead - */ + /** + * @NoAdminRequired + * + * @param int $itemId + * @param bool $isRead + * @return array|\OCP\AppFramework\Http\JSONResponse + */ public function read($itemId, $isRead=true){ try { $this->itemService->read($itemId, $isRead, $this->userId); } catch(ServiceException $ex) { return $this->error($ex, Http::STATUS_NOT_FOUND); } + + return []; } - /** - * @NoAdminRequired - * - * @param int $highestItemId - */ + /** + * @NoAdminRequired + * + * @param int $highestItemId + * @return array + */ public function readAll($highestItemId){ $this->itemService->readAll($highestItemId, $this->userId); return ['feeds' => $this->feedService->findAll($this->userId)]; diff --git a/controller/jsonhttperror.php b/controller/jsonhttperror.php index 962520b6a..9ac8704c5 100644 --- a/controller/jsonhttperror.php +++ b/controller/jsonhttperror.php @@ -18,7 +18,7 @@ trait JSONHttpError { /** - * @param \Excpetion $exception the message that is returned taken from the + * @param \Exception $exception the message that is returned taken from the * exception * @param int the http error code * @return \OCP\AppFramework\Http\JSONResponse diff --git a/db/feed.php b/db/feed.php index 4f1e0979e..d5c7314c2 100644 --- a/db/feed.php +++ b/db/feed.php @@ -23,7 +23,6 @@ use \OCP\AppFramework\Db\Entity; * @method string getUrlHash() * @method void setUrlHash(string $value) * @method string getUrl() - * @method void setUrl(string $value) * @method string getTitle() * @method void setTitle(string $value) * @method string getFaviconLink() @@ -35,7 +34,6 @@ use \OCP\AppFramework\Db\Entity; * @method integer getUnreadCount() * @method void setUnreadCount(integer $value) * @method string getLink() - * @method void setLink(string $value) * @method boolean getPreventUpdate() * @method void setPreventUpdate(boolean $value) * @method integer getDeletedAt() diff --git a/db/item.php b/db/item.php index 08c01932f..a53c825ff 100644 --- a/db/item.php +++ b/db/item.php @@ -22,17 +22,12 @@ use \OCP\AppFramework\Db\Entity; * @method string getGuidHash() * @method void setGuidHash(string $value) * @method string getGuid() - * @method void setGuid(string $value) * @method string getUrl() - * @method void setUrl(string $value) * @method string getTitle() - * @method void setTitle(string $value) * @method string getAuthor() - * @method void setAuthor(string $value) * @method integer getPubDate() * @method void setPubDate(integer $value) * @method string getBody() - * @method void setBody(string $value) * @method string getEnclosureMime() * @method void setEnclosureMime(string $value) * @method string getEnclosureLink() diff --git a/db/mapperfactory.php b/db/mapperfactory.php index 35d52ad72..339ff30b8 100644 --- a/db/mapperfactory.php +++ b/db/mapperfactory.php @@ -15,7 +15,7 @@ namespace OCA\News\Db; use \OCP\IConfig; use \OCP\IDb; - +use \OCA\News\Db\Postgres\ItemMapper as PostgresItemMapper; class MapperFactory { @@ -31,7 +31,7 @@ class MapperFactory { public function getItemMapper() { switch($this->dbType) { case 'pgsql': - return new \OCA\News\Db\Postgres\ItemMapper($this->db); + return new PostgresItemMapper($this->db); default: return new ItemMapper($this->db); } diff --git a/fetcher/fetcher.php b/fetcher/fetcher.php index 8082f2f6d..5cd63102d 100644 --- a/fetcher/fetcher.php +++ b/fetcher/fetcher.php @@ -46,6 +46,8 @@ class Fetcher { return $fetcher->fetch($url, $getFavicon); } } + + return [null, []]; } diff --git a/service/feedservice.php b/service/feedservice.php index 08b2d1d2f..cc4c8770d 100644 --- a/service/feedservice.php +++ b/service/feedservice.php @@ -181,7 +181,7 @@ class FeedService extends Service { $existingFeed = $this->feedMapper->find($feedId, $userId); if($existingFeed->getPreventUpdate() === true) { - return; + return $existingFeed; } try { @@ -223,6 +223,7 @@ class FeedService extends Service { } catch (DoesNotExistException $ex){ throw new ServiceNotFoundException('Feed does not exist'); } + } @@ -317,6 +318,8 @@ class FeedService extends Service { if($createdFeed) { return $this->feedMapper->findByUrlHash($urlHash, $userId); } + + return null; } diff --git a/service/itemservice.php b/service/itemservice.php index b34dadad8..b2ab80bc5 100644 --- a/service/itemservice.php +++ b/service/itemservice.php @@ -15,7 +15,6 @@ namespace OCA\News\Service; use \OCP\AppFramework\Db\DoesNotExistException; -use \OCA\News\Db\Item; use \OCA\News\Db\ItemMapper; use \OCA\News\Db\StatusFlag; use \OCA\News\Db\FeedType; diff --git a/templates/part.content.php b/templates/part.content.php index 00363f073..55b866f3c 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -48,7 +48,7 @@
+ ng-src="{{ item.enclosureLink|trustUrl }}"> t('Download')) ?>
diff --git a/templates/part.items.php b/templates/part.items.php index e1f761900..8576e851b 100644 --- a/templates/part.items.php +++ b/templates/part.items.php @@ -62,9 +62,9 @@
- t('Download')) - ?> + ?>
-- cgit v1.2.3