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

[stable24] fix(updatenotification): Skip update check #39829

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions apps/updatenotification/lib/Notification/BackgroundJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public function __construct(IConfig $config,
}

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.
Expand Down
29 changes: 27 additions & 2 deletions apps/updatenotification/tests/Notification/BackgroundJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,34 @@ public function testRun() {
$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]);
}
Expand Down
Loading