diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index b9f176f97c5d9..c065747e74bd3 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -591,6 +591,18 @@ protected function wasEmailTestSuccessful(): bool { return true; } + protected function isPreviewMaxSetCorrectly(): bool { + if ($this->config->getSystemValueInt('preview_max_x', 4096) < 2048) { + return false; + } + + if ($this->config->getSystemValueInt('preview_max_y', 4096) < 2048) { + return false; + } + + return true; + } + protected function hasValidTransactionIsolationLevel(): bool { try { if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { @@ -846,6 +858,7 @@ public function check() { 'isReadOnlyConfig' => $this->isReadOnlyConfig(), 'hasValidTransactionIsolationLevel' => $this->hasValidTransactionIsolationLevel(), 'wasEmailTestSuccessful' => $this->wasEmailTestSuccessful(), + 'isPreviewMaxSetCorrectly' => $this->isPreviewMaxSetCorrectly(), 'hasFileinfoInstalled' => $this->hasFileinfoInstalled(), 'hasWorkingFileLocking' => $this->hasWorkingFileLocking(), 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index b7dd96ae65302..922fdfaf3b6d1 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -183,6 +183,7 @@ protected function setUp(): void { ->setMethods([ 'isReadOnlyConfig', 'wasEmailTestSuccessful', + 'isPreviewMaxSetCorrectly', 'hasValidTransactionIsolationLevel', 'hasFileinfoInstalled', 'hasWorkingFileLocking', @@ -513,6 +514,10 @@ public function testCheck() { ->expects($this->once()) ->method('wasEmailTestSuccessful') ->willReturn(false); + $this->checkSetupController + ->expects($this->once()) + ->method('isPreviewMaxSetCorrectly') + ->willReturn(true); $this->checkSetupController ->expects($this->once()) ->method('hasValidTransactionIsolationLevel') @@ -619,6 +624,7 @@ public function testCheck() { 'isGetenvServerWorking' => true, 'isReadOnlyConfig' => false, 'wasEmailTestSuccessful' => false, + 'isPreviewMaxSetCorrectly' => true, 'hasValidTransactionIsolationLevel' => true, 'hasFileinfoInstalled' => true, 'hasWorkingFileLocking' => true, diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 6fd6fce5dcfd2..b3a28bf537487 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -203,6 +203,12 @@ type: OC.SetupChecks.MESSAGE_TYPE_INFO }); } + if (!data.isPreviewMaxSetCorrectly) { + messages.push({ + msg: t('core', 'Your preview max settings are not set correctly. Please set preview_max_x and preview_max_y in your config.php file to 2048 or higher in order to fix this.',), + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }); + } if (!data.hasValidTransactionIsolationLevel) { messages.push({ msg: t('core', 'Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.'), diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 8fd4681d4d100..fe888d56712f6 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -227,6 +227,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -287,6 +288,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -348,6 +350,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -406,6 +409,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -463,6 +467,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -520,6 +525,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: false, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -564,6 +570,64 @@ describe('OC.SetupChecks tests', function() { }); }); + it('should return an info when preview max is not configured correctly', function(done) { + var async = OC.SetupChecks.checkSetup(); + + suite.server.requests[0].respond( + 200, + { + 'Content-Type': 'application/json' + }, + JSON.stringify({ + hasFileinfoInstalled: true, + isGetenvServerWorking: true, + isReadOnlyConfig: false, + wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: false, + hasWorkingFileLocking: true, + hasValidTransactionIsolationLevel: true, + suggestedOverwriteCliURL: '', + isRandomnessSecure: true, + securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, + serverHasInternetConnectionProblems: false, + isMemcacheConfigured: true, + forwardedForHeadersWorking: true, + isCorrectMemcachedPHPModuleInstalled: true, + hasPassedCodeIntegrityCheck: true, + OpcacheSetupRecommendations: [], + isSettimelimitAvailable: true, + hasFreeTypeSupport: true, + missingIndexes: [], + missingPrimaryKeys: [], + missingColumns: [], + cronErrors: [], + cronInfo: { + diffInSeconds: 0 + }, + isMemoryLimitSufficient: true, + appDirsWithDifferentOwner: [], + isImagickEnabled: true, + areWebauthnExtensionsEnabled: true, + recommendedPHPModules: [], + pendingBigIntConversionColumns: [], + isMysqlUsedWithoutUTF8MB4: false, + isDefaultPhoneRegionSet: true, + isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true, + reverseProxyGeneratedURL: 'https://server', + temporaryDirectoryWritable: true, + }) + ); + + async.done(function( data, s, x ){ + expect(data).toEqual([{ + msg: 'Your preview max settings are not set correctly. Please set preview_max_x and preview_max_y in your config.php file to 2048 or higher in order to fix this.', + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }]); + done(); + }); + }); + it('should return a warning if there are app directories with wrong permissions', function(done) { var async = OC.SetupChecks.checkSetup(); @@ -577,6 +641,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -636,6 +701,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -693,6 +759,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -750,6 +817,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -827,6 +895,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -885,6 +954,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -942,6 +1012,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -999,6 +1070,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1060,6 +1132,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1118,6 +1191,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1173,6 +1247,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1231,6 +1306,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1289,6 +1365,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1346,6 +1423,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', @@ -1403,6 +1481,7 @@ describe('OC.SetupChecks tests', function() { isGetenvServerWorking: true, isReadOnlyConfig: false, wasEmailTestSuccessful: true, + isPreviewMaxSetCorrectly: true, hasWorkingFileLocking: true, hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '',