Skip to content

Commit

Permalink
fix(ex_app_fetcher): use new OCP ServerVersion (#400)
Browse files Browse the repository at this point in the history
After stable branches split we can update main branch for NC31 (after
#399) with OCP changes
(https://github.com/nextcloud/server/blob/master/lib/public/ServerVersion.php#L75-L81).

---------

Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
  • Loading branch information
andrey18106 authored Sep 26, 2024
1 parent 3d93719 commit 4b73b70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/Fetcher/AppAPIFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OCP\Files\NotPermittedException;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ServerVersion;
use OCP\Support\Subscription\IRegistry;
use Psr\Log\LoggerInterface;

Expand All @@ -35,7 +36,8 @@ public function __construct(
protected ITimeFactory $timeFactory,
protected IConfig $config,
protected LoggerInterface $logger,
protected IRegistry $registry
protected IRegistry $registry,
protected ServerVersion $serverVersion,
) {
$this->appData = $appDataFactory->get('appstore');
}
Expand Down Expand Up @@ -184,7 +186,7 @@ public function setVersion(string $version): void {
*/
protected function getChannel(): string {
if ($this->channel === null) {
$this->channel = \OC_Util::getChannel();
$this->channel = $this->serverVersion->getChannel();
}
return $this->channel;
}
Expand Down
7 changes: 5 additions & 2 deletions lib/Fetcher/ExAppFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\ServerVersion;
use OCP\Support\Subscription\IRegistry;
use Psr\Log\LoggerInterface;

Expand All @@ -26,15 +27,17 @@ public function __construct(
IConfig $config,
CompareVersion $compareVersion,
LoggerInterface $logger,
protected IRegistry $registry
protected IRegistry $registry,
protected ServerVersion $serverVersion,
) {
parent::__construct(
$appDataFactory,
$clientService,
$timeFactory,
$config,
$logger,
$registry
$registry,
$serverVersion
);

$this->compareVersion = $compareVersion;
Expand Down
6 changes: 4 additions & 2 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
<file src="lib/AppInfo/Application.php">
<InvalidArgument>
<code><![CDATA[LoadFilesPluginListener::class]]></code>
Expand Down Expand Up @@ -54,10 +54,11 @@
<UndefinedClass>
<code><![CDATA[$appDataFactory]]></code>
<code><![CDATA[$e]]></code>
<code><![CDATA[$this->serverVersion]]></code>
<code><![CDATA[ConnectException]]></code>
<code><![CDATA[ConnectException]]></code>
<code><![CDATA[Factory]]></code>
<code><![CDATA[\OC_Util]]></code>
<code><![CDATA[protected]]></code>
</UndefinedClass>
</file>
<file src="lib/Fetcher/ExAppFetcher.php">
Expand All @@ -72,6 +73,7 @@
<code><![CDATA[CompareVersion]]></code>
<code><![CDATA[Factory]]></code>
<code><![CDATA[VersionParser]]></code>
<code><![CDATA[protected]]></code>
</UndefinedClass>
</file>
<file src="lib/Listener/FileEventsListener.php">
Expand Down

0 comments on commit 4b73b70

Please sign in to comment.