]> source.dussan.org Git - nextcloud-server.git/commitdiff
improve overwrite cli url setup check 31430/head
authorszaimen <szaimen@e.mail.de>
Thu, 3 Mar 2022 17:08:08 +0000 (18:08 +0100)
committerszaimen <szaimen@e.mail.de>
Wed, 9 Mar 2022 21:26:00 +0000 (22:26 +0100)
Signed-off-by: szaimen <szaimen@e.mail.de>
apps/settings/lib/Controller/CheckSetupController.php
core/js/setupchecks.js

index 11900fad45b9e2b8b50ca840427099376944966c..eeaf45d0ec51d898d94a1c8871de8cabf99b9c8a 100644 (file)
@@ -609,15 +609,14 @@ Raw output
        }
 
        protected function getSuggestedOverwriteCliURL(): string {
-               $suggestedOverwriteCliUrl = '';
-               if ($this->config->getSystemValue('overwrite.cli.url', '') === '') {
-                       $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
-                       if (!$this->config->getSystemValue('config_is_read_only', false)) {
-                               // Set the overwrite URL when it was not set yet.
-                               $this->config->setSystemValue('overwrite.cli.url', $suggestedOverwriteCliUrl);
-                               $suggestedOverwriteCliUrl = '';
-                       }
+               $currentOverwriteCliUrl = $this->config->getSystemValue('overwrite.cli.url', '');
+               $suggestedOverwriteCliUrl = $this->request->getServerProtocol() . '://' . $this->request->getInsecureServerHost() . \OC::$WEBROOT;
+
+               // Check correctness by checking if it is a valid URL
+               if (filter_var($currentOverwriteCliUrl, FILTER_VALIDATE_URL)) {
+                       $suggestedOverwriteCliUrl = '';
                }
+
                return $suggestedOverwriteCliUrl;
        }
 
index fdeed4897d091585e8393d391afc8aabf9a5802b..5a926534d9e9ca2ca1bef62c89c53450a2b688cf 100644 (file)
                                        }
                                        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}),
+                                                       msg: t('core', 'Please make sure to set the "overwrite.cli.url" option in your config.php file to the URL that your users mainly use to access this Nextcloud. Suggestion: "{suggestedOverwriteCliURL}". Otherwise there might be problems with the URL generation via cron. (It is possible though that the suggested URL is not the URL that your users mainly use to access this Nextcloud. Best is to double check this in any case.)', {suggestedOverwriteCliURL: data.suggestedOverwriteCliURL}),
                                                        type: OC.SetupChecks.MESSAGE_TYPE_WARNING
                                                });
                                        }