Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lift min PHP version and NC #2687

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/api-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/api-php-static-code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/api-php-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/frontend-nodejs-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/post-merge-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/updater-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
sleep 2
cd ${{ github.workspace }}/../server
bats apps/news/tests/updater
# Kill php server
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new)
<screenshot small-thumbnail="https://raw.githubusercontent.com/nextcloud/news/master/screenshots/2-small.png">https://raw.githubusercontent.com/nextcloud/news/master/screenshots/2.png</screenshot>
<screenshot small-thumbnail="https://raw.githubusercontent.com/nextcloud/news/master/screenshots/3-small.png">https://raw.githubusercontent.com/nextcloud/news/master/screenshots/3.png</screenshot>
<dependencies>
<php min-version="8.0" min-int-size="64"/>
<php min-version="8.2" min-int-size="64"/>
<database min-version="10">pgsql</database>
<database>sqlite</database>
<database min-version="8.0">mysql</database>
Expand All @@ -55,7 +55,7 @@ Report a [feed issue](https://github.com/nextcloud/news/discussions/new)
<lib>json</lib>

<owncloud max-version="0" min-version="0"/>
<nextcloud min-version="27" max-version="29"/>
<nextcloud min-version="29" max-version="30"/>
</dependencies>

<background-jobs>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 7 additions & 29 deletions lib/Command/Updater/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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());
Expand All @@ -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']
Expand Down
21 changes: 12 additions & 9 deletions lib/Config/FetcherConfig.php
SMillerDev marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]);
Expand All @@ -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 = [];

Expand Down
54 changes: 13 additions & 41 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use OCA\News\AppInfo\Application;
use OCA\News\Explore\Exceptions\RecommendedSiteNotFoundException;
use OCP\IRequest;
use OCP\IAppConfig;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IURLGenerator;
Expand All @@ -32,46 +33,17 @@
{
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 IConfig $config,
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;
}


Expand All @@ -86,7 +58,7 @@
$this->appName,
'index',
[
'nc_major_version' => \OCP\Util::getVersion()[0],

Check failure on line 61 in lib/Controller/PageController.php

View workflow job for this annotation

GitHub Actions / phpstan: Nextcloud pre-release with 8.3

Call to deprecated method getVersion() of class OCP\Util: 31.0.0 Use \OCP\ServerVersion::getVersion
'warnings' => $status['warnings'],
'url_generator' => $this->urlGenerator
]
Expand Down Expand Up @@ -121,7 +93,7 @@
'compactExpand'
];

$exploreUrl = $this->settings->getAppValue(
$exploreUrl = $this->settings->getValueString(
$this->appName,
'exploreUrl',
Application::DEFAULT_SETTINGS['exploreUrl']
Expand All @@ -141,7 +113,7 @@
];

foreach ($settings as $setting) {
$result[$setting] = $this->settings->getUserValue(
$result[$setting] = $this->config->getUserValue(
$this->getUserId(),
$this->appName,
$setting
Expand Down Expand Up @@ -177,7 +149,7 @@

foreach ($settings as $setting => $value) {
$value = $value ? '1' : '0';
$this->settings->setUserValue(
$this->config->setUserValue(
$this->getUserId(),
$this->appName,
$setting,
Expand All @@ -195,13 +167,13 @@
*/
public function explore(string $lang)
{
$this->settings->setUserValue(
$this->config->setUserValue(
$this->getUserId(),
$this->appName,
'lastViewedFeedId',
0
);
$this->settings->setUserValue(
$this->config->setUserValue(
$this->getUserId(),
$this->appName,
'lastViewedFeedType',
Expand Down
Loading
Loading