File tree 3 files changed +15
-5
lines changed
lib/private/App/AppStore/Fetcher
tests/lib/App/AppStore/Fetcher
3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 44
44
abstract class Fetcher {
45
45
public const INVALIDATE_AFTER_SECONDS = 3600 ;
46
46
public const RETRY_AFTER_FAILURE_SECONDS = 300 ;
47
+ public const APP_STORE_URL = 'https://apps.nextcloud.com/api/v1 ' ;
47
48
48
49
/** @var IAppData */
49
50
protected $ appData ;
@@ -109,7 +110,7 @@ protected function fetch($ETag, $content) {
109
110
];
110
111
}
111
112
112
- if ($ this ->config ->getSystemValueString ('appstoreurl ' , ' https://apps.nextcloud.com/api/v1 ' ) === ' https://apps.nextcloud.com/api/v1 ' ) {
113
+ if ($ this ->config ->getSystemValueString ('appstoreurl ' , self :: APP_STORE_URL ) === self :: APP_STORE_URL ) {
113
114
// If we have a valid subscription key, send it to the appstore
114
115
$ subscriptionKey = $ this ->config ->getAppValue ('support ' , 'subscription_key ' );
115
116
if ($ this ->registry ->delegateHasValidSubscription () && $ subscriptionKey ) {
@@ -153,8 +154,9 @@ protected function fetch($ETag, $content) {
153
154
public function get ($ allowUnstable = false ) {
154
155
$ appstoreenabled = $ this ->config ->getSystemValueBool ('appstoreenabled ' , true );
155
156
$ internetavailable = $ this ->config ->getSystemValueBool ('has_internet_connection ' , true );
157
+ $ isDefaultAppStore = $ this ->config ->getSystemValueString ('appstoreurl ' , self ::APP_STORE_URL ) === self ::APP_STORE_URL ;
156
158
157
- if (!$ appstoreenabled || !$ internetavailable ) {
159
+ if (!$ appstoreenabled || ( !$ internetavailable && $ isDefaultAppStore ) ) {
158
160
return [];
159
161
}
160
162
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ public function testNoInternet() {
64
64
}
65
65
return $ default ;
66
66
});
67
+ $ this ->config
68
+ ->method ('getSystemValueString ' )
69
+ ->willReturnCallback (function ($ var , $ default ) {
70
+ return $ default ;
71
+ });
67
72
$ this ->appData
68
73
->expects ($ this ->never ())
69
74
->method ('getFolder ' );
Original file line number Diff line number Diff line change @@ -76,10 +76,13 @@ protected function setUp(): void {
76
76
77
77
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion () {
78
78
$ this ->config
79
- ->expects ($ this ->exactly (1 ))
80
79
->method ('getSystemValueString ' )
81
- ->with ($ this ->equalTo ('version ' ), $ this ->anything ())
82
- ->willReturn ('11.0.0.2 ' );
80
+ ->willReturnCallback (function ($ var , $ default ) {
81
+ if ($ var === 'version ' ) {
82
+ return '11.0.0.2 ' ;
83
+ }
84
+ return $ default ;
85
+ });
83
86
$ this ->config ->method ('getSystemValueBool ' )
84
87
->willReturnArgument (1 );
85
88
You can’t perform that action at this time.
0 commit comments