diff options
Diffstat (limited to 'core/js/setupchecks.js')
-rw-r--r-- | core/js/setupchecks.js | 84 |
1 files changed, 68 insertions, 16 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index ca7d979f5f3..4aa60912c37 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -52,12 +52,16 @@ * @param url the URL to test * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned - * @param {int} expectedStatus the expected HTTP status to be returned by the URL, 207 by default + * @param {int|int[]} expectedStatus the expected HTTP status to be returned by the URL, 207 by default * @return $.Deferred object resolved with an array of error messages */ checkWellKnownUrl: function(url, placeholderUrl, runCheck, expectedStatus) { if (expectedStatus === undefined) { - expectedStatus = 207; + expectedStatus = [207]; + } + + if (!Array.isArray(expectedStatus)) { + expectedStatus = [expectedStatus]; } var deferred = $.Deferred(); @@ -68,7 +72,7 @@ } var afterCall = function(xhr) { var messages = []; - if (xhr.status !== expectedStatus) { + if (expectedStatus.indexOf(xhr.status) === -1) { var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-setup-well-known-URL'); messages.push({ msg: t('core', 'Your web server is not properly set up to resolve "{url}". Further information can be found in the <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), @@ -88,6 +92,37 @@ }, /** + * Check whether the WOFF2 URLs works. + * + * @param url the URL to test + * @param placeholderUrl the placeholder URL - can be found at oc_defaults.docPlaceholderUrl + * @return $.Deferred object resolved with an array of error messages + */ + checkWOFF2Loading: function(url, placeholderUrl) { + var deferred = $.Deferred(); + + var afterCall = function(xhr) { + var messages = []; + if (xhr.status !== 200) { + var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-nginx'); + messages.push({ + msg: t('core', 'Your web server is not properly set up to deliver .woff2 files. This is typically an issue with the Nginx configuration. For Nextcloud 15 it needs an adjustement to also deliver .woff2 files. Compare your Nginx configuration to the recommended configuration in our <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation</a>.', { docLink: docUrl, url: url }), + type: OC.SetupChecks.MESSAGE_TYPE_WARNING + }); + } + deferred.resolve(messages); + }; + + $.ajax({ + type: 'GET', + url: url, + complete: afterCall, + allowAuthErrors: true + }); + return deferred.promise(); + }, + + /** * Runs setup checks on the server side * * @return $.Deferred object resolved with an array of error messages @@ -128,18 +163,6 @@ 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 <a target="_blank" rel="noreferrer noopener" href="{docLink}">documentation ↗</a> for more information.', {docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-transactional-locking')}), @@ -293,6 +316,35 @@ 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.pendingBigIntConversionColumns.length > 0) { + var listOfPendingBigIntConversionColumns = ""; + data.pendingBigIntConversionColumns.forEach(function(element){ + listOfPendingBigIntConversionColumns += "<li>" + element + "</li>"; + }); + messages.push({ + msg: t( + 'core', + 'Some columns in the database are missing a conversion to big int. Due to the fact that changing column types on big tables could take some time they were not changed automatically. By running \'occ db:convert-filecache-bigint\' those pending changes could be applied manually. This operation needs to be made while the instance is offline. For further details read <a target="_blank" rel="noreferrer noopener" href="{docLink}">the documentation page about this</a>.', + { + docLink: oc_defaults.docPlaceholderUrl.replace('PLACEHOLDER', 'admin-bigint-conversion'), + } + ) + "<ul>" + listOfPendingBigIntConversionColumns + "</ul>", + type: OC.SetupChecks.MESSAGE_TYPE_INFO + }) + } if (data.isSqliteUsed) { messages.push({ msg: t( @@ -309,7 +361,7 @@ type: OC.SetupChecks.MESSAGE_TYPE_WARNING }) } - if (data.isPhpMailerUsed) { + if (data.isPHPMailerUsed) { messages.push({ msg: t( 'core', |