Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up (many) deprecated functions #40083

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dav/appinfo/v1/caldav.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
\OC::$server->getShareManager(),
\OC::$server->getUserSession(),
\OC::$server->getAppManager(),
\OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
\OC::$server->getConfig(),
\OC::$server->getL10NFactory(),
Expand Down Expand Up @@ -113,7 +113,7 @@
$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class)));

if ($sendInvitations) {
$server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
$server->addPlugin(\OC::$server->get(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
}
$server->addPlugin(new ExceptionLoggerPlugin('caldav', $logger));

Expand Down
7 changes: 4 additions & 3 deletions apps/dav/appinfo/v1/carddav.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
use OCA\DAV\Connector\Sabre\Principal;
use OCP\Accounts\IAccountManager;
use OCP\App\IAppManager;
use OCP\Files\AppData\IAppDataFactory;
use Psr\Log\LoggerInterface;
use Sabre\CardDAV\Plugin;

Expand All @@ -57,7 +58,7 @@
\OC::$server->getShareManager(),
\OC::$server->getUserSession(),
\OC::$server->getAppManager(),
\OC::$server->query(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(\OCA\DAV\CalDAV\Proxy\ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
\OC::$server->getConfig(),
\OC::$server->getL10NFactory(),
Expand All @@ -72,7 +73,7 @@
$principalCollection = new \Sabre\CalDAV\Principal\Collection($principalBackend);
$principalCollection->disableListing = !$debugging; // Disable listing

$pluginManager = new PluginManager(\OC::$server, \OC::$server->query(IAppManager::class));
$pluginManager = new PluginManager(\OC::$server, \OC::$server->get(IAppManager::class));
$addressBookRoot = new AddressBookRoot($principalBackend, $cardDavBackend, $pluginManager, \OC::$server->getUserSession()->getUser(), \OC::$server->get(\OCP\IGroupManager::class));
$addressBookRoot->disableListing = !$debugging; // Disable listing

Expand All @@ -99,7 +100,7 @@
$server->addPlugin(new \Sabre\DAV\Sync\Plugin());
$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
$server->addPlugin(new \OCA\DAV\CardDAV\ImageExportPlugin(new \OCA\DAV\CardDAV\PhotoCache(
\OC::$server->getAppDataDir('dav-photocache'),
\OC::$server->get(IAppDataFactory::class)->get('dav-photocache'),
\OC::$server->get(LoggerInterface::class)
)));
$server->addPlugin(new ExceptionLoggerPlugin('carddav', \OC::$server->get(LoggerInterface::class)));
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/appinfo/v1/publicwebdav.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) {
$isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest');
/** @var \OCA\FederatedFileSharing\FederatedShareProvider $shareProvider */
$federatedShareProvider = \OC::$server->query(\OCA\FederatedFileSharing\FederatedShareProvider::class);
$federatedShareProvider = \OC::$server->get(\OCA\FederatedFileSharing\FederatedShareProvider::class);
if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false && !$isAjax) {
// this is what is thrown when trying to access a non-existing share
throw new \Sabre\DAV\Exception\NotAuthenticated();
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/appinfo/v2/direct.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
$requestUri = \OC::$server->getRequest()->getRequestUri();

/** @var ServerFactory $serverFactory */
$serverFactory = \OC::$server->query(ServerFactory::class);
$serverFactory = \OC::$server->get(ServerFactory::class);
$server = $serverFactory->createServer(
$baseuri,
$requestUri,
\OC::$server->getRootFolder(),
\OC::$server->query(\OCA\DAV\Db\DirectMapper::class),
\OC::$server->query(\OCP\AppFramework\Utility\ITimeFactory::class),
\OC::$server->get(\OCA\DAV\Db\DirectMapper::class),
\OC::$server->get(\OCP\AppFramework\Utility\ITimeFactory::class),
\OC::$server->getBruteForceThrottler(),
\OC::$server->getRequest()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(bool $public = true) {
$baseUri = \OC::$WEBROOT . '/remote.php/dav/';
$logger = \OC::$server->get(LoggerInterface::class);
/** @var IEventDispatcher $dispatcher */
$dispatcher = \OC::$server->query(IEventDispatcher::class);
$dispatcher = \OC::$server->get(IEventDispatcher::class);

$root = new RootCollection();
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getProvider(string $type):INotificationProvider {
* @throws \OCP\AppFramework\QueryException
*/
public function registerProvider(string $providerClassName):void {
$provider = \OC::$server->query($providerClassName);
$provider = \OC::$server->get($providerClassName);

if (!$provider instanceof INotificationProvider) {
throw new \InvalidArgumentException('Invalid notification provider registered');
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Command/CreateCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
\OC::$server->getShareManager(),
\OC::$server->getUserSession(),
\OC::$server->getAppManager(),
\OC::$server->query(ProxyMapper::class),
\OC::$server->get(ProxyMapper::class),
\OC::$server->get(KnownUserService::class),
\OC::$server->getConfig(),
\OC::$server->getL10NFactory(),
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/RootCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct() {
$db = \OC::$server->getDatabaseConnection();
$dispatcher = \OC::$server->get(IEventDispatcher::class);
$config = \OC::$server->get(IConfig::class);
$proxyMapper = \OC::$server->query(ProxyMapper::class);
$proxyMapper = \OC::$server->get(ProxyMapper::class);
$rootFolder = \OCP\Server::get(IRootFolder::class);

$userPrincipalBackend = new Principal(
Expand Down Expand Up @@ -143,7 +143,7 @@ public function __construct() {
$logger
);

$pluginManager = new PluginManager(\OC::$server, \OC::$server->query(IAppManager::class));
$pluginManager = new PluginManager(\OC::$server, \OC::$server->get(IAppManager::class));
$usersCardDavBackend = new CardDavBackend($db, $userPrincipalBackend, $userManager, $groupManager, $dispatcher);
$usersAddressBookRoot = new AddressBookRoot($userPrincipalBackend, $usersCardDavBackend, $pluginManager, $userSession->getUser(), $groupManager, 'principals/users');
$usersAddressBookRoot->disableListing = $disableListing;
Expand All @@ -155,14 +155,14 @@ public function __construct() {
$uploadCollection = new Upload\RootCollection(
$userPrincipalBackend,
'principals/users',
\OC::$server->query(CleanupService::class));
\OC::$server->get(CleanupService::class));
$uploadCollection->disableListing = $disableListing;

$avatarCollection = new Avatars\RootCollection($userPrincipalBackend, 'principals/users');
$avatarCollection->disableListing = $disableListing;

$appleProvisioning = new AppleProvisioningNode(
\OC::$server->query(ITimeFactory::class));
\OC::$server->get(ITimeFactory::class));

$children = [
new SimpleCollection('principals', [
Expand Down
7 changes: 4 additions & 3 deletions apps/dav/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
use OCP\AppFramework\Http\Response;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\AppData\IAppDataFactory;
use OCP\ICacheFactory;
use OCP\IRequest;
use OCP\Profiler\IProfiler;
Expand Down Expand Up @@ -177,7 +178,7 @@ public function __construct(IRequest $request, string $baseUri) {
$this->server->addPlugin(new \OCA\DAV\CalDAV\ICSExportPlugin\ICSExportPlugin(\OC::$server->getConfig(), $logger));
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin(\OC::$server->getConfig(), \OC::$server->get(LoggerInterface::class)));
if (\OC::$server->getConfig()->getAppValue('dav', 'sendInvitations', 'yes') === 'yes') {
$this->server->addPlugin(\OC::$server->query(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
$this->server->addPlugin(\OC::$server->get(\OCA\DAV\CalDAV\Schedule\IMipPlugin::class));
}

$this->server->addPlugin(\OC::$server->get(\OCA\DAV\CalDAV\Trashbin\Plugin::class));
Expand All @@ -202,7 +203,7 @@ public function __construct(IRequest $request, string $baseUri) {
$this->server->addPlugin(new MultiGetExportPlugin());
$this->server->addPlugin(new HasPhotoPlugin());
$this->server->addPlugin(new ImageExportPlugin(new PhotoCache(
\OC::$server->getAppDataDir('dav-photocache'),
\OC::$server->get(IAppDataFactory::class)->get('dav-photocache'),
$logger)
));
}
Expand Down Expand Up @@ -327,7 +328,7 @@ public function __construct(IRequest $request, string $baseUri) {
}
$this->server->addPlugin(new \OCA\DAV\CalDAV\BirthdayCalendar\EnablePlugin(
\OC::$server->getConfig(),
\OC::$server->query(BirthdayService::class)
\OC::$server->get(BirthdayService::class)
));
$this->server->addPlugin(new AppleProvisioningPlugin(
\OC::$server->getUserSession(),
Expand Down
14 changes: 7 additions & 7 deletions apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function dataFilters() {
* @param string $filterClass
*/
public function testImplementsInterface($filterClass): void {
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertInstanceOf(IFilter::class, $filter);
}

Expand All @@ -54,7 +54,7 @@ public function testImplementsInterface($filterClass): void {
*/
public function testGetIdentifier($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertIsString($filter->getIdentifier());
}

Expand All @@ -64,7 +64,7 @@ public function testGetIdentifier($filterClass): void {
*/
public function testGetName($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertIsString($filter->getName());
}

Expand All @@ -74,7 +74,7 @@ public function testGetName($filterClass): void {
*/
public function testGetPriority($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$priority = $filter->getPriority();
$this->assertIsInt($filter->getPriority());
$this->assertGreaterThanOrEqual(0, $priority);
Expand All @@ -87,7 +87,7 @@ public function testGetPriority($filterClass): void {
*/
public function testGetIcon($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertIsString($filter->getIcon());
$this->assertStringStartsWith('http', $filter->getIcon());
}
Expand All @@ -98,7 +98,7 @@ public function testGetIcon($filterClass): void {
*/
public function testFilterTypes($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertIsArray($filter->filterTypes([]));
}

Expand All @@ -108,7 +108,7 @@ public function testFilterTypes($filterClass): void {
*/
public function testAllowedApps($filterClass): void {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$filter = \OC::$server->get($filterClass);
$this->assertIsArray($filter->allowedApps());
}
}
16 changes: 8 additions & 8 deletions apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function dataSettings() {
* @param string $settingClass
*/
public function testImplementsInterface($settingClass): void {
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertInstanceOf(ISetting::class, $setting);
}

Expand All @@ -53,7 +53,7 @@ public function testImplementsInterface($settingClass): void {
*/
public function testGetIdentifier($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsString($setting->getIdentifier());
}

Expand All @@ -63,7 +63,7 @@ public function testGetIdentifier($settingClass): void {
*/
public function testGetName($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsString($setting->getName());
}

Expand All @@ -73,7 +73,7 @@ public function testGetName($settingClass): void {
*/
public function testGetPriority($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$priority = $setting->getPriority();
$this->assertIsInt($setting->getPriority());
$this->assertGreaterThanOrEqual(0, $priority);
Expand All @@ -86,7 +86,7 @@ public function testGetPriority($settingClass): void {
*/
public function testCanChangeStream($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsBool($setting->canChangeStream());
}

Expand All @@ -96,7 +96,7 @@ public function testCanChangeStream($settingClass): void {
*/
public function testIsDefaultEnabledStream($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsBool($setting->isDefaultEnabledStream());
}

Expand All @@ -106,7 +106,7 @@ public function testIsDefaultEnabledStream($settingClass): void {
*/
public function testCanChangeMail($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsBool($setting->canChangeMail());
}

Expand All @@ -116,7 +116,7 @@ public function testCanChangeMail($settingClass): void {
*/
public function testIsDefaultEnabledMail($settingClass): void {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$setting = \OC::$server->get($settingClass);
$this->assertIsBool($setting->isDefaultEnabledMail());
}
}
2 changes: 1 addition & 1 deletion apps/encryption/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$encryptionSystemReady = $encryptionManager->isReady();

/** @var Application $app */
$app = \OC::$server->query(Application::class);
$app = \OC::$server->get(Application::class);
if ($encryptionSystemReady) {
$app->registerEncryptionModule($encryptionManager);
$app->registerHooks(\OC::$server->getConfig());
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Command/ScanAppData.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected function scanFiles(OutputInterface $output, string $folder): int {
$scanner = new \OC\Files\Utils\Scanner(
null,
new ConnectionAdapter($connection),
\OC::$server->query(IEventDispatcher::class),
\OC::$server->get(IEventDispatcher::class),
\OC::$server->get(LoggerInterface::class)
);

Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Controller/ViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function __construct(string $appName,
*/
protected function renderScript($appName, $scriptName) {
$content = '';
$appPath = \OC_App::getAppPath($appName);
$appPath = \OC::$server->get(IAppManager::class)->getAppPath($appName);
$scriptPath = $appPath . '/' . $scriptName;
if (file_exists($scriptPath)) {
// TODO: sanitize path / script name ?
Expand Down
Loading