diff options
author | Cthulhux <git@tuxproject.de> | 2018-05-07 20:46:19 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-07-11 16:08:40 +0200 |
commit | f6f49c77f7d013e5713c964d4d7e3d4b4eedc636 (patch) | |
tree | 98a175eda7b7dbd82d89e219d7c322d549f7024e /core | |
parent | 229289d206c954baede095e2bae2f34915471a44 (diff) | |
download | nextcloud-server-f6f49c77f7d013e5713c964d4d7e3d4b4eedc636.tar.gz nextcloud-server-f6f49c77f7d013e5713c964d4d7e3d4b4eedc636.zip |
opcache module check
Improved the speed of isOpcacheProperlySetup() (instant return instead of continuing when we're already failed), added a check for the opcache extension itself. Potentially fixes #9410
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/setupchecks.js | 13 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 74 |
2 files changed, 85 insertions, 2 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index 75d335043ac..93072981e99 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -233,7 +233,18 @@ type: OC.SetupChecks.MESSAGE_TYPE_ERROR }); } - if(!data.isOpcacheProperlySetup) { + if(!data.hasOpcacheLoaded) { + messages.push({ + msg: t( + 'core', + 'The PHP OPcache module is not loaded. <a target="_blank" rel="noreferrer noopener" href="{docLink}">For better performance it is recommended</a> to load it into your PHP installation.', + { + docLink: data.phpOpcacheDocumentation, + } + ), + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }); + } else if(!data.isOpcacheProperlySetup) { messages.push({ msg: t( 'core', diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 900b9f8fc66..894099bee32 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -103,7 +103,36 @@ describe('OC.SetupChecks tests', function() { it('should return an error if data directory is not protected', function(done) { var async = OC.SetupChecks.checkDataProtected(); - suite.server.requests[0].respond(200, {'Content-Type': 'text/plain'}, ''); + suite.server.requests[0].respond( + 200, + { + 'Content-Type': 'application/json' + }, + JSON.stringify({ + hasFileinfoInstalled: true, + isGetenvServerWorking: true, + isReadOnlyConfig: false, + hasWorkingFileLocking: true, + hasValidTransactionIsolationLevel: true, + suggestedOverwriteCliURL: '', + isUrandomAvailable: true, + serverHasInternetConnection: false, + memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance', + forwardedForHeadersWorking: true, + isCorrectMemcachedPHPModuleInstalled: true, + hasPassedCodeIntegrityCheck: true, + isOpcacheProperlySetup: true, + hasOpcacheLoaded: false, + isSettimelimitAvailable: true, + hasFreeTypeSupport: true, + missingIndexes: [], + outdatedCaches: [], + cronErrors: [], + cronInfo: { + diffInSeconds: 0 + } + }) + ); async.done(function( data, s, x ){ expect(data).toEqual([ @@ -162,6 +191,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -208,6 +238,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -255,6 +286,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -300,6 +332,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -343,6 +376,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: false, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -386,6 +420,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -429,6 +464,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: false, hasFreeTypeSupport: true, missingIndexes: [], @@ -493,6 +529,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, isSettimelimitAvailable: true, hasFreeTypeSupport: true, missingIndexes: [], @@ -536,6 +573,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: false, + hasOpcacheLoaded: true, phpOpcacheDocumentation: 'https://example.org/link/to/doc', isSettimelimitAvailable: true, hasFreeTypeSupport: true, @@ -557,6 +595,39 @@ describe('OC.SetupChecks tests', function() { }); }); + it('should return an info if server has no opcache at all', function(done) { + var async = OC.SetupChecks.checkSetup(); + + suite.server.requests[0].respond( + 200, + { + 'Content-Type': 'application/json' + }, + JSON.stringify({ + isUrandomAvailable: true, + securityDocs: 'https://docs.owncloud.org/myDocs.html', + serverHasInternetConnection: true, + isMemcacheConfigured: true, + forwardedForHeadersWorking: true, + isCorrectMemcachedPHPModuleInstalled: true, + hasPassedCodeIntegrityCheck: true, + isOpcacheProperlySetup: true, + hasOpcacheLoaded: false, + phpOpcacheDocumentation: 'https://example.org/link/to/doc', + isSettimelimitAvailable: true, + hasFreeTypeSupport: true + }) + ); + + async.done(function( data, s, x ){ + expect(data).toEqual([{ + msg: 'The PHP OPcache module is not loaded. <a target="_blank" rel="noreferrer noopener" href="https://example.org/link/to/doc">For better performance it is recommended</a> to load it into your PHP installation.', + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }]); + done(); + }); + }); + it('should return an info if server has no FreeType support', function(done) { var async = OC.SetupChecks.checkSetup(); @@ -580,6 +651,7 @@ describe('OC.SetupChecks tests', function() { isCorrectMemcachedPHPModuleInstalled: true, hasPassedCodeIntegrityCheck: true, isOpcacheProperlySetup: true, + hasOpcacheLoaded: true, phpOpcacheDocumentation: 'https://example.org/link/to/doc', isSettimelimitAvailable: true, hasFreeTypeSupport: false, |