diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | appinfo/database.xml | 452 | ||||
-rw-r--r-- | appinfo/info.xml | 9 | ||||
-rw-r--r-- | appinfo/register_command.php | 28 | ||||
-rwxr-xr-x | bin/tools/generate_explore.php | 97 | ||||
-rw-r--r-- | composer.lock | 193 | ||||
-rw-r--r-- | lib/AppInfo/Application.php | 5 | ||||
-rw-r--r-- | lib/Migration/Version140200Date20200824201413.php | 289 |
8 files changed, 410 insertions, 665 deletions
@@ -111,7 +111,7 @@ clean: # Reports PHP codestyle violations .PHONY: phpcs phpcs: - ./vendor/bin/phpcs --standard=PSR2 lib + ./vendor/bin/phpcs --standard=PSR2 --ignore=lib/Migration/Version*.php lib # Reports PHP static violations .PHONY: phpstan diff --git a/appinfo/database.xml b/appinfo/database.xml deleted file mode 100644 index d210d3f45..000000000 --- a/appinfo/database.xml +++ /dev/null @@ -1,452 +0,0 @@ -<database> - <name>*dbname*</name> - <create>true</create> - <overwrite>false</overwrite> - <charset>utf8</charset> - <table> - <name>*dbprefix*news_folders</name> - <declaration> - <field> - <name>id</name> - <type>integer</type> - <notnull>true</notnull> - <autoincrement>true</autoincrement> - <unsigned>true</unsigned> - <primary>true</primary> - <length>8</length> - </field> - <field> - <name>parent_id</name> - <type>integer</type> - <length>8</length> - <notnull>false</notnull> - </field> - <field> - <name>name</name> - <type>text</type> - <length>100</length> - <notnull>true</notnull> - </field> - <field> - <name>user_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <field> - <name>opened</name> - <type>boolean</type> - <default>true</default> - <notnull>true</notnull> - </field> - <field> - <name>deleted_at</name> - <type>integer</type> - <length>8</length> - <default>0</default> - <notnull>false</notnull> - <unsigned>true</unsigned> - </field> - <field> - <name>last_modified</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>false</notnull> - <unsigned>true</unsigned> - </field> - - <index> - <name>news_folders_last_mod_idx</name> - <field> - <name>last_modified</name> - </field> - </index> - - <index> - <name>news_folders_parent_id_idx</name> - <field> - <name>parent_id</name> - </field> - </index> - - <index> - <name>news_folders_user_id_idx</name> - <field> - <name>user_id</name> - </field> - </index> - </declaration> - </table> - - <table> - <name>*dbprefix*news_feeds</name> - <declaration> - <field> - <name>id</name> - <type>integer</type> - <notnull>true</notnull> - <autoincrement>true</autoincrement> - <primary>true</primary> - <length>8</length> - <unsigned>true</unsigned> - </field> - <field> - <name>user_id</name> - <type>text</type> - <default></default> - <notnull>true</notnull> - <length>64</length> - </field> - <field> - <name>last_modified</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>false</notnull> - <unsigned>true</unsigned> - </field> - <field> - <name>url_hash</name> - <type>text</type> - <length>32</length> - <notnull>true</notnull> - </field> - <field> - <name>url</name> - <type>clob</type> - <notnull>true</notnull> - </field> - <field> - <name>location</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>title</name> - <type>clob</type> - <notnull>true</notnull> - </field> - <field> - <name>link</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>favicon_link</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>http_last_modified</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>http_etag</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>added</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>false</notnull> - <unsigned>true</unsigned> - </field> - <field> - <name>articles_per_update</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>true</notnull> - </field> - <field> - <name>update_error_count</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>true</notnull> - </field> - <field> - <name>last_update_error</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - <field> - <name>basic_auth_user</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - <field> - <name>basic_auth_password</name> - <type>clob</type> - <default></default> - <notnull>false</notnull> - </field> - <field> - <name>deleted_at</name> - <type>integer</type> - <default>0</default> - <notnull>false</notnull> - <length>8</length> - <unsigned>true</unsigned> - </field> - <field> - <name>folder_id</name> - <type>integer</type> - <length>8</length> - <notnull>true</notnull> - </field> - <field> - <name>prevent_update</name> - <type>boolean</type> - <default>false</default> - <notnull>true</notnull> - </field> - <field> - <name>pinned</name> - <type>boolean</type> - <default>false</default> - <notnull>true</notnull> - </field> - <field> - <name>full_text_enabled</name> - <type>boolean</type> - <default>false</default> - <notnull>true</notnull> - </field> - <field> - <name>ordering</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - </field> - <field> - <name>update_mode</name> - <type>integer</type> - <default>0</default> - <notnull>true</notnull> - </field> - - <index> - <name>news_feeds_last_mod_idx</name> - <field> - <name>last_modified</name> - </field> - </index> - - <index> - <name>news_feeds_user_id_index</name> - <field> - <name>user_id</name> - </field> - </index> - - <index> - <name>news_feeds_folder_id_index</name> - <field> - <name>folder_id</name> - </field> - </index> - - <index> - <name>news_feeds_url_hash_index</name> - <field> - <name>url_hash</name> - </field> - </index> - </declaration> - </table> - - <table> - <name>*dbprefix*news_items</name> - <declaration> - <field> - <name>id</name> - <type>integer</type> - <length>8</length> - <notnull>true</notnull> - <autoincrement>true</autoincrement> - <primary>true</primary> - <unsigned>true</unsigned> - </field> - <field> - <name>guid_hash</name> - <type>text</type> - <notnull>true</notnull> - <length>32</length> - </field> - <field> - <name>fingerprint</name> - <type>text</type> - <notnull>false</notnull> - <length>32</length> - </field> - <field> - <name>content_hash</name> - <type>text</type> - <notnull>false</notnull> - <length>32</length> - </field> - <field> - <name>rtl</name> - <type>boolean</type> - <notnull>true</notnull> - <default>false</default> - </field> - <field> - <name>search_index</name> - <type>clob</type> - </field> - <field> - <name>guid</name> - <type>clob</type> - <notnull>true</notnull> - </field> - <field> - <name>url</name> - <type>clob</type> - </field> - <field> - <name>title</name> - <type>clob</type> - </field> - <field> - <name>author</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>pub_date</name> - <type>integer</type> - <length>8</length> - <unsigned>true</unsigned> - <notnull>false</notnull> - </field> - <field> - <name>updated_date</name> - <type>integer</type> - <length>8</length> - <unsigned>true</unsigned> - <notnull>false</notnull> - </field> - <field> - <name>body</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>enclosure_mime</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>enclosure_link</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>media_thumbnail</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>media_description</name> - <type>clob</type> - <notnull>false</notnull> - </field> - <field> - <name>feed_id</name> - <type>integer</type> - <length>8</length> - <notnull>true</notnull> - </field> - <field> - <name>status</name> - <type>integer</type> - <length>8</length> - <default>0</default> - <notnull>true</notnull> - </field> - <field> - <name>unread</name> - <type>boolean</type> - <default>false</default> - <notnull>true</notnull> - </field> - <field> - <name>starred</name> - <type>boolean</type> - <default>false</default> - <notnull>true</notnull> - </field> - <field> - <name>last_modified</name> - <type>integer</type> - <default>0</default> - <length>8</length> - <notnull>false</notnull> - <unsigned>true</unsigned> - </field> - - <index> - <name>news_items_last_mod_idx</name> - <field> - <name>last_modified</name> - </field> - </index> - - <index> - <name>news_items_fingerprint_idx</name> - <field> - <name>fingerprint</name> - </field> - </index> - - <index> - <name>news_items_item_guid</name> - <field> - <name>guid_hash</name> - </field> - <field> - <name>feed_id</name> - </field> - </index> - - <index> - <name>news_items_unread_feed_id</name> - <field> - <name>unread</name> - </field> - <field> - <name>feed_id</name> - </field> - </index> - - <index> - <name>news_items_starred_feed_id</name> - <field> - <name>starred</name> - </field> - <field> - <name>feed_id</name> - </field> - </index> - - <index> - <name>news_items_unread_id</name> - <field> - <name>unread</name> - </field> - <field> - <name>id</name> - </field> - </index> - </declaration> - </table> -</database> diff --git a/appinfo/info.xml b/appinfo/info.xml index b41983682..6845dc39c 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -50,6 +50,15 @@ Before you update to a new version, [check the changelog](https://github.com/nex </post-migration> </repair-steps> + <commands> + <command>OCA\News\Command\ExploreGenerator</command> + <command>OCA\News\Command\ShowFeed</command> + <command>OCA\News\Command\Updater\AllFeeds</command> + <command>OCA\News\Command\Updater\UpdateFeed</command> + <command>OCA\News\Command\Updater\BeforeUpdate</command> + <command>OCA\News\Command\Updater\AfterUpdate</command> + </commands> + <settings> <admin>OCA\News\Settings\Admin</admin> <admin-section>OCA\News\Settings\Section</admin-section> diff --git a/appinfo/register_command.php b/appinfo/register_command.php deleted file mode 100644 index 1fc006b76..000000000 --- a/appinfo/register_command.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Nextcloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Bernhard Posselt 2016 - */ - -namespace OCA\News\AppInfo; - -use OCA\News\Command\ShowFeed; -use OCA\News\Command\Updater\UpdateFeed; -use OCA\News\Command\Updater\AllFeeds; -use OCA\News\Command\Updater\BeforeUpdate; -use OCA\News\Command\Updater\AfterUpdate; -use OCA\News\Command\ExploreGenerator; - -$app = new Application(); -$container = $app->getContainer(); -$application->add($container->query(AllFeeds::class)); -$application->add($container->query(UpdateFeed::class)); -$application->add($container->query(BeforeUpdate::class)); -$application->add($container->query(AfterUpdate::class)); -$application->add($container->query(ExploreGenerator::class)); -$application->add($container->query(ShowFeed::class)); diff --git a/bin/tools/generate_explore.php b/bin/tools/generate_explore.php deleted file mode 100755 index 766e82db7..000000000 --- a/bin/tools/generate_explore.php +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env php -<?php -/** - * Nextcloud - News - * - * This file is licensed under the Affero General Public License version 3 or - * later. See the COPYING file. - * - * @author Bernhard Posselt <dev@bernhard-posselt.com> - * @copyright Bernhard Posselt 2016 - */ -require_once __DIR__ . '/../../vendor/autoload.php'; -require_once __DIR__ . '/../../../../lib/base.php'; - -use FeedIo\FeedIo; -use Favicon\Favicon; -use OCA\News\AppInfo\Application; - -$generator = new ExploreGenerator(); -$generator->parse_argv($argv); -print(json_encode($generator->read(), JSON_PRETTY_PRINT)); -print("\n"); - -/** - * This is used for generating a JSON config section for a feed by executing: - * php -f generate_authors.php www.feed.com - * @deprecated Use ./occ news:generate-explore instead. - */ -class ExploreGenerator -{ - /** - * Feed and favicon fetcher. - */ - protected $reader; - protected $favicon; - - /** - * Argument data - */ - protected $url; - protected $votes; - - /** - * Set up class. - */ - public function __construct() - { - $app = new Application(); - $container = $app->getContainer(); - - $this->reader = $container->query(FeedIo::class); - $this->favicon = new Favicon(); - } - - /** - * Parse required arguments. - * @param array $argv Arguments to the script. - * @return void - */ - public function parse_argv($argv = []) - { - if (count($argv) < 2 || count($argv) > 3) - { - print('Usage: php -f generate_explore http://path.com/feed [vote_count]'); - print("\n"); - exit(1); - } - - $this->votes = (count($argv) === 3) ? $argv[2] : 100; - $this->url = $argv[1]; - } - - /** - * Read the provided feed and return the important data. - * @return array Object representation of the feed - */ - public function read() - { - try { - $resource = $this->reader->read($this->url); - $feed = $resource->getFeed(); - $result = [ - 'title' => $feed->getTitle(), - 'favicon' => $this->favicon->get($feed->getLink()), - 'url' => $feed->getLink(), - 'feed' => $this->url, - 'description' => $feed->getDescription(), - 'votes' => $this->votes, - ]; - - return $result; - } catch (\Throwable $ex) { - return [ 'error' => $ex->getMessage() ]; - } - } - -} diff --git a/composer.lock b/composer.lock index 9b63aaee6..d417450dd 100644 --- a/composer.lock +++ b/composer.lock @@ -111,21 +111,21 @@ }, { "name": "debril/feed-io", - "version": "v4.7.1", + "version": "v4.7.8", "source": { "type": "git", "url": "https://github.com/alexdebril/feed-io.git", - "reference": "7f032bf0d91d4a0ea670e160070e66efb01f1d71" + "reference": "2fe979f7e288fff334deaa0ddeaa1f229632ab6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alexdebril/feed-io/zipball/7f032bf0d91d4a0ea670e160070e66efb01f1d71", - "reference": "7f032bf0d91d4a0ea670e160070e66efb01f1d71", + "url": "https://api.github.com/repos/alexdebril/feed-io/zipball/2fe979f7e288fff334deaa0ddeaa1f229632ab6e", + "reference": "2fe979f7e288fff334deaa0ddeaa1f229632ab6e", "shasum": "" }, "require": { "ext-dom": "*", - "guzzlehttp/guzzle": "~6.2", + "guzzlehttp/guzzle": "~6.2|~7.0", "php": ">=7.1", "psr/log": "~1.0", "symfony/console": "~3.4|~4.0|~5.0" @@ -174,7 +174,7 @@ "type": "github" } ], - "time": "2020-05-25T13:12:32+00:00" + "time": "2020-08-17T13:46:18+00:00" }, { "name": "ezyang/htmlpurifier", @@ -388,20 +388,20 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", - "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", + "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^6.0", @@ -440,24 +440,38 @@ "constructor", "instantiate" ], - "time": "2019-10-21T16:45:58+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-05-29T17:27:14+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.5", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", - "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "replace": { "myclabs/deep-copy": "self.version" @@ -488,7 +502,13 @@ "object", "object graph" ], - "time": "2020-01-17T21:11:47+00:00" + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-06-29T13:22:24+00:00" }, { "name": "phar-io/manifest", @@ -594,25 +614,25 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -639,32 +659,31 @@ "reflection", "static analysis" ], - "time": "2020-04-27T09:25:28+00:00" + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.2.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", + "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -692,34 +711,33 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "time": "2020-08-15T11:14:08+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", "shasum": "" }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { @@ -738,37 +756,37 @@ |