diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b48d2ac79e..14244ab2a9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -28,8 +28,8 @@ jobs: - 5432:5432 # Maps tcp port 5432 on service container to the host strategy: matrix: - php-versions: ['7.2', '7.3', '7.4'] - nextcloud: ['17', '18', '19'] + php-versions: ['7.3', '7.4'] + nextcloud: ['20'] database: ['sqlite', 'pgsql', 'mysql'] experimental: [false] include: diff --git a/.github/workflows/php-tests.yml b/.github/workflows/php-tests.yml index 79a26d4374..004514978d 100644 --- a/.github/workflows/php-tests.yml +++ b/.github/workflows/php-tests.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: php-versions: ['7.4'] - nextcloud: ['19'] + nextcloud: ['20'] database: ['sqlite'] experimental: [false] steps: diff --git a/.travis.yml b/.travis.yml index 3680e17502..74c58fc977 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ php: env: global: - MOZ_HEADLESS=1 - - CORE_BRANCH=stable19 DB=sqlite + - CORE_BRANCH=stable20 DB=sqlite before_install: - make diff --git a/AUTHORS.md b/AUTHORS.md index ea686cb5a0..187c491c49 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -8,8 +8,8 @@ * [Sean Molenaar](mailto:SMillerDev@users.noreply.github.com) * [Jan-Christoph Borchardt](mailto:hey@jancborchardt.net) * [Daniel Schaal](mailto:daniel@schaal.email) -* [Davide Saurino](mailto:davide.saurino@alcacoop.it) * [Sean Molenaar](mailto:sean@seanmolenaar.eu) +* [Davide Saurino](mailto:davide.saurino@alcacoop.it) * [raghunayyar](mailto:me@iraghu.com) * [bastei](mailto:bastei@users.noreply.github.com) * [Bernhard Posselt](mailto:bep@foryouandyourcustomers.com) @@ -81,6 +81,7 @@ * [DriverXX](mailto:DriverXX@users.noreply.github.com) * [DriverXX](mailto:thegio.f@gmail.com) * [DudleyDursley](mailto:35841630+DudleyDursley@users.noreply.github.com) +* [Felix](mailto:22506886+felurx@users.noreply.github.com) * [Felix](mailto:eppfel@users.noreply.github.com) * [Felix Bartels](mailto:felix@host-consultants.de) * [Florian Hülsmann](mailto:fh@cbix.de) diff --git a/appinfo/info.xml b/appinfo/info.xml index dc09c50f7b..a9eb039f5e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -37,7 +37,7 @@ Before you update to a new version, [check the changelog](https://github.com/nex SimpleXML iconv - + @@ -47,6 +47,7 @@ Before you update to a new version, [check the changelog](https://github.com/nex OCA\News\Migration\MigrateStatusFlags + OCA\News\Migration\MigrateConfig diff --git a/composer.json b/composer.json index 26654a69c6..25d0db9082 100644 --- a/composer.json +++ b/composer.json @@ -42,10 +42,10 @@ }, "require": { "php": "^7.2", - "ezyang/htmlpurifier": "4.12.0", + "ezyang/htmlpurifier": "^4.13.0", "pear/net_url2": "2.2.2", "riimu/kit-pathjoin": "1.2.0", - "debril/feed-io": "^4.5", + "debril/feed-io": "^v4.7.8", "arthurhoaro/favicon": "^1.2", "ext-json": "*", "ext-simplexml": "*", @@ -53,11 +53,11 @@ "andreskrey/readability.php": "^2.1" }, "require-dev": { - "phpunit/phpunit": "^7.5", - "squizlabs/php_codesniffer": "^3.4", + "phpunit/phpunit": "9.2.6", + "squizlabs/php_codesniffer": "^3.5.6", "guzzlehttp/guzzle": "^6.3", - "symfony/service-contracts": "1.1.8", - "phpstan/phpstan": "^0.12.38" + "symfony/service-contracts": "2.2.0", + "phpstan/phpstan": "^0.12.43" }, "replace": { "guzzlehttp/guzzle": "*", diff --git a/composer.lock b/composer.lock index 6e091a9ca1..7b31b1ac99 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bc8a010805b2f925d3c58ddc19b728e8", + "content-hash": "d026de8b34993e486d928ef4c509676d", "packages": [ { "name": "andreskrey/readability.php", @@ -111,16 +111,16 @@ }, { "name": "debril/feed-io", - "version": "v4.7.8", + "version": "v4.7.9", "source": { "type": "git", "url": "https://github.com/alexdebril/feed-io.git", - "reference": "2fe979f7e288fff334deaa0ddeaa1f229632ab6e" + "reference": "3fbc023b52d7b97fed7e7ab0dd9a83fb9c556414" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/alexdebril/feed-io/zipball/2fe979f7e288fff334deaa0ddeaa1f229632ab6e", - "reference": "2fe979f7e288fff334deaa0ddeaa1f229632ab6e", + "url": "https://api.github.com/repos/alexdebril/feed-io/zipball/3fbc023b52d7b97fed7e7ab0dd9a83fb9c556414", + "reference": "3fbc023b52d7b97fed7e7ab0dd9a83fb9c556414", "shasum": "" }, "require": { @@ -174,20 +174,20 @@ "type": "github" } ], - "time": "2020-08-17T13:46:18+00:00" + "time": "2020-09-21T08:29:55+00:00" }, { "name": "ezyang/htmlpurifier", - "version": "v4.12.0", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "a617e55bc62a87eec73bd456d146d134ad716f03" + "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/a617e55bc62a87eec73bd456d146d134ad716f03", - "reference": "a617e55bc62a87eec73bd456d146d134ad716f03", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75", + "reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75", "shasum": "" }, "require": { @@ -203,6 +203,9 @@ }, "files": [ "library/HTMLPurifier.composer.php" + ], + "exclude-from-classmap": [ + "/library/HTMLPurifier/Language/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -221,7 +224,7 @@ "keywords": [ "html" ], - "time": "2019-10-28T03:44:26+00:00" + "time": "2020-06-29T00:56:53+00:00" }, { "name": "pear/net_url2", @@ -663,16 +666,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.1", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d870572532cd70bc3fab58f2e23ad423c8404c44", - "reference": "d870572532cd70bc3fab58f2e23ad423c8404c44", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { @@ -711,20 +714,20 @@ } ], "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-08-15T11:14:08+00:00" + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -756,7 +759,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "time": "2020-09-17T18:55:26+00:00" }, { "name": "phpspec/prophecy", @@ -823,16 +826,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.42", + "version": "0.12.44", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7c43b7c2d5ca6554f6231e82e342a710163ac5f4" + "reference": "330b45776ea77f167b150e24787412414a8fa469" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7c43b7c2d5ca6554f6231e82e342a710163ac5f4", - "reference": "7c43b7c2d5ca6554f6231e82e342a710163ac5f4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/330b45776ea77f167b150e24787412414a8fa469", + "reference": "330b45776ea77f167b150e24787412414a8fa469", "shasum": "" }, "require": { @@ -875,44 +878,45 @@ "type": "tidelift" } ], - "time": "2020-09-02T13:14:53+00:00" + "time": "2020-09-24T15:28:47+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca6647ffddd2add025ab3f21644a441d7c146cdc", + "reference": "ca6647ffddd2add025ab3f21644a441d7c146cdc", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "php": "^7.3", + "phpunit/php-file-iterator": "^3.0", + "phpunit/php-text-template": "^2.0", + "phpunit/php-token-stream": "^4.0", + "sebastian/code-unit-reverse-lookup": "^2.0", + "sebastian/environment": "^5.0", + "sebastian/version": "^3.0", + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-pcov": "*", + "ext-xdebug": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "8.0-dev" } }, "autoload": { @@ -938,32 +942,38 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-05-23T08:02:54+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.2", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/25fefc5b19835ca653877fe081644a3f8c1d915e", + "reference": "25fefc5b19835ca653877fe081644a3f8c1d915e", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -988,26 +998,99 @@ "filesystem", "iterator" ], - "time": "2018-09-13T20:33:42+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-11T05:18:21+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/7a85b66acc48cacffdf87dadd3694e7123674298", + "reference": "7a85b66acc48cacffdf87dadd3694e7123674298", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-08-06T07:04:15+00:00" }, { "name": "phpunit/php-text-template", - "version": "1.2.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", + "reference": "6ff9c8ea4d3212b88fcf74e25e516e2c51c99324", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1029,32 +1112,38 @@ "keywords": [ "template" ], - "time": "2015-06-21T13:50:34+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:55:37+00:00" }, { "name": "phpunit/php-timer", - "version": "2.1.2", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", - "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/cc49734779cbb302bf51a44297dab8c4bbf941e7", + "reference": "cc49734779cbb302bf51a44297dab8c4bbf941e7", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1078,33 +1167,39 @@ "keywords": [ "timer" ], - "time": "2019-06-07T04:22:29+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T11:58:13+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.1.1", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", - "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1127,58 +1222,65 @@ "keywords": [ "tokenizer" ], + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "abandoned": true, - "time": "2019-09-17T06:23:10+00:00" + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "9.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1c6a9e4312e209e659f1fce3ce88dd197c2448f6", + "reference": "1c6a9e4312e209e659f1fce3ce88dd197c2448f6", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.5", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.3", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^8.0.2", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-invoker": "^3.0.2", + "phpunit/php-text-template": "^2.0.2", + "phpunit/php-timer": "^5.0.1", + "sebastian/code-unit": "^1.0.5", + "sebastian/comparator": "^4.0.3", + "sebastian/diff": "^4.0.1", + "sebastian/environment": "^5.1.2", + "sebastian/exporter": "^4.0.2", + "sebastian/global-state": "^4.0", + "sebastian/object-enumerator": "^4.0.2", + "sebastian/resource-operations": "^3.0.2", + "sebastian/type": "^2.1.1", + "sebastian/version": "^3.0.1" }, "require-dev": { - "ext-pdo": "*" + "ext-pdo": "*", + "phpspec/prophecy-phpunit": "^2.0" }, "suggest": { "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "ext-xdebug": "*" }, "bin": [ "phpunit" @@ -1186,12 +1288,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "9.2-dev" } }, "autoload": { "classmap": [ "src/" + ], + "files": [ + "src/Framework/Assert/Functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1212,7 +1317,17 @@ "testing", "xunit" ], - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/donate.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-13T17:55:55+00:00" }, { "name": "psr/container", @@ -1263,30 +1378,82 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "sebastian/code-unit", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/c1e2df332c905079980b119c4db103117e5e5c90", + "reference": "c1e2df332c905079980b119c4db103117e5e5c90", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:50:45+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ee51f9bb0c6d8a43337055db3120829fa14da819", + "reference": "ee51f9bb0c6d8a43337055db3120829fa14da819", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1306,34 +1473,40 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:04:00+00:00" }, { "name": "sebastian/comparator", - "version": "3.0.2", + "version": "4.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", + "reference": "dcc580eadfaa4e7f9d2cf9ae1922134ea962e14f", "shasum": "" }, "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" + "php": "^7.3 || ^8.0", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^7.1" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1346,6 +1519,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1357,10 +1534,6 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1370,33 +1543,39 @@ "compare", "equality" ], - "time": "2018-07-12T15:12:46+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:05:46+00:00" }, { "name": "sebastian/diff", - "version": "3.0.2", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", + "reference": "1e90b4cf905a7d06c420b1d2e9d11a4dc8a13113", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" + "phpunit/phpunit": "^9.0", + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1409,13 +1588,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", @@ -1426,27 +1605,33 @@ "unidiff", "unified diff" ], - "time": "2019-02-04T06:01:07+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-30T04:46:02+00:00" }, { "name": "sebastian/environment", - "version": "4.2.3", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", - "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", + "reference": "0a757cab9d5b7ef49a619f1143e6c9c1bc0fe9d2", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-posix": "*" @@ -1454,7 +1639,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -1479,34 +1664,40 @@ "environment", "hhvm" ], - "time": "2019-11-20T08:46:58+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:07:24+00:00" }, { "name": "sebastian/exporter", - "version": "3.1.2", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + "reference": "571d721db4aec847a0e59690b954af33ebf9f023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/571d721db4aec847a0e59690b954af33ebf9f023", + "reference": "571d721db4aec847a0e59690b954af33ebf9f023", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" + "php": "^7.3 || ^8.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1546,27 +1737,36 @@ "export", "exporter" ], - "time": "2019-09-14T09:02:43+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:08:55+00:00" }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bdb1e7c79e592b8c82cb1699be3c8743119b8a72", + "reference": "bdb1e7c79e592b8c82cb1699be3c8743119b8a72", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^9.0" }, "suggest": { "ext-uopz": "*" @@ -1574,7 +1774,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1597,34 +1797,34 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2020-02-07T06:11:37+00:00" }, { "name": "sebastian/object-enumerator", - "version": "3.0.3", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/074fed2d0a6d08e1677dd8ce9d32aecb384917b8", + "reference": "074fed2d0a6d08e1677dd8ce9d32aecb384917b8", "shasum": "" }, "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" + "php": "^7.3 || ^8.0", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1644,32 +1844,38 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:11:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" + "reference": "127a46f6b057441b201253526f81d5406d6c7840" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/127a46f6b057441b201253526f81d5406d6c7840", + "reference": "127a46f6b057441b201253526f81d5406d6c7840", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1689,32 +1895,38 @@ ], "description": "Allows reflection of object attributes, including inherited and non-public ones", "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:12:55+00:00" }, { "name": "sebastian/recursion-context", - "version": "3.0.0", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/062231bf61d2b9448c4fa5a7643b5e1829c11d63", + "reference": "062231bf61d2b9448c4fa5a7643b5e1829c11d63", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1727,14 +1939,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1742,29 +1954,38 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:14:17+00:00" }, { "name": "sebastian/resource-operations", - "version": "2.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + "reference": "0653718a5a629b065e91f774595267f8dc32e213" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0653718a5a629b065e91f774595267f8dc32e213", + "reference": "0653718a5a629b065e91f774595267f8dc32e213", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1784,29 +2005,87 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:16:22+00:00" + }, + { + "name": "sebastian/type", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "reference": "86991e2b33446cd96e648c18bcdb1e95afb2c05a", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-07-05T08:31:53+00:00" }, { "name": "sebastian/version", - "version": "2.0.1", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/626586115d0ed31cb71483be55beb759b5af5a3c", + "reference": "626586115d0ed31cb71483be55beb759b5af5a3c", "shasum": "" }, "require": { - "php": ">=5.6" + "php": "^7.3 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1827,7 +2106,13 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-06-26T12:18:43+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -1958,20 +2243,20 @@ }, { "name": "symfony/service-contracts", - "version": "v1.1.8", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": ">=7.2.5", "psr/container": "^1.0" }, "suggest": { @@ -1980,7 +2265,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.2-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { @@ -2012,7 +2301,21 @@ "interoperability", "standards" ], - "time": "2019-10-14T12:27:06+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-07T11:33:47+00:00" }, { "name": "theseer/tokenizer", diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index b0d2d1e4f7..005a264a46 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -18,28 +18,32 @@ use HTMLPurifier_Config; use Favicon\Favicon; +use OC\Encryption\Update; +use OCA\News\Config\LegacyConfig; use OCA\News\Config\FetcherConfig; +use OCA\News\Db\FolderMapper; +use OCA\News\Service\FeedService; +use OCA\News\Service\FolderService; +use OCA\News\Service\ItemService; use OCA\News\Utility\PsrLogger; -use OCP\BackgroundJob\IJobList; +use OCA\News\Utility\Updater; use OCP\IContainer; -use OCP\INavigationManager; -use OCP\IURLGenerator; use OCP\IConfig; +use OCP\ILogger; use OCP\ITempManager; use OCP\AppFramework\App; use OCP\Files\IRootFolder; use OCP\Files\Node; -use OCA\News\Config\AppConfig; -use OCA\News\Config\Config; use OCA\News\Db\MapperFactory; use OCA\News\Db\ItemMapper; use OCA\News\Fetcher\FeedFetcher; use OCA\News\Fetcher\Fetcher; use OCA\News\Fetcher\YoutubeFetcher; use OCA\News\Scraper\Scraper; +use Psr\Log\LoggerInterface; /** * Class Application @@ -49,6 +53,24 @@ class Application extends App { + /** + * App Name + */ + public const NAME = 'news'; + + /** + * List of default settings + */ + public const DEFAULT_SETTINGS = [ + 'autoPurgeMinimumInterval' => 60, + 'autoPurgeCount' => 200, + 'maxRedirects' => 10, + 'feedFetcherTimeout' => 60, + 'useCronUpdates' => true, + 'exploreUrl' => '', + 'updateInterval' => 3600, + ]; + /** * Application constructor. * @@ -56,7 +78,7 @@ class Application extends App */ public function __construct(array $urlParams = []) { - parent::__construct('news', $urlParams); + parent::__construct(self::NAME, $urlParams); $container = $this->getContainer(); @@ -77,20 +99,6 @@ public function __construct(array $urlParams = []) return $c->query(MapperFactory::class)->build(); }); - /** - * App config parser. - */ - $container->registerService(AppConfig::class, function (IContainer $c): AppConfig { - $config = new AppConfig( - $c->query(INavigationManager::class), - $c->query(IURLGenerator::class), - $c->query(IJobList::class) - ); - - $config->loadConfig($c->query('info')); - return $config; - }); - /** * Core */ @@ -98,38 +106,24 @@ public function __construct(array $urlParams = []) return ['app' => $c->query('AppName')]; }); - $container->registerService('databaseType', function (IContainer $c) { - return $c->query(IConfig::class)->getSystemValue('dbtype'); - }); - - $container->registerService('ConfigView', function (IContainer $c): Node { + $container->registerService('ConfigView', function (IContainer $c): ?Node { /** @var IRootFolder $fs */ $fs = $c->query(IRootFolder::class); $path = 'news/config'; if ($fs->nodeExists($path)) { return $fs->get($path); } else { - return $fs->newFolder($path); + return null; } }); - /** - * Logger base - */ - $container->registerService(PsrLogger::class, function (IContainer $c): PsrLogger { - return new PsrLogger( - $c->query('ServerContainer')->getLogger(), - $c->query('AppName') - ); - }); - - $container->registerService(Config::class, function (IContainer $c): Config { - $config = new Config( + $container->registerService(LegacyConfig::class, function (IContainer $c): LegacyConfig { + $config = new LegacyConfig( $c->query('ConfigView'), - $c->query(PsrLogger::class), + $c->query(LoggerInterface::class), $c->query('LoggerParameters') ); - $config->read($c->query('configFile'), true); + $config->read($c->query('configFile'), false); return $config; }); @@ -175,7 +169,7 @@ public function __construct(array $urlParams = []) */ $container->registerService(FetcherConfig::class, function (IContainer $c): FetcherConfig { $fConfig = new FetcherConfig(); - $fConfig->setConfig($c->query(Config::class)) + $fConfig->setConfig($c->query(IConfig::class)) ->setProxy($c->query(IConfig::class)); return $fConfig; @@ -183,7 +177,7 @@ public function __construct(array $urlParams = []) $container->registerService(FeedIo::class, function (IContainer $c): FeedIo { $config = $c->query(FetcherConfig::class); - return new FeedIo($config->getClient(), $c->query(PsrLogger::class)); + return new FeedIo($config->getClient(), $c->query(LoggerInterface::class)); }); $container->registerService(Favicon::class, function (IContainer $c): Favicon { @@ -209,7 +203,7 @@ public function __construct(array $urlParams = []) */ $container->registerService(Scraper::class, function (IContainer $c): Scraper { return new Scraper( - $c->query(PsrLogger::class) + $c->query(LoggerInterface::class) ); }); } diff --git a/lib/Command/ShowFeed.php b/lib/Command/ShowFeed.php index 572b68e26f..878b711231 100644 --- a/lib/Command/ShowFeed.php +++ b/lib/Command/ShowFeed.php @@ -13,7 +13,15 @@ use FeedIo\FeedIo; use Favicon\Favicon; +use HTMLPurifier; +use OCA\News\Db\FeedMapper; +use OCA\News\Db\ItemMapper; use OCA\News\Fetcher\Fetcher; +use OCA\News\Service\FeedService; +use OCA\News\Utility\Time; +use OCP\IConfig; +use OCP\IL10N; +use OCP\ILogger; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; @@ -38,8 +46,8 @@ class ShowFeed extends Command */ public function __construct(Fetcher $feedFetcher) { - $this->feedFetcher = $feedFetcher; parent::__construct(); + $this->feedFetcher = $feedFetcher; } protected function configure() diff --git a/lib/Config/Config.php b/lib/Config/Config.php deleted file mode 100644 index 97099db48c..0000000000 --- a/lib/Config/Config.php +++ /dev/null @@ -1,207 +0,0 @@ - - * @author Bernhard Posselt - * @copyright 2012 Alessandro Cosentino - * @copyright 2012-2014 Bernhard Posselt - */ - -namespace OCA\News\Config; - -use OCA\News\Utility\PsrLogger; -use OCP\Files\Folder; - -class Config -{ - - private $fileSystem; - private $autoPurgeMinimumInterval; // seconds, used to define how - // long deleted folders and feeds - // should still be kept for an - // undo actions - private $autoPurgeCount; // number of allowed unread articles per feed - private $maxRedirects; // seconds - private $feedFetcherTimeout; // seconds - private $useCronUpdates; // turn off updates run by the cron - private $logger; - private $loggerParams; - private $maxSize; - private $exploreUrl; - private $updateInterval; - - public function __construct( - Folder $fileSystem, - PsrLogger $logger, - $LoggerParameters - ) { - $this->fileSystem = $fileSystem; - $this->autoPurgeMinimumInterval = 60; - $this->autoPurgeCount = 200; - $this->maxRedirects = 10; - $this->maxSize = 100 * 1024 * 1024; // 100Mb - $this->feedFetcherTimeout = 60; - $this->useCronUpdates = true; - $this->logger = $logger; - $this->exploreUrl = ''; - $this->loggerParams = $LoggerParameters; - $this->updateInterval = 3600; - } - - public function getAutoPurgeMinimumInterval() - { - if ($this->autoPurgeMinimumInterval > 60) { - return $this->autoPurgeMinimumInterval; - } else { - return 60; - } - } - - public function getAutoPurgeCount() - { - return $this->autoPurgeCount; - } - - - public function getMaxRedirects() - { - return $this->maxRedirects; - } - - - public function getFeedFetcherTimeout() - { - return $this->feedFetcherTimeout; - } - - - public function getUseCronUpdates() - { - return $this->useCronUpdates; - } - - - public function getMaxSize() - { - return $this->maxSize; - } - - - public function getExploreUrl() - { - return $this->exploreUrl; - } - - public function getUpdateInterval() - { - return $this->updateInterval; - } - - public function setAutoPurgeMinimumInterval($value) - { - $this->autoPurgeMinimumInterval = $value; - } - - - public function setAutoPurgeCount($value) - { - $this->autoPurgeCount = $value; - } - - - public function setMaxRedirects($value) - { - $this->maxRedirects = $value; - } - - - public function setFeedFetcherTimeout($value) - { - $this->feedFetcherTimeout = $value; - } - - - public function setUseCronUpdates($value) - { - $this->useCronUpdates = $value; - } - - public function setMaxSize($value) - { - $this->maxSize = $value; - } - - - public function setExploreUrl($value) - { - $this->exploreUrl = $value; - } - - public function setUpdateInterval($value) - { - $this->updateInterval = $value; - } - - - - public function read($configPath, $createIfNotExists = false) - { - if ($createIfNotExists && !$this->fileSystem->nodeExists($configPath)) { - $this->fileSystem->newFile($configPath); - $this->write($configPath); - } else { - $content = $this->fileSystem->get($configPath)->getContent(); - $configValues = parse_ini_string($content); - - if ($configValues === false || count($configValues) === 0) { - $this->logger->warning( - 'Configuration invalid. Ignoring values.', - $this->loggerParams - ); - } else { - foreach ($configValues as $key => $value) { - if (property_exists($this, $key)) { - $type = gettype($this->$key); - settype($value, $type); - $this->$key = $value; - } else { - $this->logger->warning( - 'Configuration value "' . $key . - '" does not exist. Ignored value.', - $this->loggerParams - ); - } - } - } - } - } - - - public function write($configPath) - { - $ini = - 'autoPurgeMinimumInterval = ' . - $this->autoPurgeMinimumInterval . "\n" . - 'autoPurgeCount = ' . - $this->autoPurgeCount . "\n" . - 'maxRedirects = ' . - $this->maxRedirects . "\n" . - 'maxSize = ' . - $this->maxSize . "\n" . - 'exploreUrl = ' . - $this->exploreUrl . "\n" . - 'feedFetcherTimeout = ' . - $this->feedFetcherTimeout . "\n" . - 'updateInterval = ' . - $this->updateInterval . "\n" . - 'useCronUpdates = ' . - var_export($this->useCronUpdates, true); - ; - - $this->fileSystem->get($configPath)->putContent($ini); - } -} diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php index 866f9a4f17..1e9b7941e0 100644 --- a/lib/Config/FetcherConfig.php +++ b/lib/Config/FetcherConfig.php @@ -15,6 +15,7 @@ use FeedIo\Adapter\ClientInterface; use \GuzzleHttp\Client; +use OCA\News\AppInfo\Application; use OCA\News\Fetcher\Client\FeedIoClient; use OCA\News\Fetcher\Client\LegacyGuzzleClient; use OCP\IConfig; @@ -44,13 +45,6 @@ class FetcherConfig */ protected $redirects; - /** - * Max size of the recieved data. - * @deprecated guzzle can't handle this - * @var string - */ - protected $max_size; - /** * User agent for the client. * @var string @@ -96,8 +90,7 @@ private function getConfig() $config['redirect.max'] = $this->redirects; } - $guzzle = new Client($config); - return $guzzle; + return new Client($config); } /** @@ -121,22 +114,28 @@ private function getOldConfig() $config['request.options']['redirect.max'] = $this->redirects; } - $guzzle = new Client($config); - return $guzzle; + return new Client($config); } /** * Set settings for config. * - * @param Config $config The shared configuration + * @param IConfig $config The shared configuration * * @return self */ - public function setConfig(Config $config) + public function setConfig(IConfig $config) { - $this->client_timeout = $config->getFeedFetcherTimeout(); - $this->redirects = $config->getMaxRedirects(); - $this->max_size = $config->getMaxSize(); + $this->client_timeout = $config->getAppValue( + Application::NAME, + 'feedFetcherTimeout', + Application::DEFAULT_SETTINGS['feedFetcherTimeout'] + ); + $this->redirects = $config->getAppValue( + Application::NAME, + 'maxRedirects', + Application::DEFAULT_SETTINGS['maxRedirects'] + ); return $this; } diff --git a/lib/Config/LegacyConfig.php b/lib/Config/LegacyConfig.php new file mode 100644 index 0000000000..71e19acfa8 --- /dev/null +++ b/lib/Config/LegacyConfig.php @@ -0,0 +1,87 @@ + + * @author Bernhard Posselt + * @copyright 2012 Alessandro Cosentino + * @copyright 2012-2014 Bernhard Posselt + */ + +namespace OCA\News\Config; + +use OCA\News\AppInfo\Application; +use OCA\News\Utility\PsrLogger; +use OCP\Files\Folder; +use OCP\IConfig; +use Psr\Log\LoggerInterface; + +class LegacyConfig +{ + + private $fileSystem; + public $autoPurgeMinimumInterval; // seconds, used to define how + // long deleted folders and feeds + // should still be kept for an + // undo actions + public $autoPurgeCount; // number of allowed unread articles per feed + public $maxRedirects; // seconds + public $feedFetcherTimeout; // seconds + public $useCronUpdates; // turn off updates run by the cron + public $logger; + public $loggerParams; + public $maxSize; + public $exploreUrl; + public $updateInterval; + + public function __construct( + ?Folder $fileSystem, + LoggerInterface $logger, + $LoggerParameters + ) { + $this->fileSystem = $fileSystem; + $this->autoPurgeMinimumInterval = 60; + $this->autoPurgeCount = 200; + $this->maxRedirects = 10; + $this->maxSize = 100 * 1024 * 1024; // 100Mb + $this->feedFetcherTimeout = 60; + $this->useCronUpdates = true; + $this->logger = $logger; + $this->exploreUrl = ''; + $this->loggerParams = $LoggerParameters; + $this->updateInterval = 3600; + } + + public function read($configPath, $createIfNotExists = false) + { + if ($this->fileSystem === null) { + return; + } + $content = $this->fileSystem->get($configPath)->getContent(); + $configValues = parse_ini_string($content); + + if ($configValues === false || count($configValues) === 0) { + $this->logger->warning( + 'Configuration invalid. Ignoring values.', + $this->loggerParams + ); + } else { + foreach ($configValues as $key => $value) { + if (property_exists($this, $key)) { + $type = gettype($this->$key); + settype($value, $type); + $this->$key = $value; + } else { + $this->logger->warning( + 'Configuration value "' . $key . + '" does not exist. Ignored value.', + $this->loggerParams + ); + } + } + } + } +} diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index c5a4765776..addc535917 100644 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -14,11 +14,12 @@ namespace OCA\News\Controller; +use OCA\News\AppInfo\Application; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IConfig; use OCP\IRequest; use OCP\AppFramework\Controller; -use OCA\News\Config\Config; use OCA\News\Service\ItemService; /** @@ -28,8 +29,15 @@ */ class AdminController extends Controller { + + /** + * @var IConfig + */ private $config; - private $configPath; + + /** + * @var ItemService + */ private $itemService; /** @@ -37,20 +45,17 @@ class AdminController extends Controller * * @param string $appName The name of the app * @param IRequest $request The request - * @param Config $config Config for nextcloud + * @param IConfig $config Config for nextcloud * @param ItemService $itemService Service for items - * @param string $configFile Path to the config */ public function __construct( - $appName, + string $appName, IRequest $request, - Config $config, - ItemService $itemService, - $configFile + IConfig $config, + ItemService $itemService ) { parent::__construct($appName, $request); $this->config = $config; - $this->configPath = $configFile; $this->itemService = $itemService; } @@ -64,20 +69,23 @@ public function __construct( */ public function index() { - $data = [ - 'autoPurgeMinimumInterval' => - $this->config->getAutoPurgeMinimumInterval(), - 'autoPurgeCount' => $this->config->getAutoPurgeCount(), - 'maxRedirects' => $this->config->getMaxRedirects(), - 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(), - 'useCronUpdates' => $this->config->getUseCronUpdates(), - 'maxSize' => $this->config->getMaxSize(), - 'exploreUrl' => $this->config->getExploreUrl(), - 'updateInterval' => $this->config->getupdateInterval(), - ]; - return new TemplateResponse($this->appName, 'admin', $data, 'blank'); + return new TemplateResponse($this->appName, 'admin', $this->getData(), 'blank'); } + private function getData() + { + $data = []; + + foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) { + $data[$setting] = $this->config->getAppValue( + Application::NAME, + $setting, + Application::DEFAULT_SETTINGS[$setting] + ); + } + + return $data; + } /** * Update the app config. @@ -86,7 +94,6 @@ public function index() * @param int $autoPurgeCount New value of auto-purge count * @param int $maxRedirects New value for max amount of redirects * @param int $feedFetcherTimeout New timeout value for feed fetcher - * @param int $maxSize New max feed size * @param bool $useCronUpdates Whether or not to use cron updates * @param string $exploreUrl URL to use for the explore feed * @param int $updateInterval Interval in which the feeds will be updated @@ -94,35 +101,22 @@ public function index() * @return array with the updated values */ public function update( - $autoPurgeMinimumInterval, - $autoPurgeCount, - $maxRedirects, - $feedFetcherTimeout, - $maxSize, - $useCronUpdates, - $exploreUrl, - $updateInterval + int $autoPurgeMinimumInterval, + int $autoPurgeCount, + int $maxRedirects, + int $feedFetcherTimeout, + bool $useCronUpdates, + string $exploreUrl, + int $updateInterval ) { - $this->config->setAutoPurgeMinimumInterval($autoPurgeMinimumInterval); - $this->config->setAutoPurgeCount($autoPurgeCount); - $this->config->setMaxRedirects($maxRedirects); - $this->config->setMaxSize($maxSize); - $this->config->setFeedFetcherTimeout($feedFetcherTimeout); - $this->config->setUseCronUpdates($useCronUpdates); - $this->config->setExploreUrl($exploreUrl); - $this->config->setUpdateInterval($updateInterval); - $this->config->write($this->configPath); + $this->config->setAppValue($this->appName, 'autoPurgeMinimumInterval', $autoPurgeMinimumInterval); + $this->config->setAppValue($this->appName, 'autoPurgeCount', $autoPurgeCount); + $this->config->setAppValue($this->appName, 'maxRedirects', $maxRedirects); + $this->config->setAppValue($this->appName, 'feedFetcherTimeout', $feedFetcherTimeout); + $this->config->setAppValue($this->appName, 'useCronUpdates', $useCronUpdates); + $this->config->setAppValue($this->appName, 'exploreUrl', $exploreUrl); + $this->config->setAppValue($this->appName, 'updateInterval', $updateInterval); - return [ - 'autoPurgeMinimumInterval' => - $this->config->getAutoPurgeMinimumInterval(), - 'autoPurgeCount' => $this->config->getAutoPurgeCount(), - 'maxRedirects' => $this->config->getMaxRedirects(), - 'maxSize' => $this->config->getMaxSize(), - 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(), - 'useCronUpdates' => $this->config->getUseCronUpdates(), - 'exploreUrl' => $this->config->getExploreUrl(), - 'updateInterval' => $this->config->getUpdateInterval(), - ]; + return $this->getData(); } } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 6ae01811dd..d88f8181d2 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -13,6 +13,7 @@ namespace OCA\News\Controller; +use OCA\News\AppInfo\Application; use OCP\IRequest; use OCP\IConfig; use OCP\IL10N; @@ -24,7 +25,6 @@ use OCP\AppFramework\Http\ContentSecurityPolicy; use OCA\News\Service\StatusService; -use OCA\News\Config\Config; use OCA\News\Explore\RecommendedSites; use OCA\News\Explore\RecommendedSiteNotFoundException; use OCA\News\Db\FeedType; @@ -33,32 +33,51 @@ class PageController extends Controller { use JSONHttpError; + /** + * @var IConfig + */ private $settings; + + /** + * @var IL10N + */ private $l10n; + + /** + * @var string + */ private $userId; + + /** + * @var IURLGenerator + */ private $urlGenerator; - private $config; + + /** + * @var RecommendedSites + */ private $recommendedSites; + /** + * @var StatusService + */ private $statusService; public function __construct( - $appName, + string $appName, IRequest $request, IConfig $settings, IURLGenerator $urlGenerator, - Config $config, IL10N $l10n, RecommendedSites $recommendedSites, StatusService $statusService, - $UserId + string $UserId ) { parent::__construct($appName, $request); $this->settings = $settings; $this->urlGenerator = $urlGenerator; $this->l10n = $l10n; $this->userId = $UserId; - $this->config = $config; $this->recommendedSites = $recommendedSites; $this->statusService = $statusService; } @@ -109,7 +128,11 @@ public function settings() 'compactExpand' ]; - $exploreUrl = $this->config->getExploreUrl(); + $exploreUrl = $this->settings->getAppValue( + $this->appName, + 'exploreUrl', + Application::DEFAULT_SETTINGS['exploreUrl'] + ); if (trim($exploreUrl) === '') { // default url should not feature the sites.en.json $exploreUrl = $this->urlGenerator->linkToRoute( @@ -142,28 +165,25 @@ public function settings() * @param bool $compact * @param bool $preventReadOnScroll * @param bool $oldestFirst + * @param bool $compactExpand */ public function updateSettings( - $showAll, - $compact, - $preventReadOnScroll, - $oldestFirst, - $compactExpand + bool $showAll, + bool $compact, + bool $preventReadOnScroll, + bool $oldestFirst, + bool $compactExpand ) { $settings = [ - 'showAll', - 'compact', - 'preventReadOnScroll', - 'oldestFirst', - 'compactExpand' + 'showAll' => $showAll, + 'compact' => $compact, + 'preventReadOnScroll' => $preventReadOnScroll, + 'oldestFirst' => $oldestFirst, + 'compactExpand' => $compactExpand, ]; - foreach ($settings as $setting) { - if (${$setting}) { - $value = '1'; - } else { - $value = '0'; - } + foreach ($settings as $setting => $value) { + $value = $value ? '1' : '0'; $this->settings->setUserValue( $this->userId, $this->appName, @@ -178,7 +198,7 @@ public function updateSettings( * * @param string $lang */ - public function explore($lang) + public function explore(string $lang) { $this->settings->setUserValue( $this->userId, diff --git a/lib/Cron/Updater.php b/lib/Cron/Updater.php index a33d7e7c10..3d9336df70 100644 --- a/lib/Cron/Updater.php +++ b/lib/Cron/Updater.php @@ -13,15 +13,16 @@ use OC\BackgroundJob\TimedJob; -use OCA\News\Config\Config; +use OCA\News\AppInfo\Application; use OCA\News\Service\StatusService; use OCA\News\Utility\Updater as UpdaterService; +use OCP\IConfig; class Updater extends TimedJob { /** - * @var Config + * @var IConfig */ private $config; /** @@ -34,7 +35,7 @@ class Updater extends TimedJob private $updaterService; public function __construct( - Config $config, + IConfig $config, StatusService $status, UpdaterService $updaterService ) { @@ -42,14 +43,24 @@ public function __construct( $this->status = $status; $this->updaterService = $updaterService; - parent::setInterval($this->config->getUpdateInterval()); + $interval = $this->config->getAppValue( + Application::NAME, + 'updateInterval', + Application::DEFAULT_SETTINGS['updateInterval'] + ); + + parent::setInterval($interval); } protected function run($argument) { - if ($this->config->getUseCronUpdates() - && $this->status->isProperlyConfigured() - ) { + $uses_cron = $this->config->getAppValue( + Application::NAME, + 'useCronUpdates', + Application::DEFAULT_SETTINGS['useCronUpdates'] + ); + + if ($uses_cron && $this->status->isProperlyConfigured()) { $this->updaterService->beforeUpdate(); $this->updaterService->update(); $this->updaterService->afterUpdate(); diff --git a/lib/Db/ItemMapper.php b/lib/Db/ItemMapper.php index f0442aee97..2e08471db4 100644 --- a/lib/Db/ItemMapper.php +++ b/lib/Db/ItemMapper.php @@ -357,20 +357,27 @@ public function deleteReadOlderThanThreshold($threshold) while ($row = $result->fetch()) { $size = (int)$row['size']; $limit = $size - $threshold; + $feed_id = $row['feed_id']; if ($limit > 0) { - $params = [false, false, $row['feed_id'], $limit]; - - $sql = 'DELETE FROM `*PREFIX*news_items` ' . - 'WHERE `id` IN (' . - 'SELECT `id` FROM `*PREFIX*news_items` ' . + $params = [false, false, $feed_id, $limit]; + $sql = 'SELECT `id` FROM `*PREFIX*news_items` ' . 'WHERE `unread` = ? ' . 'AND `starred` = ? ' . 'AND `feed_id` = ? ' . 'ORDER BY `id` ASC ' . - 'LIMIT ?' . - ')'; - + 'LIMIT 1 ' . + 'OFFSET ? '; + } + $limit_result = $this->execute($sql, $params); + if ($limit_row = $limit_result->fetch()) { + $limit_id = (int)$limit_row['id']; + $params = [false, false, $feed_id, $limit_id]; + $sql = 'DELETE FROM `*PREFIX*news_items` ' . + 'WHERE `unread` = ? ' . + 'AND `starred` = ? ' . + 'AND `feed_id` = ? ' . + 'AND `id` < ? '; $this->execute($sql, $params); } } diff --git a/lib/Fetcher/FeedFetcher.php b/lib/Fetcher/FeedFetcher.php index c06b81b52e..99d3d90ab3 100755 --- a/lib/Fetcher/FeedFetcher.php +++ b/lib/Fetcher/FeedFetcher.php @@ -27,6 +27,7 @@ use OCA\News\Db\Feed; use OCA\News\Utility\Time; use OCA\News\Scraper\Scraper; +use Psr\Log\LoggerInterface; use SimpleXMLElement; class FeedFetcher implements IFeedFetcher @@ -44,7 +45,7 @@ public function __construct( Favicon $favicon, IL10N $l10n, Time $time, - PsrLogger $logger, + LoggerInterface $logger, Scraper $scraper ) { $this->reader = $fetcher; diff --git a/lib/Migration/MigrateConfig.php b/lib/Migration/MigrateConfig.php new file mode 100644 index 0000000000..b25fb8e75d --- /dev/null +++ b/lib/Migration/MigrateConfig.php @@ -0,0 +1,59 @@ + 2020 + */ + +namespace OCA\News\Migration; + +use OCA\News\AppInfo\Application; +use OCA\News\Config\LegacyConfig; +use OCP\IConfig; +use OCP\Migration\IRepairStep; +use OCP\Migration\IOutput; + +class MigrateConfig implements IRepairStep +{ + + /** + * @var LegacyConfig + */ + private $config; + + /** + * @var IConfig + */ + private $iConfig; + + /** + * @param LegacyConfig $config + * @param IConfig $iConfig + */ + public function __construct(LegacyConfig $config, IConfig $iConfig) + { + $this->config = $config; + $this->iConfig = $iConfig; + } + + public function getName() + { + return 'Migrate config to nextcloud managed config'; + } + + public function run(IOutput $output) + { + $version = $this->iConfig->getAppValue('news', 'installed_version', '0.0.0'); + if (version_compare($version, '15.0.0', '>')) { + return; + } + + foreach ($this->config as $key => $value) { + $this->iConfig->setAppValue(Application::NAME, $key, $value); + } + } +} diff --git a/lib/Scraper/Scraper.php b/lib/Scraper/Scraper.php index a99416c63e..65a1387993 100644 --- a/lib/Scraper/Scraper.php +++ b/lib/Scraper/Scraper.php @@ -11,11 +11,10 @@ namespace OCA\News\Scraper; -use OCA\News\Utility\PsrLogger; - use andreskrey\Readability\Readability; use andreskrey\Readability\Configuration; use andreskrey\Readability\ParseException; +use Psr\Log\LoggerInterface; class Scraper implements IScraper { @@ -24,7 +23,7 @@ class Scraper implements IScraper private $readability; private $curl_opts; - public function __construct(PsrLogger $logger) + public function __construct(LoggerInterface $logger) { $this->logger = $logger; $this->config = new Configuration([ diff --git a/lib/Service/FeedService.php b/lib/Service/FeedService.php index aff9626d83..6d57c80277 100644 --- a/lib/Service/FeedService.php +++ b/lib/Service/FeedService.php @@ -16,6 +16,8 @@ use FeedIo\Reader\ReadErrorException; use HTMLPurifier; +use OCA\News\AppInfo\Application; +use OCP\IConfig; use OCP\ILogger; use OCP\IL10N; use OCP\AppFramework\Db\DoesNotExistException; @@ -25,7 +27,6 @@ use OCA\News\Db\FeedMapper; use OCA\News\Db\ItemMapper; use OCA\News\Fetcher\Fetcher; -use OCA\News\Config\Config; use OCA\News\Utility\Time; class FeedService extends Service @@ -48,9 +49,8 @@ public function __construct( ILogger $logger, IL10N $l10n, Time $timeFactory, - Config $config, - HTMLPurifier $purifier, - $LoggerParameters + IConfig $config, + HTMLPurifier $purifier ) { parent::__construct($feedMapper); $this->feedFetcher = $feedFetcher; @@ -58,11 +58,14 @@ public function __construct( $this->logger = $logger; $this->l10n = $l10n; $this->timeFactory = $timeFactory; - $this->autoPurgeMinimumInterval = $config->getAutoPurgeMinimumInterval( + $this->autoPurgeMinimumInterval = $config->getAppValue( + Application::NAME, + 'autoPurgeMinimumInterval', + Application::DEFAULT_SETTINGS['autoPurgeMinimumInterval'] ); $this->purifier = $purifier; $this->feedMapper = $feedMapper; - $this->loggerParams = $LoggerParameters; + $this->loggerParams = ['app' => Application::NAME]; } /** diff --git a/lib/Service/FolderService.php b/lib/Service/FolderService.php index 9ba6b35e29..35eb77f958 100644 --- a/lib/Service/FolderService.php +++ b/lib/Service/FolderService.php @@ -13,10 +13,11 @@ namespace OCA\News\Service; +use OCA\News\AppInfo\Application; +use OCP\IConfig; use OCP\IL10N; use OCA\News\Db\Folder; use OCA\News\Db\FolderMapper; -use OCA\News\Config\Config; use OCA\News\Utility\Time; class FolderService extends Service @@ -31,13 +32,16 @@ public function __construct( FolderMapper $folderMapper, IL10N $l10n, Time $timeFactory, - Config $config + IConfig $config ) { parent::__construct($folderMapper); $this->l10n = $l10n; $this->timeFactory = $timeFactory; - $this->autoPurgeMinimumInterval = - $config->getAutoPurgeMinimumInterval(); + $this->autoPurgeMinimumInterval = $config->getAppValue( + Application::NAME, + 'autoPurgeMinimumInterval', + Application::DEFAULT_SETTINGS['autoPurgeMinimumInterval'] + ); $this->folderMapper = $folderMapper; } @@ -91,6 +95,7 @@ public function create($folderName, $userId, $parentId = 0) $folder->setUserId($userId); $folder->setParentId($parentId); $folder->setOpened(true); + return $this->folderMapper->insert($folder); } @@ -123,6 +128,7 @@ public function rename($folderId, $folderName, $userId) $folder = $this->find($folderId, $userId); $folder->setName($folderName); + return $this->folderMapper->update($folder); } @@ -160,7 +166,7 @@ public function unmarkDeleted($folderId, $userId) /** * Deletes all deleted folders * - * @param string $userId if given it purges only folders of that user + * @param ?string $userId if given it purges only folders 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 * deletion diff --git a/lib/Service/ItemService.php b/lib/Service/ItemService.php index c41217ff6a..5e1660cc0c 100644 --- a/lib/Service/ItemService.php +++ b/lib/Service/ItemService.php @@ -13,13 +13,13 @@ namespace OCA\News\Service; +use OCA\News\AppInfo\Application; use OCA\News\Db\Item; use OCP\IConfig; use OCP\AppFramework\Db\DoesNotExistException; use OCA\News\Db\ItemMapper; use OCA\News\Db\FeedType; -use OCA\News\Config\Config; use OCA\News\Utility\Time; class ItemService extends Service @@ -28,19 +28,16 @@ class ItemService extends Service private $config; private $timeFactory; private $itemMapper; - private $systemConfig; public function __construct( ItemMapper $itemMapper, Time $timeFactory, - Config $config, - IConfig $systemConfig + IConfig $config ) { parent::__construct($itemMapper); - $this->config = $config; $this->timeFactory = $timeFactory; $this->itemMapper = $itemMapper; - $this->systemConfig = $systemConfig; + $this->config = $config; } @@ -255,7 +252,11 @@ public function readFeed($feedId, $highestItemId, $userId) */ public function autoPurgeOld() { - $count = $this->config->getAutoPurgeCount(); + $count = $this->config->getAppValue( + Application::NAME, + 'autoPurgeCount', + Application::DEFAULT_SETTINGS['autoPurgeCount'] + ); if ($count >= 0) { $this->itemMapper->deleteReadOlderThanThreshold($count); } diff --git a/lib/Service/StatusService.php b/lib/Service/StatusService.php index 85be58a5da..f926258b6e 100644 --- a/lib/Service/StatusService.php +++ b/lib/Service/StatusService.php @@ -13,17 +13,14 @@ namespace OCA\News\Service; +use OCA\News\AppInfo\Application; use OCP\IConfig; use OCP\IDBConnection; -use OCA\News\Config\Config; - class StatusService { /** @var IConfig */ private $settings; - /** @var Config */ - private $config; /** @var string */ private $appName; /** @var IDBConnection */ @@ -32,22 +29,21 @@ class StatusService public function __construct( IConfig $settings, IDBConnection $connection, - Config $config, $AppName ) { $this->settings = $settings; - $this->config = $config; $this->appName = $AppName; $this->connection = $connection; } public function isProperlyConfigured() { - $cronMode = $this->settings->getAppValue( - 'core', - 'backgroundjobs_mode' + $cronMode = $this->settings->getSystemValue('backgroundjobs_mode'); + $cronOff = !$this->settings->getAppValue( + Application::NAME, + 'useCronUpdates', + Application::DEFAULT_SETTINGS['useCronUpdates'] ); - $cronOff = !$this->config->getUseCronUpdates(); // check for cron modes which may lead to problems return $cronMode === 'cron' || $cronOff; diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php deleted file mode 100644 index e8c9a0cb2b..0000000000 --- a/lib/Settings/Admin.php +++ /dev/null @@ -1,44 +0,0 @@ -config = $config; - } - - public function getForm() - { - $data = [ - 'autoPurgeMinimumInterval' => - $this->config->getAutoPurgeMinimumInterval(), - 'autoPurgeCount' => $this->config->getAutoPurgeCount(), - 'maxRedirects' => $this->config->getMaxRedirects(), - 'feedFetcherTimeout' => $this->config->getFeedFetcherTimeout(), - 'useCronUpdates' => $this->config->getUseCronUpdates(), - 'maxSize' => $this->config->getMaxSize(), - 'exploreUrl' => $this->config->getExploreUrl(), - 'updateInterval' => $this->config->getUpdateInterval(), - ]; - return new TemplateResponse('news', 'admin', $data, ''); - } - - public function getSection() - { - return 'news'; - } - - public function getPriority() - { - return 40; - } -} diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php new file mode 100644 index 0000000000..1f3d98c089 --- /dev/null +++ b/lib/Settings/AdminSettings.php @@ -0,0 +1,47 @@ +config = $config; + } + + public function getForm() + { + $data = []; + + foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) { + $data[$setting] = $this->config->getAppValue( + Application::NAME, + $setting, + Application::DEFAULT_SETTINGS[$setting] + ); + } + + return new TemplateResponse(Application::NAME, 'admin', $data); + } + + public function getSection() + { + return 'news'; + } + + public function getPriority() + { + return 40; + } +} diff --git a/lib/Utility/PsrLogger.php b/lib/Utility/PsrLogger.php deleted file mode 100644 index 5d9a2529bf..0000000000 --- a/lib/Utility/PsrLogger.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @copyright 2018 Sean Molenaar - */ - -namespace OCA\News\Utility; - -use \OCP\ILogger; - -/** - * This is a wrapper to make OC\Log conform to Psr\Log\LoggerInterface - * - * @package OCA\News\Utility - */ -class PsrLogger implements \Psr\Log\LoggerInterface -{ - private $logger; - private $appName; - - /** - * PsrLogger constructor. - * - * @param ILogger $logger The logger - * @param string $appName Name of the app - */ - public function __construct(ILogger $logger, $appName) - { - $this->logger = $logger; - $this->appName = $appName; - } - - public function logException($exception, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->logException($exception, $context); - } - - public function emergency($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->emergency($message, $context); - } - - public function alert($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->alert($message, $context); - } - - public function critical($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->critical($message, $context); - } - - public function error($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->error($message, $context); - } - - public function warning($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->warning($message, $context); - } - - public function notice($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->notice($message, $context); - } - - public function info($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->info($message, $context); - } - - public function debug($message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->debug($message, $context); - } - - public function log($level, $message, array $context = []) - { - $context['app'] = $this->appName; - $this->logger->log($level, $message, $context); - } -} diff --git a/lib/Utility/Updater.php b/lib/Utility/Updater.php index 02ede9c90d..01e07291b2 100644 --- a/lib/Utility/Updater.php +++ b/lib/Utility/Updater.php @@ -21,9 +21,19 @@ class Updater { - + /** + * @var FolderService + */ private $folderService; + + /** + * @var FeedService + */ private $feedService; + + /** + * @var ItemService + */ private $itemService; public function __construct( diff --git a/templates/admin.php b/templates/admin.php index 56bbd20672..fa714f463d 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -70,23 +70,6 @@

-
-

- -

-

- - t( - 'Maximum feed size in bytes. If the RSS/Atom page is ' . - 'bigger than this value, the update will be aborted.' - )); ?> - -

-

-