diff --git a/.github/workflows/api-integration-tests.yml b/.github/workflows/api-integration-tests.yml index bc2c0b8b0b..cdde1aa169 100644 --- a/.github/workflows/api-integration-tests.yml +++ b/.github/workflows/api-integration-tests.yml @@ -28,16 +28,16 @@ jobs: - 5432:5432 # Maps tcp port 5432 on service container to the host strategy: matrix: - php-versions: ['8.0', '8.1'] - nextcloud: ['stable27'] + php-versions: ['8.2', '8.3'] + nextcloud: ['stable29'] database: ['sqlite', 'pgsql', 'mysql'] experimental: [false] include: - - php-versions: 8.1 + - php-versions: 8.3 nextcloud: pre-release database: sqlite experimental: true - - php-versions: 8.2 + - php-versions: 8.3 nextcloud: pre-release database: sqlite experimental: true diff --git a/.github/workflows/api-php-static-code-check.yml b/.github/workflows/api-php-static-code-check.yml index 9a37fc40cc..5ed3a0f1c2 100644 --- a/.github/workflows/api-php-static-code-check.yml +++ b/.github/workflows/api-php-static-code-check.yml @@ -7,11 +7,11 @@ jobs: continue-on-error: true strategy: matrix: - php-versions: ['8.0', '8.1', '8.2' ] - nextcloud: [ 'stable27' ] + php-versions: ['8.2', '8.3' ] + nextcloud: [ 'stable29' ] database: [ 'sqlite' ] include: - - php-versions: 8.2 + - php-versions: 8.3 nextcloud: pre-release database: sqlite experimental: true diff --git a/.github/workflows/api-php-tests.yml b/.github/workflows/api-php-tests.yml index 2fb7907700..4742b7b47c 100644 --- a/.github/workflows/api-php-tests.yml +++ b/.github/workflows/api-php-tests.yml @@ -9,14 +9,14 @@ jobs: name: "PHP: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}" strategy: matrix: - php-versions: ['8.1'] - nextcloud: ['stable27'] + php-versions: ['8.3'] + nextcloud: ['stable29'] database: ['sqlite'] experimental: [false] codecoverage: [false] include: - - php-versions: 8.2 - nextcloud: stable27 + - php-versions: 8.3 + nextcloud: stable29 database: sqlite experimental: false codecoverage: true diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index c8f5a988a4..739a028ec5 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -14,8 +14,8 @@ jobs: name: "Release: build, sign and upload the app" strategy: matrix: - php-versions: ['8.1'] - nextcloud: ['stable27'] + php-versions: ['8.3'] + nextcloud: ['stable29'] database: ['sqlite'] steps: - name: Checkout diff --git a/.github/workflows/frontend-nodejs-tests.yml b/.github/workflows/frontend-nodejs-tests.yml index 6b0cbbed97..b772e19a4c 100644 --- a/.github/workflows/frontend-nodejs-tests.yml +++ b/.github/workflows/frontend-nodejs-tests.yml @@ -9,8 +9,8 @@ jobs: name: "Frontend: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }} - DB ${{ matrix.database }}" strategy: matrix: - php-versions: ['8.1'] - nextcloud: ['stable27'] + php-versions: ['8.3'] + nextcloud: ['stable29'] database: ['sqlite'] experimental: [false] steps: diff --git a/.github/workflows/post-merge-tasks.yml b/.github/workflows/post-merge-tasks.yml index 58859acecf..1e27e00800 100644 --- a/.github/workflows/post-merge-tasks.yml +++ b/.github/workflows/post-merge-tasks.yml @@ -10,9 +10,9 @@ jobs: name: "Coverage: Nextcloud ${{ matrix.nextcloud }} PHP ${{ matrix.php-version }}" strategy: matrix: - nextcloud: ['stable27'] + php-version: ["8.3"] + nextcloud: ['stable29'] codecoverage: [true] - php-version: ["8.1"] steps: - name: Checkout uses: actions/checkout@v4 @@ -41,11 +41,11 @@ jobs: - name: Prep PHP tests run: cd ../server/apps/news && make php-test-dependencies - + - name: Unittests run: cd ../server/apps/news && make unit-test env: CODECOVERAGE: ${{ matrix.codecoverage }} - + - name: Upload codecoverage run: cd ../server/apps/news && bash <(curl -s https://codecov.io/bash) -f build/php-unit.clover diff --git a/.github/workflows/updater-test.yml b/.github/workflows/updater-test.yml index 7ae6103fcf..f5cd39b249 100644 --- a/.github/workflows/updater-test.yml +++ b/.github/workflows/updater-test.yml @@ -16,8 +16,8 @@ jobs: name: "Update Test: Nextcloud ${{ matrix.nextcloud }} - PHP ${{ matrix.php-versions }}" strategy: matrix: - php-versions: ['8.1'] - nextcloud: ['stable27'] + php-versions: ['8.3'] + nextcloud: ['stable29'] database: ['sqlite'] experimental: [false] steps: @@ -71,7 +71,7 @@ jobs: sleep 2 cd ${{ github.workspace }}/../server - + bats apps/news/tests/updater # Kill php server diff --git a/CHANGELOG.md b/CHANGELOG.md index fb7f5a3221..cb0d1a9d95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ You can also check [on GitHub](https://github.com/nextcloud/news/releases), the # Unreleased ## [25.x.x] ### Changed - +- Require NC 29 +- Require PHP 8.2 or higher ### Fixed - Allow feed title to be null in DB. #2745 diff --git a/appinfo/info.xml b/appinfo/info.xml index 5e28a90042..1fc3218b97 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -43,7 +43,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new) https://raw.githubusercontent.com/nextcloud/news/master/screenshots/2.png https://raw.githubusercontent.com/nextcloud/news/master/screenshots/3.png - + pgsql sqlite mysql @@ -55,7 +55,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new) json - + diff --git a/composer.json b/composer.json index 81c5dc0b0b..ef249b33a4 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "source": "https://github.com/nextcloud/news/" }, "require": { - "php": "~8.0", + "php": "^8.2", "ezyang/htmlpurifier": "^4.17.0", "pear/net_url2": "^2.2.2", "riimu/kit-pathjoin": "^1.2.0", diff --git a/composer.lock b/composer.lock index fade956563..c69f83a409 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": "a6df4cb89c6655979c37eff4963e65c1", + "content-hash": "5541efcf3c6ca1f468a95dc0a636841b", "packages": [ { "name": "arthurhoaro/favicon", @@ -194,30 +194,30 @@ }, { "name": "fivefilters/readability.php", - "version": "v3.1.7", + "version": "v3.2.0", "source": { "type": "git", "url": "https://github.com/fivefilters/readability.php.git", - "reference": "62b04e8f45a1cfe272608e018e4593ecf22a2201" + "reference": "433a15f6649881c53c11bffd41ebccbfce6efabb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/62b04e8f45a1cfe272608e018e4593ecf22a2201", - "reference": "62b04e8f45a1cfe272608e018e4593ecf22a2201", + "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/433a15f6649881c53c11bffd41ebccbfce6efabb", + "reference": "433a15f6649881c53c11bffd41ebccbfce6efabb", "shasum": "" }, "require": { "ext-dom": "*", "ext-mbstring": "*", "ext-xml": "*", - "league/uri": "~6.7.2", + "league/uri": "^7", "masterminds/html5": "^2.0", - "php": ">=7.4.0", + "php": ">=8.1", "psr/log": "^1.0 || ^2.0 || ^3.0" }, "require-dev": { - "monolog/monolog": "^2.3", - "phpunit/phpunit": "^9" + "monolog/monolog": "^3", + "phpunit/phpunit": "^10" }, "suggest": { "monolog/monolog": "Allow logging debug information" @@ -253,59 +253,50 @@ ], "support": { "issues": "https://github.com/fivefilters/readability.php/issues", - "source": "https://github.com/fivefilters/readability.php/tree/v3.1.7" + "source": "https://github.com/fivefilters/readability.php/tree/v3.2.0" }, - "time": "2024-04-21T00:36:52+00:00" + "time": "2024-04-21T13:31:40+00:00" }, { "name": "league/uri", - "version": "6.7.2", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", - "reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bedb6e55eff0c933668addaa7efa1e1f2c417cc4", + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4", "shasum": "" }, "require": { - "ext-json": "*", - "league/uri-interfaces": "^2.3", - "php": "^7.4 || ^8.0", - "psr/http-message": "^1.0" + "league/uri-interfaces": "^7.3", + "php": "^8.1" }, "conflict": { "league/uri-schemes": "^1.0" }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^v3.3.2", - "nyholm/psr7": "^1.5", - "php-http/psr7-integration-tests": "^1.1", - "phpstan/phpstan": "^1.2.0", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0.0", - "phpstan/phpstan-strict-rules": "^1.1.0", - "phpunit/phpunit": "^9.5.10", - "psr/http-factory": "^1.0" - }, "suggest": { - "ext-fileinfo": "Needed to create Data URI from a filepath", - "ext-intl": "Needed to improve host validation", - "league/uri-components": "Needed to easily manipulate URI objects", - "psr/http-factory": "Needed to use the URI factory" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain", + "league/uri-components": "Needed to easily manipulate URI objects components", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -345,8 +336,8 @@ "support": { "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", - "issues": "https://github.com/thephpleague/uri/issues", - "source": "https://github.com/thephpleague/uri/tree/6.7.2" + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.4.1" }, "funding": [ { @@ -354,46 +345,44 @@ "type": "github" } ], - "time": "2022-09-13T19:50:42+00:00" + "time": "2024-03-23T07:42:40+00:00" }, { "name": "league/uri-interfaces", - "version": "2.3.0", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", - "reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/8d43ef5c841032c87e2de015972c06f3865ef718", + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718", "shasum": "" }, "require": { - "ext-json": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^2.19", - "phpstan/phpstan": "^0.12.90", - "phpstan/phpstan-phpunit": "^0.12.19", - "phpstan/phpstan-strict-rules": "^0.12.9", - "phpunit/phpunit": "^8.5.15 || ^9.5" + "ext-filter": "*", + "php": "^8.1", + "psr/http-factory": "^1", + "psr/http-message": "^1.1 || ^2.0" }, "suggest": { - "ext-intl": "to use the IDNA feature", - "symfony/intl": "to use the IDNA feature via Symfony Polyfill" + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { - "League\\Uri\\": "src/" + "League\\Uri\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -407,17 +396,32 @@ "homepage": "https://nyamsprod.com" } ], - "description": "Common interface for URI representation", - "homepage": "http://github.com/thephpleague/uri-interfaces", + "description": "Common interfaces and classes for URI representation and interaction", + "homepage": "https://uri.thephpleague.com", "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", "rfc3986", "rfc3987", + "rfc6570", "uri", - "url" + "url", + "ws" ], "support": { - "issues": "https://github.com/thephpleague/uri-interfaces/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.1" }, "funding": [ { @@ -425,7 +429,7 @@ "type": "github" } ], - "time": "2021-06-28T04:27:21+00:00" + "time": "2024-03-23T07:42:40+00:00" }, { "name": "masterminds/html5", @@ -562,18 +566,73 @@ }, "time": "2017-08-25T06:16:11+00:00" }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, { "name": "psr/http-message", - "version": "1.1", + "version": "2.0", "source": { "type": "git", "url": "https://github.com/php-fig/http-message.git", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", - "reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { @@ -582,7 +641,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -597,7 +656,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -611,9 +670,9 @@ "response" ], "support": { - "source": "https://github.com/php-fig/http-message/tree/1.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:50:52+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { "name": "riimu/kit-pathjoin", @@ -1147,16 +1206,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -1199,9 +1258,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "phar-io/manifest", @@ -1323,22 +1382,22 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd" + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/46c8219b3fb0deb3fc08301e8f0797d321d17dcd", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", "shasum": "" }, "require": { "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.9.0 || ^2.0" }, "require-dev": { "composer/composer": "^2.0", @@ -1365,22 +1424,22 @@ ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.2" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" }, - "time": "2024-08-26T07:38:00+00:00" + "time": "2024-09-04T20:21:43+00:00" }, { "name": "phpstan/phpstan", - "version": "1.12.0", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -1425,25 +1484,25 @@ "type": "github" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git", - "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26" + "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/fa8cce7720fa782899a0aa97b6a41225d1bb7b26", - "reference": "fa8cce7720fa782899a0aa97b6a41225d1bb7b26", + "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/f94d246cc143ec5a23da868f8f7e1393b50eaa82", + "reference": "f94d246cc143ec5a23da868f8f7e1393b50eaa82", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.12" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", @@ -1470,9 +1529,9 @@ "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "support": { "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", - "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.0" + "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.2.1" }, - "time": "2024-04-20T06:39:48+00:00" + "time": "2024-09-11T15:52:35+00:00" }, { "name": "phpstan/phpstan-doctrine", @@ -1600,21 +1659,21 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.5.2", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "7a50e9662ee9f3942e4aaaf3d603653f60282542" + "reference": "363f921dd8441777d4fc137deb99beb486c77df1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/7a50e9662ee9f3942e4aaaf3d603653f60282542", - "reference": "7a50e9662ee9f3942e4aaaf3d603653f60282542", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/363f921dd8441777d4fc137deb99beb486c77df1", + "reference": "363f921dd8441777d4fc137deb99beb486c77df1", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.10.34" + "phpstan/phpstan": "^1.11" }, "require-dev": { "nikic/php-parser": "^4.13.0", @@ -1643,41 +1702,41 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.5.2" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.6.0" }, - "time": "2023-10-30T14:35:06+00:00" + "time": "2024-04-20T06:37:51+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "9.2.32", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", + "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^3.0.6", + "phpunit/php-text-template": "^2.0.4", + "sebastian/code-unit-reverse-lookup": "^2.0.3", + "sebastian/complexity": "^2.0.3", + "sebastian/environment": "^5.1.5", + "sebastian/lines-of-code": "^1.0.4", + "sebastian/version": "^3.0.2", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^9.6" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -1686,7 +1745,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "9.2.x-dev" } }, "autoload": { @@ -1715,7 +1774,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" }, "funding": [ { @@ -1723,7 +1782,7 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-08-22T04:23:01+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3218,7 +3277,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.0", + "php": "^8.2", "ext-json": "*", "ext-simplexml": "*", "ext-libxml": "*", diff --git a/lib/Command/Updater/Job.php b/lib/Command/Updater/Job.php index b8124d82f5..a4008a0817 100644 --- a/lib/Command/Updater/Job.php +++ b/lib/Command/Updater/Job.php @@ -10,8 +10,7 @@ use DateTime; use DateInterval; -use OCP\Util; -use OCP\IConfig; +use OCP\IAppConfig; use OCA\News\AppInfo\Application; use OCA\News\Service\StatusService; use OCA\News\Service\UpdaterService; @@ -22,27 +21,12 @@ class Job extends Command { - /** - * @var IConfig - */ - private $config; - - /** - * @var StatusService Status service - */ - private $statusService; - - /** - * @var UpdaterService Update service - */ - private $updaterService; - - public function __construct(IConfig $config, StatusService $statusService, UpdaterService $updaterService) - { + public function __construct( + private IAppConfig $config, + private StatusService $statusService, + private UpdaterService $updaterService + ) { parent::__construct(); - $this->config = $config; - $this->statusService = $statusService; - $this->updaterService = $updaterService; } /** @@ -71,12 +55,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $reset = (bool) $input->getOption('reset'); $checkElapsed = (bool) $input->getOption('check-elapsed'); - [$major, $minor, $micro] = Util::getVersion(); - - if ($major < 26) { - $output->writeln("Error: This only works with Nextcloud 26 or newer."); - return 1; - } $output->writeln("Checking update Status"); $date = new DateTime(); $date->setTimestamp($this->statusService->getUpdateTime()); @@ -95,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if ($checkElapsed) { - $updateInterval = $this->config->getAppValue( + $updateInterval = $this->config->getValueString( Application::NAME, 'updateInterval', Application::DEFAULT_SETTINGS['updateInterval'] diff --git a/lib/Config/FetcherConfig.php b/lib/Config/FetcherConfig.php index 710c41e245..048b06f038 100644 --- a/lib/Config/FetcherConfig.php +++ b/lib/Config/FetcherConfig.php @@ -18,6 +18,8 @@ use OCA\News\AppInfo\Application; use OCA\News\Fetcher\Client\FeedIoClient; use OCP\IConfig; +use OCP\IAppConfig; +use Net_URL2; /** * Class FetcherConfig @@ -61,29 +63,30 @@ class FetcherConfig /** * FetcherConfig constructor. * - * @param IConfig $config + * @param IAppConfig $config App configuration + * @param IConfig $systemconfig System configuration */ - public function __construct(IConfig $config) + public function __construct(IAppConfig $config, IConfig $systemconfig) { - $this->client_timeout = $config->getAppValue( + $this->client_timeout = $config->getValueInt( Application::NAME, 'feedFetcherTimeout', Application::DEFAULT_SETTINGS['feedFetcherTimeout'] ); - $this->redirects = $config->getAppValue( + $this->redirects = $config->getValueInt( Application::NAME, 'maxRedirects', Application::DEFAULT_SETTINGS['maxRedirects'] ); - $proxy = $config->getSystemValue('proxy', null); + $proxy = $systemconfig->getSystemValue('proxy', null); if (is_null($proxy)) { return $this; } - $url = new \Net_URL2($proxy); + $url = new Net_URL2($proxy); - $creds = $config->getSystemValue('proxyuserpwd', null); + $creds = $systemconfig->getSystemValue('proxyuserpwd', null); if ($creds !== null) { $auth = explode(':', $creds, 2); $url->setUserinfo($auth[0], $auth[1]); @@ -97,9 +100,9 @@ public function __construct(IConfig $config) /** * Checks for available encoding options * - * @return String list of supported encoding types + * @return string list of supported encoding types */ - public function checkEncoding() + public function checkEncoding(): string { $supportedEncoding = []; diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index abdd3f2f78..3562bc5181 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -16,7 +16,7 @@ use OCA\News\AppInfo\Application; use OCA\News\Explore\Exceptions\RecommendedSiteNotFoundException; use OCP\IRequest; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\AppFramework\Http\TemplateResponse; @@ -32,46 +32,16 @@ class PageController extends Controller { use JSONHttpErrorTrait; - /** - * @var IConfig - */ - private $settings; - - /** - * @var IL10N - */ - private $l10n; - - /** - * @var IURLGenerator - */ - private $urlGenerator; - - /** - * @var RecommendedSites - */ - private $recommendedSites; - - /** - * @var StatusService - */ - private $statusService; - public function __construct( IRequest $request, - IConfig $settings, - IURLGenerator $urlGenerator, - IL10N $l10n, - RecommendedSites $recommendedSites, - StatusService $statusService, - ?IUserSession $userSession + ?IUserSession $userSession, + private IAppConfig $settings, + private IURLGenerator $urlGenerator, + private IL10N $l10n, + private RecommendedSites $recommendedSites, + private StatusService $statusService ) { parent::__construct($request, $userSession); - $this->settings = $settings; - $this->urlGenerator = $urlGenerator; - $this->l10n = $l10n; - $this->recommendedSites = $recommendedSites; - $this->statusService = $statusService; } @@ -121,7 +91,7 @@ public function settings(): array 'compactExpand' ]; - $exploreUrl = $this->settings->getAppValue( + $exploreUrl = $this->settings->getValueString( $this->appName, 'exploreUrl', Application::DEFAULT_SETTINGS['exploreUrl'] diff --git a/lib/Controller/UtilityApiController.php b/lib/Controller/UtilityApiController.php index 943aa7b15e..fe3913aafd 100644 --- a/lib/Controller/UtilityApiController.php +++ b/lib/Controller/UtilityApiController.php @@ -17,7 +17,7 @@ use OCA\News\Service\UpdaterService; use \OCP\IRequest; -use \OCP\IConfig; +use \OCP\IAppConfig; use \OCP\IUserSession; use \OCA\News\Service\StatusService; @@ -25,21 +25,14 @@ class UtilityApiController extends ApiController { - private $updaterService; - private $settings; - private $statusService; - public function __construct( IRequest $request, ?IUserSession $userSession, - UpdaterService $updater, - IConfig $settings, - StatusService $statusService + private UpdaterService $updater, + private IAppConfig $settings, + private StatusService $statusService ) { parent::__construct($request, $userSession); - $this->updaterService = $updater; - $this->settings = $settings; - $this->statusService = $statusService; } @@ -50,7 +43,7 @@ public function __construct( */ public function version(): array { - $version = $this->settings->getAppValue( + $version = $this->settings->getValueString( $this->appName, 'installed_version' ); diff --git a/lib/Cron/UpdaterJob.php b/lib/Cron/UpdaterJob.php index 44bb7bfa30..a0e5af95ef 100644 --- a/lib/Cron/UpdaterJob.php +++ b/lib/Cron/UpdaterJob.php @@ -17,36 +17,20 @@ use OCA\News\AppInfo\Application; use OCA\News\Service\StatusService; use OCA\News\Service\UpdaterService; -use OCP\IConfig; +use OCP\IAppConfig; class UpdaterJob extends TimedJob { - /** - * @var IConfig - */ - private $config; - /** - * @var StatusService - */ - private $statusService; - /** - * @var UpdaterService - */ - private $updaterService; - public function __construct( ITimeFactory $time, - IConfig $config, - StatusService $status, - UpdaterService $updaterService + private IAppConfig $config, + private StatusService $status, + private UpdaterService $updaterService ) { parent::__construct($time); - $this->config = $config; - $this->statusService = $status; - $this->updaterService = $updaterService; - $interval = $this->config->getAppValue( + $interval = $this->config->getValueString( Application::NAME, 'updateInterval', Application::DEFAULT_SETTINGS['updateInterval'] @@ -58,9 +42,9 @@ public function __construct( /** * @return void */ - protected function run($argument) + protected function run($argument): void { - $uses_cron = (bool) $this->config->getAppValue( + $uses_cron = $this->config->getValueBool( Application::NAME, 'useCronUpdates', Application::DEFAULT_SETTINGS['useCronUpdates'] diff --git a/lib/Service/FolderServiceV2.php b/lib/Service/FolderServiceV2.php index e70e4dee9f..020524beec 100644 --- a/lib/Service/FolderServiceV2.php +++ b/lib/Service/FolderServiceV2.php @@ -28,24 +28,14 @@ */ class FolderServiceV2 extends Service { - /** - * @var FeedServiceV2 - */ - private $feedService; - /** - * @var TimeFactory - */ - private $timeFactory; - public function __construct( FolderMapperV2 $mapper, - FeedServiceV2 $feedService, - TimeFactory $timeFactory, - LoggerInterface $logger + LoggerInterface $logger, + private FeedServiceV2 $feedService, + private TimeFactory $timeFactory, + ) { parent::__construct($mapper, $logger); - $this->feedService = $feedService; - $this->timeFactory = $timeFactory; } /** diff --git a/lib/Service/ItemServiceV2.php b/lib/Service/ItemServiceV2.php index ab83ba5c54..4f1401c9db 100644 --- a/lib/Service/ItemServiceV2.php +++ b/lib/Service/ItemServiceV2.php @@ -23,7 +23,7 @@ use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\Entity; use OCP\AppFramework\Db\MultipleObjectsReturnedException; -use OCP\IConfig; +use OCP\IAppConfig; use Psr\Log\LoggerInterface; /** @@ -34,25 +34,19 @@ class ItemServiceV2 extends Service { - /** - * @var IConfig - */ - protected $config; - /** * ItemService constructor. * * @param ItemMapperV2 $mapper - * @param IConfig $config + * @param IAppConfig $config * @param LoggerInterface $logger */ public function __construct( ItemMapperV2 $mapper, - IConfig $config, - LoggerInterface $logger + LoggerInterface $logger, + protected IAppConfig $config ) { parent::__construct($mapper, $logger); - $this->config = $config; } /** @@ -152,17 +146,17 @@ public function read(string $userId, int $id, bool $read): Entity */ public function purgeOverThreshold(int $threshold = null, bool $purgeUnread = null): ?int { - $threshold = (int) ($threshold ?? $this->config->getAppValue( + $threshold = $threshold ?? $this->config->getValueInt( Application::NAME, 'autoPurgeCount', Application::DEFAULT_SETTINGS['autoPurgeCount'] - )); + ); - $purgeUnread = (bool) ($purgeUnread ?? $this->config->getAppValue( + $purgeUnread = $purgeUnread ?? $this->config->getValueBool( Application::NAME, 'purgeUnread', Application::DEFAULT_SETTINGS['purgeUnread'] - )); + ); if ($threshold <= 0) { return null; diff --git a/lib/Service/StatusService.php b/lib/Service/StatusService.php index 09cea9e4a2..3733513864 100644 --- a/lib/Service/StatusService.php +++ b/lib/Service/StatusService.php @@ -14,32 +14,24 @@ namespace OCA\News\Service; use OCA\News\AppInfo\Application; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\IDBConnection; use OCP\BackgroundJob\IJobList; -use OCP\Util; use OCA\News\Cron\UpdaterJob; class StatusService { - /** @var IConfig */ - private $settings; - /** @var string */ - private $appName; - /** @var IDBConnection */ - private $connection; - /** @var IJobList */ - private $jobList; + /** + * Name of the app + */ + private string $appName; public function __construct( - IConfig $settings, - IDBConnection $connection, - IJobList $jobList + private IAppConfig $settings, + private IDBConnection $connection, + private IJobList $jobList ) { - $this->settings = $settings; - $this->connection = $connection; $this->appName = Application::NAME; - $this->jobList = $jobList; } /** @@ -50,13 +42,13 @@ public function __construct( public function isCronProperlyConfigured(): bool { //Is NC cron enabled? - $cronMode = $this->settings->getAppValue('core', 'backgroundjobs_mode'); + $cronMode = $this->settings->getValueString('core', 'backgroundjobs_mode'); //Expect nextcloud cron - $cronOff = !boolval($this->settings->getAppValue( + $cronOff = !$this->settings->getValueBool( Application::NAME, 'useCronUpdates', Application::DEFAULT_SETTINGS['useCronUpdates'] - )); + ); // check for cron modes which may lead to problems return $cronMode === 'cron' || $cronOff; @@ -70,7 +62,7 @@ public function isCronProperlyConfigured(): bool */ public function getStatus(): array { - $version = $this->settings->getAppValue( + $version = $this->settings->getValueString( $this->appName, 'installed_version' ); @@ -94,7 +86,7 @@ public function getUpdateTime(): int $myJobList = $this->jobList->getJobsIterator(UpdaterJob::class, 1, 0); $time = $myJobList->current()->getLastRun(); - + return $time; } } diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 5e4e83920a..1fc1570d81 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -5,45 +5,34 @@ use OCA\News\AppInfo\Application; use OCA\News\Service\StatusService; use OCP\AppFramework\Http\TemplateResponse; -use OCP\IConfig; +use OCP\IAppConfig; use OCP\Settings\ISettings; use OCP\AppFramework\Services\IInitialState; class AdminSettings implements ISettings { - /** - * @var IConfig - */ - private $config; - /** @var IInitialState */ - private $initialState; - /** @var StatusService */ - private $service; - - public function __construct(IConfig $config, IInitialState $initialState, StatusService $service) - { - $this->config = $config; - $this->initialState = $initialState; - $this->service = $service; - } + public function __construct( + private IAppConfig $config, + private IInitialState $initialState, + private StatusService $service) { } public function getForm() { foreach (array_keys(Application::DEFAULT_SETTINGS) as $setting) { - $this->initialState->provideInitialState($setting, $this->config->getAppValue( + $this->initialState->provideInitialState($setting, $this->config->getValueString( Application::NAME, $setting, - (string)Application::DEFAULT_SETTINGS[$setting] + (string) Application::DEFAULT_SETTINGS[$setting] )); } - + if ($this->service->isCronProperlyConfigured()) { $lastUpdate = $this->service->getUpdateTime(); } else { $lastUpdate = 0; } - + $this->initialState->provideInitialState("lastCron", $lastUpdate); return new TemplateResponse(Application::NAME, 'admin', []);