Browse Source

Merge setupchecks from new API into old UI

This will allow migrating checks to the new API without touching the UI
 for now.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v28.0.0beta1
Côme Chilliet 8 months ago
parent
commit
05cb1415e1
No account linked to committer's email address
2 changed files with 14 additions and 56 deletions
  1. 1
    21
      apps/settings/lib/Controller/CheckSetupController.php
  2. 13
    35
      core/js/setupchecks.js

+ 1
- 21
apps/settings/lib/Controller/CheckSetupController.php View File

@@ -329,25 +329,6 @@ class CheckSetupController extends Controller {
return '';
}

/**
* Whether the version is outdated
*
* @return bool
*/
protected function isPhpOutdated(): bool {
return PHP_VERSION_ID < 80100;
}

/**
* Whether the php version is still supported (at time of release)
* according to: https://www.php.net/supported-versions.php
*
* @return array
*/
private function isPhpSupported(): array {
return ['eol' => $this->isPhpOutdated(), 'version' => PHP_VERSION];
}

/**
* Check if the reverse proxy configuration is working as expected
*
@@ -931,7 +912,6 @@ Raw output
'isRandomnessSecure' => $this->isRandomnessSecure(),
'securityDocs' => $this->urlGenerator->linkToDocs('admin-security'),
'isUsedTlsLibOutdated' => $this->isUsedTlsLibOutdated(),
'phpSupported' => $this->isPhpSupported(),
'forwardedForHeadersWorking' => $this->forwardedForHeadersWorking(),
'reverseProxyDocs' => $this->urlGenerator->linkToDocs('admin-reverse-proxy'),
'isCorrectMemcachedPHPModuleInstalled' => $this->isCorrectMemcachedPHPModuleInstalled(),
@@ -956,8 +936,8 @@ Raw output
'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(),
'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'),
'imageMagickLacksSVGSupport' => $this->imageMagickLacksSVGSupport(),
'isDefaultPhoneRegionSet' => $this->config->getSystemValueString('default_phone_region', '') !== '',
'temporaryDirectoryWritable' => $this->isTemporaryDirectoryWritable(),
'generic' => $this->setupCheckManager->runAll(),
]
);
}

+ 13
- 35
core/js/setupchecks.js View File

@@ -245,14 +245,6 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
if (!data.isDefaultPhoneRegionSet) {
messages.push({
msg: t('core', 'Your installation has no default phone region set. This is required to validate phone numbers in the profile settings without a country code. To allow numbers without a country code, please add "default_phone_region" with the respective {linkstart}ISO 3166-1 code ↗{linkend} of the region to your config file.')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements">')
.replace('{linkend}', '</a>'),
type: OC.SetupChecks.MESSAGE_TYPE_INFO
});
}
if (data.cronErrors.length > 0) {
var listOfCronErrors = "";
data.cronErrors.forEach(function(element){
@@ -311,22 +303,6 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
});
}
if (data.phpSupported && data.phpSupported.eol) {
messages.push({
msg: t('core', 'You are currently running PHP {version}. Upgrade your PHP version to take advantage of {linkstart}performance and security updates provided by the PHP Group ↗{linkend} as soon as your distribution supports it.', { version: data.phpSupported.version })
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="https://secure.php.net/supported-versions.php">')
.replace('{linkend}', '</a>'),
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
})
}
if (data.phpSupported && data.phpSupported.version.substr(0, 3) === '8.0') {
messages.push({
msg: t('core', 'PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to {linkstart}one of the officially supported PHP versions provided by the PHP Group ↗{linkend} as soon as possible.')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="https://secure.php.net/supported-versions.php">')
.replace('{linkend}', '</a>'),
type: OC.SetupChecks.MESSAGE_TYPE_INFO
})
}
if(!data.forwardedForHeadersWorking) {
messages.push({
msg: t('core', 'The reverse proxy header configuration is incorrect, or you are accessing Nextcloud from a trusted proxy. If not, this is a security issue and can allow an attacker to spoof their IP address as visible to the Nextcloud. Further information can be found in the {linkstart}documentation ↗{linkend}.')
@@ -535,14 +511,16 @@
type: OC.SetupChecks.MESSAGE_TYPE_WARNING
})
}

OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\PhpDefaultCharset', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\PhpOutputBuffering', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\LegacySSEKeyFormat', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\CheckUserCertificates', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\SupportedDatabase', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\LdapInvalidUuids', messages)
OC.SetupChecks.addGenericSetupCheck(data, 'OCA\\Settings\\SetupChecks\\NeedsSystemAddressBookSync', messages)
if (Object.keys(data.generic).length > 0) {
Object.keys(data.generic).forEach(function(key){
Object.keys(data.generic[key]).forEach(function(title){
if (data.generic[key][title].severity != 'success') {
data.generic[key][title].pass = false;
OC.SetupChecks.addGenericSetupCheck(data.generic[key], title, messages);
}
});
});
}
} else {
messages.push({
msg: t('core', 'Error occurred while checking server setup'),
@@ -561,7 +539,7 @@
},

addGenericSetupCheck: function(data, check, messages) {
var setupCheck = data[check] || { pass: true, description: '', severity: 'info', linkToDocumentation: null}
var setupCheck = data[check] || { pass: true, description: '', severity: 'info', linkToDoc: null}

var type = OC.SetupChecks.MESSAGE_TYPE_INFO
if (setupCheck.severity === 'warning') {
@@ -571,9 +549,9 @@
}

var message = setupCheck.description;
if (setupCheck.linkToDocumentation) {
if (setupCheck.linkToDoc) {
message += ' ' + t('core', 'For more details see the {linkstart}documentation ↗{linkend}.')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + setupCheck.linkToDocumentation + '">')
.replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + setupCheck.linkToDoc + '">')
.replace('{linkend}', '</a>');
}
if (setupCheck.elements) {

Loading…
Cancel
Save