diff options
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/MaintenancePlugin.php | 14 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/ServerFactory.php | 9 | ||||
-rw-r--r-- | apps/dav/lib/Direct/ServerFactory.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/Server.php | 2 |
5 files changed, 23 insertions, 12 deletions
diff --git a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php index 9a0e78e55a8..3f4031740cc 100644 --- a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php +++ b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php @@ -52,7 +52,7 @@ class InvitationResponseServer { $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); // Add maintenance plugin - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav'))); // Set URL explicitly due to reverse-proxy situations $this->server->httpRequest->setUrl($baseUri); 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); diff --git a/apps/dav/lib/Direct/ServerFactory.php b/apps/dav/lib/Direct/ServerFactory.php index f0f56921bdc..aa229e3baf3 100644 --- a/apps/dav/lib/Direct/ServerFactory.php +++ b/apps/dav/lib/Direct/ServerFactory.php @@ -31,14 +31,18 @@ use OCA\DAV\Db\DirectMapper; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\IRootFolder; use OCP\IConfig; +use OCP\IL10N; use OCP\IRequest; class ServerFactory { /** @var IConfig */ private $config; + /** @var IL10N */ + private $l10n; - public function __construct(IConfig $config) { + public function __construct(IConfig $config, IL10N $l10n) { $this->config = $config; + $this->l10n = $l10n; } public function createServer(string $baseURI, @@ -54,7 +58,7 @@ class ServerFactory { $server->httpRequest->setUrl($requestURI); $server->setBaseUri($baseURI); - $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config)); + $server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin($this->config, $this->l10n)); return $server; } diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index e93df5c26df..46cac5ef873 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -92,7 +92,7 @@ class Server { $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); // Add maintenance plugin - $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); + $this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig(), \OC::$server->getL10N('dav'))); // Backends $authBackend = new Auth( |