Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add a setup check for 64 bit
Signed-off-by: szaimen <[email protected]>
  • Loading branch information
szaimen committed Jul 13, 2022
commit cf9b1082ed4550d3ece15d1c2cc613a0a5e008bc
9 changes: 9 additions & 0 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,14 @@ protected function areWebauthnExtensionsEnabled(): bool {
return true;
}

protected function is64bit(): bool {
if (PHP_INT_SIZE < 8) {
return false;
} else {
return true;
}
}

protected function isMysqlUsedWithoutUTF8MB4(): bool {
return ($this->config->getSystemValue('dbtype', 'sqlite') === 'mysql') && ($this->config->getSystemValue('mysql.utf8mb4', false) === false);
}
Expand Down Expand Up @@ -880,6 +888,7 @@ public function check() {
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
'isImagickEnabled' => $this->isImagickEnabled(),
'areWebauthnExtensionsEnabled' => $this->areWebauthnExtensionsEnabled(),
'is64bit' => $this->is64bit(),
'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
'pendingBigIntConversionColumns' => $this->hasBigIntConversionPendingColumns(),
'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(),
Expand Down
7 changes: 7 additions & 0 deletions apps/settings/tests/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ protected function setUp(): void {
'getAppDirsWithDifferentOwner',
'isImagickEnabled',
'areWebauthnExtensionsEnabled',
'is64bit',
'hasRecommendedPHPModules',
'hasBigIntConversionPendingColumns',
'isMysqlUsedWithoutUTF8MB4',
Expand Down Expand Up @@ -536,6 +537,11 @@ public function testCheck() {
->method('areWebauthnExtensionsEnabled')
->willReturn(false);

$this->checkSetupController
->expects($this->once())
->method('is64bit')
->willReturn(false);

$this->checkSetupController
->expects($this->once())
->method('hasRecommendedPHPModules')
Expand Down Expand Up @@ -632,6 +638,7 @@ public function testCheck() {
'appDirsWithDifferentOwner' => [],
'isImagickEnabled' => false,
'areWebauthnExtensionsEnabled' => false,
'is64bit' => false,
'recommendedPHPModules' => [],
'pendingBigIntConversionColumns' => [],
'isMysqlUsedWithoutUTF8MB4' => false,
Expand Down
9 changes: 9 additions & 0 deletions core/js/setupchecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,15 @@
type: OC.SetupChecks.MESSAGE_TYPE_INFO
})
}
if (!data.is64bit) {
messages.push({
msg: t(
'core',
'It seems like you are running a 32bit PHP version. Nextcloud needs 64bit to run well. Please upgrade your OS and PHP to 64bit!'
),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
})
}
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.'),
Expand Down
79 changes: 79 additions & 0 deletions core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -311,6 +312,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -372,6 +374,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -431,6 +434,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -488,6 +492,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -545,6 +550,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -604,6 +610,7 @@ describe('OC.SetupChecks tests', function() {
],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -661,6 +668,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -718,6 +726,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -775,6 +784,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -853,6 +863,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -910,6 +921,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -967,6 +979,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1024,6 +1037,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: true,
Expand Down Expand Up @@ -1085,6 +1099,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1143,6 +1158,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1198,6 +1214,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1256,6 +1273,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: false,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1314,6 +1332,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: false,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand All @@ -1333,6 +1352,64 @@ describe('OC.SetupChecks tests', function() {
});
});

it('should return an error for 32bit instances', 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,
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,
is64bit: false,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
isDefaultPhoneRegionSet: true,
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
reverseProxyGeneratedURL: 'https://server',
temporaryDirectoryWritable: true,
})
);

async.done(function( data, s, x ){
expect(data).toEqual([{
msg: 'It seems like you are running a 32bit PHP version. Nextcloud needs 64bit to run well. Please upgrade your OS and PHP to 64bit!',
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
}]);
done();
});
});

it('should return an info if there is no default phone region', function(done) {
var async = OC.SetupChecks.checkSetup();

Expand Down Expand Up @@ -1371,6 +1448,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down Expand Up @@ -1428,6 +1506,7 @@ describe('OC.SetupChecks tests', function() {
appDirsWithDifferentOwner: [],
isImagickEnabled: true,
areWebauthnExtensionsEnabled: true,
is64bit: true,
recommendedPHPModules: [],
pendingBigIntConversionColumns: [],
isMysqlUsedWithoutUTF8MB4: false,
Expand Down