Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php1
-rw-r--r--lib/composer/composer/autoload_static.php1
-rw-r--r--lib/public/AppFramework/IAppContainer.php1
-rw-r--r--lib/public/IServerContainer.php2
-rw-r--r--lib/public/Server.php54
5 files changed, 59 insertions, 0 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 997c5d5a844..32a4c749a08 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -515,6 +515,7 @@ return array(
'OCP\\Security\\ITrustedDomainHelper' => $baseDir . '/lib/public/Security/ITrustedDomainHelper.php',
'OCP\\Security\\VerificationToken\\IVerificationToken' => $baseDir . '/lib/public/Security/VerificationToken/IVerificationToken.php',
'OCP\\Security\\VerificationToken\\InvalidTokenException' => $baseDir . '/lib/public/Security/VerificationToken/InvalidTokenException.php',
+ 'OCP\\Server' => $baseDir . '/lib/public/Server.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IDelegatedSettings' => $baseDir . '/lib/public/Settings/IDelegatedSettings.php',
'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index c6cfdaba6ec..8f2b1cb648a 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -544,6 +544,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\Security\\ITrustedDomainHelper' => __DIR__ . '/../../..' . '/lib/public/Security/ITrustedDomainHelper.php',
'OCP\\Security\\VerificationToken\\IVerificationToken' => __DIR__ . '/../../..' . '/lib/public/Security/VerificationToken/IVerificationToken.php',
'OCP\\Security\\VerificationToken\\InvalidTokenException' => __DIR__ . '/../../..' . '/lib/public/Security/VerificationToken/InvalidTokenException.php',
+ 'OCP\\Server' => __DIR__ . '/../../..' . '/lib/public/Server.php',
'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php',
'OCP\\Settings\\IDelegatedSettings' => __DIR__ . '/../../..' . '/lib/public/Settings/IDelegatedSettings.php',
'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php',
diff --git a/lib/public/AppFramework/IAppContainer.php b/lib/public/AppFramework/IAppContainer.php
index 626481de0e0..a3b82144033 100644
--- a/lib/public/AppFramework/IAppContainer.php
+++ b/lib/public/AppFramework/IAppContainer.php
@@ -38,6 +38,7 @@ use Psr\Container\ContainerInterface;
* thus this interface won't extend it anymore once that was removed. So migrate to the ContainerInterface
* only.
*
+ * @deprecated 20.0.0
* @since 6.0.0
*/
interface IAppContainer extends ContainerInterface, IContainer {
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 024abbe2a97..6c07a5218ba 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -55,6 +55,8 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
* thus this interface won't extend it anymore once that was removed. So migrate to the ContainerInterface
* only.
*
+ * @deprecated 20.0.0
+ *
* @since 6.0.0
*/
interface IServerContainer extends ContainerInterface, IContainer {
diff --git a/lib/public/Server.php b/lib/public/Server.php
new file mode 100644
index 00000000000..be6b6a49236
--- /dev/null
+++ b/lib/public/Server.php
@@ -0,0 +1,54 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright Carl Schwan <carl@carlschwan.eu>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCP;
+
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
+
+/**
+ * Class allowing to inject services into your application. You should
+ * use whenever possible dependency injections instead.
+ *
+ * ```php
+ * use OCP\Server;
+ *
+ * $tagManager = Server::get(ITagManager::class);
+ * ```
+ *
+ * @since 25.0.0
+ */
+final class Server {
+ /**
+ * @template T
+ * @param class-string<T>|string $serviceName
+ * @return T|mixed
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ * @since 25.0.0
+ */
+ public static function get(string $serviceName) {
+ /** @psalm-suppress UndefinedClass */
+ return \OC::$server->get($serviceName);
+ }
+}