summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2023-06-06 11:09:24 +0200
committerChristoph Wurst <ChristophWurst@users.noreply.github.com>2023-07-06 15:21:22 +0200
commit14719110b9c795a95b23c2278168b9d6123b1a62 (patch)
tree9919ba8c849e3397e23e46ad9f1fdc3f951d3a7f /lib/private/legacy
parent5538a40029da60547798ae6f9e11179c4ee4a642 (diff)
downloadnextcloud-server-14719110b9c795a95b23c2278168b9d6123b1a62.tar.gz
nextcloud-server-14719110b9c795a95b23c2278168b9d6123b1a62.zip
chore: Replace \OC::$server->query with \OCP\Server::get in /lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/OC_App.php12
-rw-r--r--lib/private/legacy/OC_Files.php2
-rw-r--r--lib/private/legacy/OC_Template.php2
-rw-r--r--lib/private/legacy/template/functions.php2
4 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index a1aeb50bbf4..9337492e775 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -52,7 +52,6 @@ declare(strict_types=1);
*/
use OCP\App\Events\AppUpdateEvent;
-use OCP\AppFramework\QueryException;
use OCP\App\IAppManager;
use OCP\App\ManagerEvent;
use OCP\Authentication\IAlternativeLogin;
@@ -65,6 +64,7 @@ use OC\DB\MigrationService;
use OC\Installer;
use OC\Repair;
use OC\Repair\Events\RepairErrorEvent;
+use Psr\Container\ContainerExceptionInterface;
use Psr\Log\LoggerInterface;
/**
@@ -255,7 +255,7 @@ class OC_App {
array $groups = []) {
// Check if app is already downloaded
/** @var Installer $installer */
- $installer = \OC::$server->query(Installer::class);
+ $installer = \OCP\Server::get(Installer::class);
$isDownloaded = $installer->isDownloaded($appId);
if (!$isDownloaded) {
@@ -463,7 +463,7 @@ class OC_App {
*/
public static function getAlternativeLogIns(): array {
/** @var Coordinator $bootstrapCoordinator */
- $bootstrapCoordinator = \OC::$server->query(Coordinator::class);
+ $bootstrapCoordinator = \OCP\Server::get(Coordinator::class);
foreach ($bootstrapCoordinator->getRegistrationContext()->getAlternativeLogins() as $registration) {
if (!in_array(IAlternativeLogin::class, class_implements($registration->getService()), true)) {
@@ -477,8 +477,8 @@ class OC_App {
try {
/** @var IAlternativeLogin $provider */
- $provider = \OC::$server->query($registration->getService());
- } catch (QueryException $e) {
+ $provider = \OCP\Server::get($registration->getService());
+ } catch (ContainerExceptionInterface $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'Alternative login option {option} can not be initialised.',
'option' => $registration->getService(),
@@ -543,7 +543,7 @@ class OC_App {
*/
public function getSupportedApps(): array {
/** @var \OCP\Support\Subscription\IRegistry $subscriptionRegistry */
- $subscriptionRegistry = \OC::$server->query(\OCP\Support\Subscription\IRegistry::class);
+ $subscriptionRegistry = \OCP\Server::get(\OCP\Support\Subscription\IRegistry::class);
$supportedApps = $subscriptionRegistry->delegateGetSupportedApps();
return $supportedApps;
}
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index b6c45e164ef..7bc1fab94b6 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -333,7 +333,7 @@ class OC_Files {
$rangeArray = self::parseHttpRangeHeader(substr($params['range'], 6), $fileSize);
}
- $dispatcher = \OC::$server->query(IEventDispatcher::class);
+ $dispatcher = \OCP\Server::get(IEventDispatcher::class);
$event = new BeforeDirectFileDownloadEvent($filename);
$dispatcher->dispatchTyped($event);
diff --git a/lib/private/legacy/OC_Template.php b/lib/private/legacy/OC_Template.php
index 0c9fa1ccc0c..70477ea6a06 100644
--- a/lib/private/legacy/OC_Template.php
+++ b/lib/private/legacy/OC_Template.php
@@ -83,7 +83,7 @@ class OC_Template extends \OC\Template\Base {
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
$l10n = \OC::$server->getL10N($parts[0]);
/** @var \OCP\Defaults $themeDefaults */
- $themeDefaults = \OC::$server->query(\OCP\Defaults::class);
+ $themeDefaults = \OCP\Server::get(\OCP\Defaults::class);
[$path, $template] = $this->findTemplate($theme, $app, $name);
diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php
index 7081bd4f743..57c3a834128 100644
--- a/lib/private/legacy/template/functions.php
+++ b/lib/private/legacy/template/functions.php
@@ -308,7 +308,7 @@ function strip_time($timestamp) {
*/
function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) {
/** @var \OC\DateTimeFormatter $formatter */
- $formatter = \OC::$server->query('DateTimeFormatter');
+ $formatter = \OCP\Server::get('DateTimeFormatter');
if ($dateOnly) {
return $formatter->formatDateSpan($timestamp, $fromTime);