diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js
index 6e1c993b3b..eae0abae50 100644
--- a/core/js/setupchecks.js
+++ b/core/js/setupchecks.js
@@ -92,6 +92,85 @@
var afterCall = function(data, statusText, xhr) {
var messages = [];
if (xhr.status === 200 && data) {
+ if (!data.isGetenvServerWorking) {
+ messages.push({
+ msg: t('core', 'PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.') + ' ' +
+ t(
+ 'core',
+ 'Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.',
+ {
+ docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-php-fpm')
+ }
+ ),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ });
+ }
+ if (data.isReadOnlyConfig) {
+ messages.push({
+ msg: t('core', 'The read-only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.'),
+ 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.'),
+ type: OC.SetupChecks.MESSAGE_TYPE_ERROR
+ });
+ }
+ if(!data.hasFileinfoInstalled) {
+ messages.push({
+ msg: t('core', 'The PHP module "fileinfo" is missing. It is strongly recommended to enable this module to get the best results with MIME type detection.'),
+ type: OC.SetupChecks.MESSAGE_TYPE_INFO
+ });
+ }
+ if (data.outdatedCaches.length > 0) {
+ data.outdatedCaches.forEach(function(element){
+ messages.push({
+ msg: t(
+ 'core',
+ '{name} below version {version} is installed, for stability and performance reasons it is recommended to update to a newer {name} version.',
+ element
+ ),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ })
+ });
+ }
+ if(!data.hasWorkingFileLocking) {
+ messages.push({
+ msg: t('core', 'Transactional file locking is disabled, this might lead to issues with race conditions. Enable "filelocking.enabled" in config.php to avoid these problems. See the documentation ↗ for more information.', {docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking')}),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ });
+ }
+ if (data.suggestedOverwriteCliURL !== '') {
+ messages.push({
+ msg: t('core', 'If your installation is not installed at the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (suggestion: "{suggestedOverwriteCliURL}")', {suggestedOverwriteCliURL: data.suggestedOverwriteCliURL}),
+ type: OC.SetupChecks.MESSAGE_TYPE_WARNING
+ });
+ }
+ if (data.cronErrors.length > 0) {
+ var listOfCronErrors = "";
+ data.cronErrors.forEach(function(element){
+ listOfCronErrors += "
t('Security & setup warnings'));?>
t('It\'s important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the linked documentation for more information.'));?>
-
-
- -
- t('PHP does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.')); ?>
- t('Please check the installation documentation ↗ for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm.', link_to_docs('admin-php-fpm'))); ?>
-
-
- -
- t('The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); ?>
-
-
- -
- t('PHP is apparently set up to strip inline doc blocks. This will make several core apps inaccessible.')); ?>
- t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')); ?>
-
-
- -
- t('Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.')); ?>
-
- $data) {
- ?>
- -
- t('%1$s below version %2$s is installed, for stability and performance reasons it is recommended to update to a newer %1$s version.', $data)); ?>
-
-
- -
- t('The PHP module \'fileinfo\' is missing. It is strongly recommended to enable this module to get the best results with MIME type detection.')); ?>
-
-
- -
- t('Transactional file locking is disabled, this might lead to issues with race conditions. Enable \'filelocking.enabled\' in config.php to avoid these problems. See the documentation ↗ for more information.', link_to_docs('admin-transactional-locking'))); ?>
-
-
- -
- t('System locale can not be set to a one which supports UTF-8.'));
- ?>
-
- t('This means that there might be problems with certain characters in filenames.'));
- ?>
-
- t('It is strongly proposed to install the required packages on your system to support one of the following locales: %s.', [$locales]));
- ?>
-
-
- -
- t('If your installation is not installed at the root of the domain and uses system Cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (Suggested: "%s")', $_['suggestedOverwriteCliUrl'])); ?>
-
-
- -
- t('It was not possible to execute the cron job via CLI. The following technical errors have appeared:')); ?>
-
-
- error)) {?>
- - error) ?> hint) ?>
-
-
-
-
- getDateTimeFormatter();
- $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long');
- if (time() - $_['lastcron'] > 3600): ?>
- -
- t("Last background job execution ran %s. Something seems wrong.", [$relative_time]));?>
- t('Check the background job settings')); ?>
-
-
-
-
t('All checks passed.'));?>
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index f0e19e007f..c062dff070 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -21,6 +21,7 @@
namespace Tests\Settings\Controller;
+use OC\DB\Connection;
use OC\Settings\Controller\CheckSetupController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
@@ -28,11 +29,13 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
+use OCP\IDateTimeFormatter;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IURLGenerator;
use OC_Util;
+use OCP\Lock\ILockingProvider;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Test\TestCase;
@@ -64,6 +67,12 @@ class CheckSetupControllerTest extends TestCase {
private $checker;
/** @var EventDispatcher|\PHPUnit_Framework_MockObject_MockObject */
private $dispatcher;
+ /** @var Connection|\PHPUnit_Framework_MockObject_MockObject */
+ private $db;
+ /** @var ILockingProvider|\PHPUnit_Framework_MockObject_MockObject */
+ private $lockingProvider;
+ /** @var IDateTimeFormatter|\PHPUnit_Framework_MockObject_MockObject */
+ private $dateTimeFormatter;
public function setUp() {
parent::setUp();
@@ -90,6 +99,10 @@ class CheckSetupControllerTest extends TestCase {
$this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
->disableOriginalConstructor()->getMock();
$this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->db = $this->getMockBuilder(Connection::class)
+ ->disableOriginalConstructor()->getMock();
+ $this->lockingProvider = $this->getMockBuilder(ILockingProvider::class)->getMock();
+ $this->dateTimeFormatter = $this->getMockBuilder(IDateTimeFormatter::class)->getMock();
$this->checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
->setConstructorArgs([
'settings',
@@ -102,8 +115,11 @@ class CheckSetupControllerTest extends TestCase {
$this->checker,
$this->logger,
$this->dispatcher,
+ $this->db,
+ $this->lockingProvider,
+ $this->dateTimeFormatter,
])
- ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock();
+ ->setMethods(['isReadOnlyConfig', 'hasValidTransactionIsolationLevel', 'hasFileinfoInstalled', 'hasWorkingFileLocking', 'getLastCronInfo', 'getSuggestedOverwriteCliURL', 'getOutdatedCaches', 'getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport', 'hasMissingIndexes', 'isSqliteUsed'])->getMock();
}
public function testIsInternetConnectionWorkingDisabledViaConfig() {
@@ -263,21 +279,21 @@ class CheckSetupControllerTest extends TestCase {
public function testCheck() {
$this->config->expects($this->at(0))
- ->method('getSystemValue')
- ->with('has_internet_connection', true)
- ->will($this->returnValue(true));
- $this->config->expects($this->at(1))
+ ->method('getAppValue')
+ ->with('core', 'cronErrors')
+ ->willReturn('');
+ $this->config->expects($this->at(2))
->method('getSystemValue')
->with('memcache.local', null)
->will($this->returnValue('SomeProvider'));
- $this->config->expects($this->at(2))
- ->method('getSystemValue')
- ->with('has_internet_connection', true)
- ->will($this->returnValue(false));
$this->config->expects($this->at(3))
->method('getSystemValue')
- ->with('trusted_proxies', [])
- ->willReturn(['1.2.3.4']);
+ ->with('has_internet_connection', true)
+ ->will($this->returnValue(true));
+ $this->config->expects($this->at(4))
+ ->method('getSystemValue')
+ ->with('appstoreenabled', true)
+ ->will($this->returnValue(false));
$this->request->expects($this->once())
->method('getRemoteAddress')
@@ -342,12 +358,56 @@ class CheckSetupControllerTest extends TestCase {
$this->checkSetupController
->method('hasMissingIndexes')
->willReturn([]);
+ $this->checkSetupController
+ ->method('getOutdatedCaches')
+ ->willReturn([]);
$this->checkSetupController
->method('isSqliteUsed')
->willReturn(false);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('isReadOnlyConfig')
+ ->willReturn(false);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('hasValidTransactionIsolationLevel')
+ ->willReturn(true);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('hasFileinfoInstalled')
+ ->willReturn(true);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('hasWorkingFileLocking')
+ ->willReturn(true);
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('getSuggestedOverwriteCliURL')
+ ->willReturn('');
+ $this->checkSetupController
+ ->expects($this->once())
+ ->method('getLastCronInfo')
+ ->willReturn([
+ 'diffInSeconds' => 123,
+ 'relativeTime' => '2 hours ago',
+ 'backgroundJobsUrl' => 'https://example.org',
+ ]);
$expected = new DataResponse(
[
+ 'isGetenvServerWorking' => true,
+ 'isReadOnlyConfig' => false,
+ 'hasValidTransactionIsolationLevel' => true,
+ 'outdatedCaches' => [],
+ 'hasFileinfoInstalled' => true,
+ 'hasWorkingFileLocking' => true,
+ 'suggestedOverwriteCliURL' => '',
+ 'cronInfo' => [
+ 'diffInSeconds' => 123,
+ 'relativeTime' => '2 hours ago',
+ 'backgroundJobsUrl' => 'https://example.org',
+ ],
+ 'cronErrors' => '',
'serverHasInternetConnection' => false,
'isMemcacheConfigured' => true,
'memcacheDocs' => 'http://docs.example.org/server/go.php?to=admin-performance',
@@ -367,9 +427,9 @@ class CheckSetupControllerTest extends TestCase {
'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache',
'isSettimelimitAvailable' => true,
'hasFreeTypeSupport' => false,
- 'hasMissingIndexes' => [],
'isSqliteUsed' => false,
'databaseConversionDocumentation' => 'http://docs.example.org/server/go.php?to=admin-db-conversion',
+ 'missingIndexes' => [],
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
@@ -388,6 +448,9 @@ class CheckSetupControllerTest extends TestCase {
$this->checker,
$this->logger,
$this->dispatcher,
+ $this->db,
+ $this->lockingProvider,
+ $this->dateTimeFormatter,
])
->setMethods(null)->getMock();