diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php
index a8e89260573..2eaedf5d4ff 100644
--- a/apps/settings/tests/Controller/CheckSetupControllerTest.php
+++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php
@@ -66,58 +66,14 @@ class CheckSetupControllerTest extends TestCase {
}
public function testCheck(): void {
- $this->config->expects($this->any())
- ->method('getAppValue')
- ->willReturnMap([
- ['files_external', 'user_certificate_scan', '', '["a", "b"]'],
- ['dav', 'needs_system_address_book_sync', 'no', 'no'],
- ]);
- $this->config->expects($this->any())
- ->method('getSystemValue')
- ->willReturnMap([
- ['connectivity_check_domains', ['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org'], ['www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org']],
- ['memcache.local', null, 'SomeProvider'],
- ['has_internet_connection', true, true],
- ['appstoreenabled', true, false],
- ]);
-
- $this->request->expects($this->never())
- ->method('getHeader');
-
- $this->urlGenerator->method('linkToDocs')
- ->willReturnCallback(function (string $key): string {
- if ($key === 'admin-performance') {
- return 'http://docs.example.org/server/go.php?to=admin-performance';
- }
- if ($key === 'admin-security') {
- return 'https://docs.example.org/server/8.1/admin_manual/configuration_server/hardening.html';
- }
- if ($key === 'admin-reverse-proxy') {
- return 'reverse-proxy-doc-link';
- }
- if ($key === 'admin-code-integrity') {
- return 'http://docs.example.org/server/go.php?to=admin-code-integrity';
- }
- if ($key === 'admin-db-conversion') {
- return 'http://docs.example.org/server/go.php?to=admin-db-conversion';
- }
- return '';
- });
-
- $this->urlGenerator->method('getAbsoluteURL')
- ->willReturnCallback(function (string $url): string {
- if ($url === 'index.php/settings/admin') {
- return 'https://server/index.php/settings/admin';
- }
- if ($url === 'index.php') {
- return 'https://server/index.php';
- }
- return '';
- });
+ $this->setupCheckManager->expects(self::once())
+ ->method('runAll')
+ ->willReturn(['category' => [], 'other' => []]);
$expected = new DataResponse(
[
- 'generic' => [],
+ 'category' => [],
+ 'other' => [],
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
diff --git a/core/js/core.json b/core/js/core.json
index 457656fdd08..d4bc74aeb92 100644
--- a/core/js/core.json
+++ b/core/js/core.json
@@ -3,7 +3,6 @@
"core-common.js"
],
"modules": [
- "../core/js/setupchecks.js",
"../core/js/mimetype.js",
"../core/js/mimetypelist.js"
]
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
deleted file mode 100644
index fc4d4ff6969..00000000000
--- a/core/js/setupchecks.js
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2014-2016 ownCloud Inc.
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-(function() {
- OC.SetupChecks = {
-
- /* Message types */
- MESSAGE_TYPE_INFO:0,
- MESSAGE_TYPE_WARNING:1,
- MESSAGE_TYPE_ERROR:2,
-
- /**
- * Runs setup checks on the server side
- *
- * @return $.Deferred object resolved with an array of error messages
- */
- checkSetup: function() {
- var deferred = $.Deferred();
- var afterCall = function(data, statusText, xhr) {
- var messages = [];
- if (xhr.status === 200 && data) {
- if (Object.keys(data.generic).length > 0) {
- Object.keys(data.generic).forEach(function(key){
- Object.keys(data.generic[key]).forEach(function(title){
- if (data.generic[key][title].severity != 'success') {
- data.generic[key][title].pass = false;
- OC.SetupChecks.addGenericSetupCheck(data.generic[key], title, messages);
- }
- });
- });
- }
- } else {
- messages.push({
- msg: t('core', 'Error occurred while checking server setup'),
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- });
- }
- deferred.resolve(messages);
- };
-
- $.ajax({
- type: 'GET',
- url: OC.generateUrl('settings/ajax/checksetup'),
- allowAuthErrors: true
- }).then(afterCall, afterCall);
- return deferred.promise();
- },
-
- escapeHTML: function(text) {
- return text.toString()
- .split('&').join('&')
- .split('<').join('<')
- .split('>').join('>')
- .split('"').join('"')
- .split('\'').join(''')
- },
-
- /**
- * @param message The message string containing placeholders.
- * @param parameters An object with keys as placeholders and values as their replacements.
- *
- * @return The message with placeholders replaced by values.
- */
- richToParsed: function (message, parameters) {
- for (var [placeholder, parameter] of Object.entries(parameters)) {
- var replacement;
- if (parameter.type === 'user') {
- replacement = '@' + this.escapeHTML(parameter.name);
- } else if (parameter.type === 'file') {
- replacement = this.escapeHTML(parameter.path) || this.escapeHTML(parameter.name);
- } else if (parameter.type === 'highlight') {
- replacement = '
' + this.escapeHTML(parameter.name) + '';
- } else {
- replacement = this.escapeHTML(parameter.name);
- }
- message = message.replace('{' + placeholder + '}', replacement);
- }
-
- return message;
- },
-
- addGenericSetupCheck: function(data, check, messages) {
- var setupCheck = data[check] || { pass: true, description: '', severity: 'info', linkToDoc: null}
-
- var type = OC.SetupChecks.MESSAGE_TYPE_INFO
- if (setupCheck.severity === 'warning') {
- type = OC.SetupChecks.MESSAGE_TYPE_WARNING
- } else if (setupCheck.severity === 'error') {
- type = OC.SetupChecks.MESSAGE_TYPE_ERROR
- }
-
- var message = setupCheck.description;
- if (message) {
- message = this.escapeHTML(message)
- }
- if (setupCheck.descriptionParameters) {
- message = this.richToParsed(message, setupCheck.descriptionParameters);
- }
- if (setupCheck.linkToDoc) {
- message += ' ' + t('core', 'For more details see the {linkstart}documentation ↗{linkend}.')
- .replace('{linkstart}', '
')
- .replace('{linkend}', '');
- }
- if (setupCheck.elements) {
- message += '
'
- setupCheck.elements.forEach(function(element){
- message += '- ';
- message += element
- message += '
';
- });
- message += '
'
- }
-
- if (!setupCheck.pass) {
- messages.push({
- msg: message,
- type: type,
- })
- }
- },
- };
-})();
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
deleted file mode 100644
index 9f75ad501d1..00000000000
--- a/core/js/tests/specs/setupchecksSpec.js
+++ /dev/null
@@ -1,281 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2015 ownCloud Inc.
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-describe('OC.SetupChecks tests', function() {
- var suite = this;
- var protocolStub;
-
- beforeEach( function(){
- protocolStub = sinon.stub(OC, 'getProtocol');
- suite.server = sinon.fakeServer.create();
- });
-
- afterEach( function(){
- suite.server.restore();
- protocolStub.restore();
- });
-
- describe('checkSetup', function() {
- it('should return an error if server has no internet connection', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json'
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "warning",
- description: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([
- {
- msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- },
- ]);
- done();
- });
- });
-
- it('should return an error if server has no internet connection and data directory is not protected', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json'
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "warning",
- description: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([
- {
- msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- },
- ]);
- done();
- });
- });
-
- it('should return an error if server has no internet connection and data directory is not protected and memcache is available', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "warning",
- description: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([
- {
- msg: 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- }
- ]);
- done();
- });
- });
-
- it('should return a warning if the memory limit is below the recommended value', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- php: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- },
- "PHP memory limit": {
- severity: "error",
- description: "The PHP memory limit is below the recommended value of 512MB.",
- linkToDoc: null
- },
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'The PHP memory limit is below the recommended value of 512MB.',
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- }]);
- done();
- });
- });
-
- it('should return an error if the response has no statuscode 200', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 500,
- {
- 'Content-Type': 'application/json'
- },
- JSON.stringify({data: {serverHasInternetConnectionProblems: true}})
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'Error occurred while checking server setup',
- type: OC.SetupChecks.MESSAGE_TYPE_ERROR
- }]);
- done();
- });
- });
-
- it('should return an error if the php version is no longer supported', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- security: {
- "Checking for PHP version": {
- severity: "warning",
- description: "You are currently running PHP 8.0.30. PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible.",
- linkToDoc: "https://secure.php.net/supported-versions.php"
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'You are currently running PHP 8.0.30. PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible. For more details see the
documentation ↗.',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- }]);
- done();
- });
- });
-
- it('should not return an error if the protocol is http and the server generates http links', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([]);
- done();
- });
- });
-
- it('should return an info if there is no default phone region', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- config: {
- "Checking for default phone region": {
- severity: "info",
- description: "Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add \"default_phone_region\" with the respective ISO 3166-1 code of the region to your config file.",
- linkToDoc: "https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements"
- },
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add "default_phone_region" with the respective ISO 3166-1 code of the region to your config file. For more details see the
documentation ↗.',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- }]);
- done();
- });
- });
- });
-});
diff --git a/webpack.modules.js b/webpack.modules.js
index 35e191e34de..c57cda6aadd 100644
--- a/webpack.modules.js
+++ b/webpack.modules.js
@@ -82,6 +82,7 @@ module.exports = {
settings: {
apps: path.join(__dirname, 'apps/settings/src', 'apps.js'),
'legacy-admin': path.join(__dirname, 'apps/settings/src', 'admin.js'),
+ 'vue-settings-admin-overview': path.join(__dirname, 'apps/settings/src', 'main-admin-overview.ts'),
'vue-settings-admin-basic-settings': path.join(__dirname, 'apps/settings/src', 'main-admin-basic-settings.js'),
'vue-settings-admin-ai': path.join(__dirname, 'apps/settings/src', 'main-admin-ai.js'),
'vue-settings-admin-delegation': path.join(__dirname, 'apps/settings/src', 'main-admin-delegation.js'),