diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-05-06 18:11:54 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-05-06 18:11:54 +0200 |
commit | ecbc009e2fc8aa7fd078634f4cb2271fded69fb6 (patch) | |
tree | 06a38a88467567ec86ee55bf2f83947f32a1607c /apps/dav/lib/Connector | |
parent | afc59665582dbd83c4c25cab21a5b30b79cac676 (diff) | |
download | nextcloud-server-ecbc009e2fc8aa7fd078634f4cb2271fded69fb6.tar.gz nextcloud-server-ecbc009e2fc8aa7fd078634f4cb2271fded69fb6.zip |
Translate the maintenance mode message in webdav
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/dav/lib/Connector')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/MaintenancePlugin.php | 14 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 9 |
2 files changed, 15 insertions, 8 deletions
diff --git a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php index 0885edd11a9..e5db244c21f 100644 --- a/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php +++ b/apps/dav/lib/Connector/Sabre/MaintenancePlugin.php @@ -28,6 +28,7 @@ namespace OCA\DAV\Connector\Sabre; use OCP\IConfig; +use OCP\IL10N; use OCP\Util; use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\ServerPlugin; @@ -37,6 +38,9 @@ class MaintenancePlugin extends ServerPlugin { /** @var IConfig */ private $config; + /** @var \OCP\IL10N */ + private $l10n; + /** * Reference to main server object * @@ -47,11 +51,9 @@ class MaintenancePlugin extends ServerPlugin { /** * @param IConfig $config */ - public function __construct(IConfig $config = null) { + public function __construct(IConfig $config, IL10N $l10n) { $this->config = $config; - if (is_null($config)) { - $this->config = \OC::$server->getConfig(); - } + $this->l10n = \OC::$server->getL10N('dav'); } @@ -80,10 +82,10 @@ class MaintenancePlugin extends ServerPlugin { */ public function checkMaintenanceMode() { if ($this->config->getSystemValueBool('maintenance')) { - throw new ServiceUnavailable('System in maintenance mode.'); + throw new ServiceUnavailable($this->l10n->t('System in maintenance mode.')); } if (Util::needUpgrade()) { - throw new ServiceUnavailable('Upgrade needed'); + throw new ServiceUnavailable($this->l10n->t('Upgrade needed')); } return true; diff --git a/apps/dav/lib/Connector/Sabre/ServerFactory.php b/apps/dav/lib/Connector/Sabre/ServerFactory.php index 51543e2ed8a..8beabd3510b 100644 --- a/apps/dav/lib/Connector/Sabre/ServerFactory.php +++ b/apps/dav/lib/Connector/Sabre/ServerFactory.php @@ -38,6 +38,7 @@ use OCA\DAV\Files\BrowserErrorPagePlugin; use OCP\Files\Mount\IMountManager; use OCP\IConfig; use OCP\IDBConnection; +use OCP\IL10N; use OCP\ILogger; use OCP\IPreview; use OCP\IRequest; @@ -66,6 +67,8 @@ class ServerFactory { private $previewManager; /** @var EventDispatcherInterface */ private $eventDispatcher; + /** @var IL10N */ + private $l10n; /** * @param IConfig $config @@ -86,7 +89,8 @@ class ServerFactory { ITagManager $tagManager, IRequest $request, IPreview $previewManager, - EventDispatcherInterface $eventDispatcher + EventDispatcherInterface $eventDispatcher, + IL10N $l10n ) { $this->config = $config; $this->logger = $logger; @@ -97,6 +101,7 @@ class ServerFactory { $this->request = $request; $this->previewManager = $previewManager; $this->eventDispatcher = $eventDispatcher; + $this->l10n = $l10n; } /** @@ -118,7 +123,7 @@ class ServerFactory { $server->setBaseUri($baseUri); // Load plugins - $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config, $this->l10n)); $server->addPlugin(new \OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin($this->config)); $server->addPlugin(new \OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin()); $server->addPlugin($authPlugin); |