Add setup check for recommended PHP modules (i.e. Imagick, intl)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
441496a5a5
commit
f5ad80fc57
4 changed files with 67 additions and 12 deletions
|
@ -324,6 +324,19 @@
|
||||||
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (data.recommendedPHPModules.length > 0) {
|
||||||
|
var listOfRecommendedPHPModules = "";
|
||||||
|
data.recommendedPHPModules.forEach(function(element){
|
||||||
|
listOfRecommendedPHPModules += "<li>" + element + "</li>";
|
||||||
|
});
|
||||||
|
messages.push({
|
||||||
|
msg: t(
|
||||||
|
'core',
|
||||||
|
'This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.'
|
||||||
|
) + "<ul><code>" + listOfRecommendedPHPModules + "</code></ul>",
|
||||||
|
type: OC.SetupChecks.MESSAGE_TYPE_INFO
|
||||||
|
})
|
||||||
|
}
|
||||||
if (data.isSqliteUsed) {
|
if (data.isSqliteUsed) {
|
||||||
messages.push({
|
messages.push({
|
||||||
msg: t(
|
msg: t(
|
||||||
|
|
|
@ -210,7 +210,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -259,7 +260,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -309,7 +311,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -357,7 +360,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -403,7 +407,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -451,7 +456,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: [
|
appDirsWithDifferentOwner: [
|
||||||
'/some/path'
|
'/some/path'
|
||||||
]
|
],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -497,7 +503,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -543,7 +550,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -589,6 +597,7 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
appDirsWithDifferentOwner: [],
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: [],
|
||||||
isMemoryLimitSufficient: false
|
isMemoryLimitSufficient: false
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -656,7 +665,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -703,7 +713,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -750,7 +761,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -797,7 +809,8 @@ describe('OC.SetupChecks tests', function() {
|
||||||
diffInSeconds: 0
|
diffInSeconds: 0
|
||||||
},
|
},
|
||||||
isMemoryLimitSufficient: true,
|
isMemoryLimitSufficient: true,
|
||||||
appDirsWithDifferentOwner: []
|
appDirsWithDifferentOwner: [],
|
||||||
|
recommendedPHPModules: []
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -582,6 +582,27 @@ Raw output
|
||||||
return $appDirsWithDifferentOwner;
|
return $appDirsWithDifferentOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for potential PHP modules that would improve the instance
|
||||||
|
*
|
||||||
|
* @return string[] A list of PHP modules that is recommended
|
||||||
|
*/
|
||||||
|
protected function hasRecommendedPHPModules(): array {
|
||||||
|
$recommendedPHPModules = [];
|
||||||
|
|
||||||
|
if (!function_exists('grapheme_strlen')) {
|
||||||
|
$recommendedPHPModules[] = 'intl';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->config->getAppValue('theming', 'enabled', 'no') === 'yes') {
|
||||||
|
if (!extension_loaded('imagick')) {
|
||||||
|
$recommendedPHPModules[] = 'imagick';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $recommendedPHPModules;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DataResponse
|
* @return DataResponse
|
||||||
*/
|
*/
|
||||||
|
@ -621,6 +642,7 @@ Raw output
|
||||||
'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'),
|
'mailSettingsDocumentation' => $this->urlGenerator->getAbsoluteURL('index.php/settings/admin'),
|
||||||
'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
|
'isMemoryLimitSufficient' => $this->memoryInfo->isMemoryLimitSufficient(),
|
||||||
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
|
'appDirsWithDifferentOwner' => $this->getAppDirsWithDifferentOwner(),
|
||||||
|
'recommendedPHPModules' => $this->hasRecommendedPHPModules(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ class CheckSetupControllerTest extends TestCase {
|
||||||
'isPhpMailerUsed',
|
'isPhpMailerUsed',
|
||||||
'hasOpcacheLoaded',
|
'hasOpcacheLoaded',
|
||||||
'getAppDirsWithDifferentOwner',
|
'getAppDirsWithDifferentOwner',
|
||||||
|
'hasRecommendedPHPModules',
|
||||||
])->getMock();
|
])->getMock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +488,11 @@ class CheckSetupControllerTest extends TestCase {
|
||||||
->method('getAppDirsWithDifferentOwner')
|
->method('getAppDirsWithDifferentOwner')
|
||||||
->willReturn([]);
|
->willReturn([]);
|
||||||
|
|
||||||
|
$this->checkSetupController
|
||||||
|
->expects($this->once())
|
||||||
|
->method('hasRecommendedPHPModules')
|
||||||
|
->willReturn([]);
|
||||||
|
|
||||||
$expected = new DataResponse(
|
$expected = new DataResponse(
|
||||||
[
|
[
|
||||||
'isGetenvServerWorking' => true,
|
'isGetenvServerWorking' => true,
|
||||||
|
@ -529,6 +535,7 @@ class CheckSetupControllerTest extends TestCase {
|
||||||
'mailSettingsDocumentation' => 'https://server/index.php/settings/admin',
|
'mailSettingsDocumentation' => 'https://server/index.php/settings/admin',
|
||||||
'isMemoryLimitSufficient' => true,
|
'isMemoryLimitSufficient' => true,
|
||||||
'appDirsWithDifferentOwner' => [],
|
'appDirsWithDifferentOwner' => [],
|
||||||
|
'recommendedPHPModules' => [],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $this->checkSetupController->check());
|
$this->assertEquals($expected, $this->checkSetupController->check());
|
||||||
|
|
Loading…
Reference in a new issue