mirror of
https://github.com/nextcloud/server.git
synced 2026-03-19 17:13:56 -04:00
Merge pull request #39806 from nextcloud/fix/update-check-no-internet
fix(updatenotification): Skip update check
This commit is contained in:
commit
6cdad2d4ce
2 changed files with 32 additions and 2 deletions
|
|
@ -57,6 +57,11 @@ class BackgroundJob extends TimedJob {
|
|||
}
|
||||
|
||||
protected function run($argument) {
|
||||
// Do not check for updates if not connected to the internet
|
||||
if (!$this->config->getSystemValueBool('has_internet_connection', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (\OC::$CLI && !$this->config->getSystemValueBool('debug', false)) {
|
||||
try {
|
||||
// Jitter the pinging of the updater server and the appstore a bit.
|
||||
|
|
|
|||
|
|
@ -112,9 +112,34 @@ class BackgroundJobTest extends TestCase {
|
|||
$job->expects($this->once())
|
||||
->method('checkAppUpdates');
|
||||
|
||||
$this->config->expects($this->exactly(2))
|
||||
->method('getSystemValueBool')
|
||||
->withConsecutive(
|
||||
['has_internet_connection', true],
|
||||
['debug', false],
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
true,
|
||||
true,
|
||||
);
|
||||
|
||||
self::invokePrivate($job, 'run', [null]);
|
||||
}
|
||||
|
||||
public function testRunNoInternet() {
|
||||
$job = $this->getJob([
|
||||
'checkCoreUpdate',
|
||||
'checkAppUpdates',
|
||||
]);
|
||||
|
||||
$job->expects($this->never())
|
||||
->method('checkCoreUpdate');
|
||||
$job->expects($this->never())
|
||||
->method('checkAppUpdates');
|
||||
|
||||
$this->config->method('getSystemValueBool')
|
||||
->with('debug', false)
|
||||
->willReturn(true);
|
||||
->with('has_internet_connection', true)
|
||||
->willReturn(false);
|
||||
|
||||
self::invokePrivate($job, 'run', [null]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue