diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-03-18 00:01:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-18 00:01:17 +0100 |
commit | 3adee0f18bda27d380459236fe26f2f4ea5feaa8 (patch) | |
tree | 2da10d79e72dee1351c3973dd29210a843e3352f /lib/private/Settings/Admin/Server.php | |
parent | 3c66ad64e626cb602685a640c235d472f0777a53 (diff) | |
parent | 75b81c3e01f3a5dc97e78c8e82fd5f94a071daba (diff) | |
download | nextcloud-server-3adee0f18bda27d380459236fe26f2f4ea5feaa8.tar.gz nextcloud-server-3adee0f18bda27d380459236fe26f2f4ea5feaa8.zip |
Merge pull request #3898 from nextcloud/issue-3627-always-suggest-cli-url
Always suggest the overwrite.cli.url
Diffstat (limited to 'lib/private/Settings/Admin/Server.php')
-rw-r--r-- | lib/private/Settings/Admin/Server.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/private/Settings/Admin/Server.php b/lib/private/Settings/Admin/Server.php index 8b1477a0257..5443336669f 100644 --- a/lib/private/Settings/Admin/Server.php +++ b/lib/private/Settings/Admin/Server.php @@ -32,12 +32,15 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; +use OCP\IRequest; use OCP\Lock\ILockingProvider; use OCP\Settings\ISettings; class Server implements ISettings { /** @var IDBConnection|Connection */ private $db; + /** @var IRequest */ + private $request; /** @var IConfig */ private $config; /** @var ILockingProvider */ @@ -47,15 +50,18 @@ class Server implements ISettings { /** * @param IDBConnection $db + * @param IRequest $request * @param IConfig $config * @param ILockingProvider $lockingProvider * @param IL10N $l */ public function __construct(IDBConnection $db, + IRequest $request, IConfig $config, ILockingProvider $lockingProvider, IL10N $l) { $this->db = $db; + $this->request = $request; $this->config = $config; $this->lockingProvider = $lockingProvider; $this->l = $l; @@ -99,12 +105,15 @@ class Server implements ISettings { $fileLockingType = 'cache'; } - // If the current web root is non-empty but the web root from the config is, - // and system cron is used, the URL generator fails to build valid URLs. - $shouldSuggestOverwriteCliUrl = $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' - && \OC::$WEBROOT && \OC::$WEBROOT !== '/' - && !$this->config->getSystemValue('overwrite.cli.url', ''); - $suggestedOverwriteCliUrl = ($shouldSuggestOverwriteCliUrl) ? \OC::$WEBROOT : ''; + $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 = ''; + } + } $parameters = [ // Diagnosis |