summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2024-01-16 16:55:45 +0100
committerGitHub <noreply@github.com>2024-01-16 16:55:45 +0100
commitb74a59b3313966897400f27c614868b5623220cb (patch)
tree534e9fcd34b84f072010666d168ddec9b1d2da1b /core
parent04a4078e613a8398f1528a237305d908ae6d20a5 (diff)
parented87e4b4ca417caa2d7cdd52b674322997d11149 (diff)
downloadnextcloud-server-b74a59b3313966897400f27c614868b5623220cb.tar.gz
nextcloud-server-b74a59b3313966897400f27c614868b5623220cb.zip
Merge pull request #42795 from nextcloud/backport/setupchecks/stable28
[stable28] Migrate setup checks to new SetupCheck API
Diffstat (limited to 'core')
-rw-r--r--core/Command/Db/ConvertFilecacheBigInt.php8
-rw-r--r--core/js/setupchecks.js63
-rw-r--r--core/js/tests/specs/setupchecksSpec.js203
3 files changed, 5 insertions, 269 deletions
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index d73058767f2..44cd81cd7eb 100644
--- a/core/Command/Db/ConvertFilecacheBigInt.php
+++ b/core/Command/Db/ConvertFilecacheBigInt.php
@@ -54,8 +54,10 @@ class ConvertFilecacheBigInt extends Command {
->setDescription('Convert the ID columns of the filecache to BigInt');
}
- protected function getColumnsByTable() {
- // also update in CheckSetupController::hasBigIntConversionPendingColumns()
+ /**
+ * @return array<string,string[]>
+ */
+ public static function getColumnsByTable(): array {
return [
'activity' => ['activity_id', 'object_id'],
'activity_mq' => ['mail_id'],
@@ -80,7 +82,7 @@ class ConvertFilecacheBigInt extends Command {
$isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform;
$updates = [];
- $tables = $this->getColumnsByTable();
+ $tables = static::getColumnsByTable();
foreach ($tables as $tableName => $columns) {
if (!$schema->hasTable($tableName)) {
continue;
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 925c6924f26..9eacb1b137a 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -240,33 +240,12 @@
type: OC.SetupChecks.MESSAGE_TYPE_ERROR
});
}
- if(data.OpcacheSetupRecommendations.length > 0) {
- var listOfOPcacheRecommendations = "";
- data.OpcacheSetupRecommendations.forEach(function(element){
- listOfOPcacheRecommendations += '<li>' + element + '</li>';
- });
- messages.push({
- msg: t('core', 'The PHP OPcache module is not properly configured. See the {linkstart}documentation ↗{linkend} for more information.')
- .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-php-opcache') + '">')
- .replace('{linkend}', '</a>') + '<ul>' + listOfOPcacheRecommendations + '</ul>',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- });
- }
if(!data.isSettimelimitAvailable) {
messages.push({
msg: t('core', 'The PHP function "set_time_limit" is not available. This could result in scripts being halted mid-execution, breaking your installation. Enabling this function is strongly recommended.'),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
- if (!data.isImagickEnabled) {
- messages.push({
- msg: t(
- 'core',
- 'The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.'
- ),
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- })
- }
if (!data.areWebauthnExtensionsEnabled) {
messages.push({
msg: t(
@@ -276,49 +255,7 @@
type: OC.SetupChecks.MESSAGE_TYPE_INFO
})
}
- if (data.imageMagickLacksSVGSupport) {
- messages.push({
- msg: t('core', 'Module php-imagick in this instance has no SVG support. For better compatibility it is recommended to install it.'),
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- })
- }
- if (data.pendingBigIntConversionColumns.length > 0) {
- var listOfPendingBigIntConversionColumns = "";
- data.pendingBigIntConversionColumns.forEach(function(element){
- listOfPendingBigIntConversionColumns += '<li>' + element + '</li>';
- });
- messages.push({
- msg: t('core', 'Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running "occ db:convert-filecache-bigint" those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read {linkstart}the documentation page about this ↗{linkend}.')
- .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + OC.theme.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-bigint-conversion') + '">')
- .replace('{linkend}', '</a>') + '<ul>' + listOfPendingBigIntConversionColumns + '</ul>',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- })
- }
- if (data.isSqliteUsed) {
- messages.push({
- msg: t('core', 'SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend.') + ' ' + t('core', 'This is particularly recommended when using the desktop client for file synchronisation.') + ' ' +
- t('core', 'To migrate to another database use the command line tool: "occ db:convert-type", or see the {linkstart}documentation ↗{linkend}.')
- .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + data.databaseConversionDocumentation + '">')
- .replace('{linkend}', '</a>'),
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- })
- }
- if(data.appDirsWithDifferentOwner && data.appDirsWithDifferentOwner.length > 0) {
- var appDirsWithDifferentOwner = data.appDirsWithDifferentOwner.reduce(
- function(appDirsWithDifferentOwner, directory) {
- return appDirsWithDifferentOwner + '<li>' + directory + '</li>';
- },
- ''
- );
- messages.push({
- msg: t('core', 'Some app directories are owned by a different user than the web server one. ' +
- 'This may be the case if apps have been installed manually. ' +
- 'Check the permissions of the following app directories:')
- + '<ul>' + appDirsWithDifferentOwner + '</ul>',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- });
- }
if (data.isMysqlUsedWithoutUTF8MB4) {
messages.push({
msg: t('core', 'MySQL is used as database but does not support 4-byte characters. To be able to handle 4-byte characters (like emojis) without issues in filenames or comments for example it is recommended to enable the 4-byte support in MySQL. For further details read {linkstart}the documentation page about this ↗{linkend}.')
diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js
index 9020a895af5..a407fbb145a 100644
--- a/core/js/tests/specs/setupchecksSpec.js
+++ b/core/js/tests/specs/setupchecksSpec.js
@@ -227,16 +227,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -277,16 +273,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -327,16 +319,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -377,16 +365,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: false,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -412,56 +396,6 @@ describe('OC.SetupChecks tests', function() {
});
});
- it('should return a warning if there are app directories with wrong permissions', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- suggestedOverwriteCliURL: '',
- isFairUseOfFreePushService: true,
- isCorrectMemcachedPHPModuleInstalled: true,
- hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
- isSettimelimitAvailable: true,
- cronErrors: [],
- cronInfo: {
- diffInSeconds: 0
- },
- appDirsWithDifferentOwner: [
- '/some/path'
- ],
- isImagickEnabled: true,
- areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
- isMysqlUsedWithoutUTF8MB4: false,
- isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
- reverseProxyGeneratedURL: 'https://server',
- temporaryDirectoryWritable: true,
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'Some app directories are owned by a different user than the web server one. This may be the case if apps have been installed manually. Check the permissions of the following app directories:<ul><li>/some/path</li></ul>',
- type: OC.SetupChecks.MESSAGE_TYPE_WARNING
- }]);
- done();
- });
- });
-
it('should return an error if set_time_limit is unavailable', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -476,16 +410,12 @@ describe('OC.SetupChecks tests', function() {
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: false,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -525,16 +455,12 @@ describe('OC.SetupChecks tests', function() {
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -605,16 +531,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -647,54 +569,6 @@ describe('OC.SetupChecks tests', function() {
});
});
- it('should return an info if server has no proper opcache', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json'
- },
- JSON.stringify({
- suggestedOverwriteCliURL: '',
- isFairUseOfFreePushService: true,
- isCorrectMemcachedPHPModuleInstalled: true,
- hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: ['recommendation1', 'recommendation2'],
- isSettimelimitAvailable: true,
- cronErrors: [],
- cronInfo: {
- diffInSeconds: 0
- },
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
- areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
- isMysqlUsedWithoutUTF8MB4: false,
- isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
- reverseProxyGeneratedURL: 'https://server',
- temporaryDirectoryWritable: true,
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'The PHP OPcache module is not properly configured. See the <a target="_blank" rel="noreferrer noopener" class="external" href="https://docs.example.org/admin-php-opcache">documentation ↗</a> for more information.<ul><li>recommendation1</li><li>recommendation2</li></ul>',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- }]);
- done();
- });
- });
-
it('should return an error if the php version is no longer supported', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -708,16 +582,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: true,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -760,16 +630,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
@@ -809,16 +675,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyDocs: 'https://docs.nextcloud.com/foo/bar.html',
@@ -855,16 +717,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: false,
reverseProxyGeneratedURL: 'https://server',
@@ -891,55 +749,6 @@ describe('OC.SetupChecks tests', function() {
});
- it('should return an error if imagick is not enabled', function(done) {
- var async = OC.SetupChecks.checkSetup();
-
- suite.server.requests[0].respond(
- 200,
- {
- 'Content-Type': 'application/json',
- },
- JSON.stringify({
- suggestedOverwriteCliURL: '',
- isFairUseOfFreePushService: true,
- isCorrectMemcachedPHPModuleInstalled: true,
- hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
- isSettimelimitAvailable: true,
- cronErrors: [],
- cronInfo: {
- diffInSeconds: 0
- },
- appDirsWithDifferentOwner: [],
- isImagickEnabled: false,
- areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
- isMysqlUsedWithoutUTF8MB4: false,
- isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
- reverseProxyGeneratedURL: 'https://server',
- temporaryDirectoryWritable: true,
- generic: {
- network: {
- "Internet connectivity": {
- severity: "success",
- description: null,
- linkToDoc: null
- }
- },
- },
- })
- );
-
- async.done(function( data, s, x ){
- expect(data).toEqual([{
- msg: 'The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.',
- type: OC.SetupChecks.MESSAGE_TYPE_INFO
- }]);
- done();
- });
- });
-
-
it('should return an error if gmp or bcmath are not enabled', function(done) {
var async = OC.SetupChecks.checkSetup();
@@ -953,16 +762,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: false,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -1001,16 +806,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
@@ -1056,16 +857,12 @@ describe('OC.SetupChecks tests', function() {
isFairUseOfFreePushService: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
- OpcacheSetupRecommendations: [],
isSettimelimitAvailable: true,
cronErrors: [],
cronInfo: {
diffInSeconds: 0
},
- appDirsWithDifferentOwner: [],
- isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
- pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',