Skip to content
Snippets Groups Projects
Unverified Commit 20f4a8c0 authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

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: default avatarRoeland Jago Douma <roeland@famdouma.nl>
parent 0ffa5981
No related branches found
No related tags found
No related merge requests found
...@@ -134,6 +134,7 @@ use OCA\Theming\ThemingDefaults; ...@@ -134,6 +134,7 @@ use OCA\Theming\ThemingDefaults;
use OCA\Theming\Util; use OCA\Theming\Util;
use OCP\Accounts\IAccountManager; use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager; use OCP\App\IAppManager;
use OCP\AppFramework\QueryException;
use OCP\Authentication\LoginCredentials\IStore; use OCP\Authentication\LoginCredentials\IStore;
use OCP\Collaboration\AutoComplete\IManager; use OCP\Collaboration\AutoComplete\IManager;
use OCP\Contacts\ContactsMenu\IActionFactory; use OCP\Contacts\ContactsMenu\IActionFactory;
...@@ -158,9 +159,11 @@ use OCP\Group\Events\UserAddedEvent; ...@@ -158,9 +159,11 @@ use OCP\Group\Events\UserAddedEvent;
use OCP\Group\Events\UserRemovedEvent; use OCP\Group\Events\UserRemovedEvent;
use OCP\Group\ISubAdmin; use OCP\Group\ISubAdmin;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IContainer;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\IInitialStateService; use OCP\IInitialStateService;
use OCP\IL10N; use OCP\IL10N;
use OCP\ILogger;
use OCP\IServerContainer; use OCP\IServerContainer;
use OCP\ITempManager; use OCP\ITempManager;
use OCP\IUser; use OCP\IUser;
...@@ -2179,4 +2182,18 @@ class Server extends ServerContainer implements IServerContainer { ...@@ -2179,4 +2182,18 @@ class Server extends ServerContainer implements IServerContainer {
public function getGeneratorHelper() { public function getGeneratorHelper() {
return $this->query(\OC\Preview\GeneratorHelper::class); 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);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment