aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php4
-rw-r--r--core/Command/Db/ConvertFilecacheBigInt.php4
-rw-r--r--lib/private/Updater/VersionCheck.php7
-rw-r--r--tests/lib/Updater/VersionCheckTest.php88
4 files changed, 78 insertions, 25 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 620920f777b..42dc5e1030b 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -589,7 +589,11 @@ Raw output
$tables = [
'activity' => ['activity_id', 'object_id'],
'activity_mq' => ['mail_id'],
+ 'authtoken' => ['id'],
+ 'bruteforce_attempts' => ['id'],
'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'],
+ 'file_locks' => ['id'],
+ 'jobs' => ['id'],
'mimetypes' => ['id'],
'storages' => ['numeric_id'],
];
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index 93ada896327..da86aa9570c 100644
--- a/core/Command/Db/ConvertFilecacheBigInt.php
+++ b/core/Command/Db/ConvertFilecacheBigInt.php
@@ -56,7 +56,11 @@ class ConvertFilecacheBigInt extends Command {
return [
'activity' => ['activity_id', 'object_id'],
'activity_mq' => ['mail_id'],
+ 'authtoken' => ['id'],
+ 'bruteforce_attempts' => ['id'],
'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'],
+ 'file_locks' => ['id'],
+ 'jobs' => ['id'],
'mimetypes' => ['id'],
'storages' => ['numeric_id'],
];
diff --git a/lib/private/Updater/VersionCheck.php b/lib/private/Updater/VersionCheck.php
index 3cbd7061fe0..446e04dc5ed 100644
--- a/lib/private/Updater/VersionCheck.php
+++ b/lib/private/Updater/VersionCheck.php
@@ -33,7 +33,7 @@ class VersionCheck {
/** @var IClientService */
private $clientService;
-
+
/** @var IConfig */
private $config;
@@ -54,6 +54,11 @@ class VersionCheck {
* @return array|bool
*/
public function check() {
+ // If this server is set to have no internet connection this is all not needed
+ if (!$this->config->getSystemValueBool('has_internet_connection', true)) {
+ return false;
+ }
+
// Look up the cache - it is invalidated all 30 minutes
if (((int)$this->config->getAppValue('core', 'lastupdatedat') + 1800) > time()) {
return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 6da4fd2c3b2..eef16eeb520 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -67,11 +67,16 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(time()));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getAppValue')
->with('core', 'lastupdateResult')
->will($this->returnValue(json_encode($expectedResult)));
@@ -92,30 +97,35 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(0));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
- ->expects($this->at(2))
+ ->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
- ->expects($this->at(4))
+ ->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->will($this->returnValue('installedat'));
$this->config
- ->expects($this->at(5))
+ ->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue('lastupdatedat'));
$this->config
- ->expects($this->at(6))
+ ->expects($this->at(7))
->method('setAppValue')
->with('core', 'lastupdateResult', json_encode($expectedResult));
@@ -140,30 +150,35 @@ class VersionCheckTest extends \Test\TestCase {
public function testCheckWithInvalidXml() {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(0));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
- ->expects($this->at(2))
+ ->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
- ->expects($this->at(4))
+ ->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->will($this->returnValue('installedat'));
$this->config
- ->expects($this->at(5))
+ ->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue('lastupdatedat'));
$this->config
- ->expects($this->at(6))
+ ->expects($this->at(7))
->method('setAppValue')
->with('core', 'lastupdateResult', '[]');
@@ -190,25 +205,30 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(0));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
- ->expects($this->at(2))
+ ->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
- ->expects($this->at(4))
+ ->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->will($this->returnValue('installedat'));
$this->config
- ->expects($this->at(5))
+ ->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue('lastupdatedat'));
@@ -235,30 +255,35 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(0));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
- ->expects($this->at(2))
+ ->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
- ->expects($this->at(4))
+ ->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->will($this->returnValue('installedat'));
$this->config
- ->expects($this->at(5))
+ ->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue('lastupdatedat'));
$this->config
- ->expects($this->at(6))
+ ->expects($this->at(7))
->method('setAppValue')
->with('core', 'lastupdateResult', json_encode($expectedResult));
@@ -285,25 +310,30 @@ class VersionCheckTest extends \Test\TestCase {
$this->config
->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(true);
+ $this->config
+ ->expects($this->at(1))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue(0));
$this->config
- ->expects($this->at(1))
+ ->expects($this->at(2))
->method('getSystemValue')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
- ->expects($this->at(2))
+ ->expects($this->at(3))
->method('setAppValue')
->with('core', 'lastupdatedat', $this->isType('integer'));
$this->config
- ->expects($this->at(4))
+ ->expects($this->at(5))
->method('getAppValue')
->with('core', 'installedat')
->will($this->returnValue('installedat'));
$this->config
- ->expects($this->at(5))
+ ->expects($this->at(6))
->method('getAppValue')
->with('core', 'lastupdatedat')
->will($this->returnValue('lastupdatedat'));
@@ -324,4 +354,14 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
+
+ public function testNoInternet() {
+ $this->config
+ ->expects($this->at(0))
+ ->method('getSystemValueBool')
+ ->with('has_internet_connection', true)
+ ->willReturn(false);
+
+ $this->assertFalse($this->updater->check());
+ }
}