mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
fix: Fetch custom app store url without internet connection
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
a14ec0ace6
commit
a258abfe59
3 changed files with 15 additions and 5 deletions
|
|
@ -44,6 +44,7 @@ use Psr\Log\LoggerInterface;
|
|||
abstract class Fetcher {
|
||||
public const INVALIDATE_AFTER_SECONDS = 3600;
|
||||
public const RETRY_AFTER_FAILURE_SECONDS = 300;
|
||||
public const APP_STORE_URL = 'https://apps.nextcloud.com/api/v1';
|
||||
|
||||
/** @var IAppData */
|
||||
protected $appData;
|
||||
|
|
@ -109,7 +110,7 @@ abstract class Fetcher {
|
|||
];
|
||||
}
|
||||
|
||||
if ($this->config->getSystemValueString('appstoreurl', 'https://apps.nextcloud.com/api/v1') === 'https://apps.nextcloud.com/api/v1') {
|
||||
if ($this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL) {
|
||||
// If we have a valid subscription key, send it to the appstore
|
||||
$subscriptionKey = $this->config->getAppValue('support', 'subscription_key');
|
||||
if ($this->registry->delegateHasValidSubscription() && $subscriptionKey) {
|
||||
|
|
@ -153,8 +154,9 @@ abstract class Fetcher {
|
|||
public function get($allowUnstable = false) {
|
||||
$appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true);
|
||||
$internetavailable = $this->config->getSystemValueBool('has_internet_connection', true);
|
||||
$isDefaultAppStore = $this->config->getSystemValueString('appstoreurl', self::APP_STORE_URL) === self::APP_STORE_URL;
|
||||
|
||||
if (!$appstoreenabled || !$internetavailable) {
|
||||
if (!$appstoreenabled || (!$internetavailable && $isDefaultAppStore)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ class CategoryFetcherTest extends FetcherBase {
|
|||
}
|
||||
return $default;
|
||||
});
|
||||
$this->config
|
||||
->method('getSystemValueString')
|
||||
->willReturnCallback(function ($var, $default) {
|
||||
return $default;
|
||||
});
|
||||
$this->appData
|
||||
->expects($this->never())
|
||||
->method('getFolder');
|
||||
|
|
|
|||
|
|
@ -76,10 +76,13 @@ abstract class FetcherBase extends TestCase {
|
|||
|
||||
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
|
||||
$this->config
|
||||
->expects($this->exactly(1))
|
||||
->method('getSystemValueString')
|
||||
->with($this->equalTo('version'), $this->anything())
|
||||
->willReturn('11.0.0.2');
|
||||
->willReturnCallback(function ($var, $default) {
|
||||
if ($var === 'version') {
|
||||
return '11.0.0.2';
|
||||
}
|
||||
return $default;
|
||||
});
|
||||
$this->config->method('getSystemValueBool')
|
||||
->willReturnArgument(1);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue