summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-02-07 11:37:04 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2020-03-15 15:13:10 +0100
commit20f4a8c04609e58d81037753bf1d9cd39f4e8c02 (patch)
tree3df9bc4c35150437e377369cb18d71c1586260f6
parent0ffa598136b056c2a468595cc149fe56af2ea7d6 (diff)
downloadnextcloud-server-20f4a8c04609e58d81037753bf1d9cd39f4e8c02.tar.gz
nextcloud-server-20f4a8c04609e58d81037753bf1d9cd39f4e8c02.zip
Add a deprecated alias registration to find deprecated usages
Fixes #19345 Basically just a stupid wrapper with extra logging. So that we can at least inform people they are using the wrong methods. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--lib/private/Server.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index d6c8e57d696..32e9394a687 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -134,6 +134,7 @@ use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util;
use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
+use OCP\AppFramework\QueryException;
use OCP\Authentication\LoginCredentials\IStore;
use OCP\Collaboration\AutoComplete\IManager;
use OCP\Contacts\ContactsMenu\IActionFactory;
@@ -158,9 +159,11 @@ use OCP\Group\Events\UserAddedEvent;
use OCP\Group\Events\UserRemovedEvent;
use OCP\Group\ISubAdmin;
use OCP\ICacheFactory;
+use OCP\IContainer;
use OCP\IDBConnection;
use OCP\IInitialStateService;
use OCP\IL10N;
+use OCP\ILogger;
use OCP\IServerContainer;
use OCP\ITempManager;
use OCP\IUser;
@@ -2179,4 +2182,18 @@ class Server extends ServerContainer implements IServerContainer {
public function getGeneratorHelper() {
return $this->query(\OC\Preview\GeneratorHelper::class);
}
+
+ private function registerDeprecatedAlias(string $alias, string $target) {
+ $this->registerService($alias, function (IContainer $container) use ($target, $alias) {
+ try {
+ /** @var ILogger $logger */
+ $logger = $container->query(ILogger::class);
+ $logger->debug('The requested alias "' . $alias . '" is depreacted. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']);
+ } catch (QueryException $e) {
+ // Could not get logger. Continue
+ }
+
+ return $container->query($target);
+ }, false);
+ }
}