general: fix use of deprecated get methods

cap
Varun Patil 2022-12-04 09:57:31 -08:00
parent 355b74e19b
commit d9c6d0a597
8 changed files with 9 additions and 9 deletions

View File

@ -232,14 +232,14 @@ class ApiBase extends Controller
} }
// Get share by token // Get share by token
$share = \OC::$server->getShareManager()->getShareByToken($token); $share = \OC::$server->get(\OCP\Share\IManager::class)->getShareByToken($token);
if (!PublicController::validateShare($share)) { if (!PublicController::validateShare($share)) {
return null; return null;
} }
// Check if share is password protected // Check if share is password protected
if (($password = $share->getPassword()) !== null) { if (($password = $share->getPassword()) !== null) {
$session = \OC::$server->getSession(); $session = \OC::$server->get(\OCP\ISession::class);
// https://github.com/nextcloud/server/blob/0447b53bda9fe95ea0cbed765aa332584605d652/lib/public/AppFramework/PublicShareController.php#L119 // https://github.com/nextcloud/server/blob/0447b53bda9fe95ea0cbed765aa332584605d652/lib/public/AppFramework/PublicShareController.php#L119
if ($session->get('public_link_authenticated_token') !== $token if ($session->get('public_link_authenticated_token') !== $token

View File

@ -96,7 +96,7 @@ class FacesController extends ApiBase
} }
// Get preview manager // Get preview manager
$previewManager = \OC::$server->getPreviewManager(); $previewManager = \OC::$server->get(\OCP\IPreview::class);
// Find the first detection that has a preview // Find the first detection that has a preview
/** @var \Imagick */ /** @var \Imagick */

View File

@ -62,7 +62,7 @@ class ImageController extends ApiBase
} }
try { try {
$preview = \OC::$server->getPreviewManager()->getPreview($file, $x, $y, !$a, $mode); $preview = \OC::$server->get(\OCP\IPreview::class)->getPreview($file, $x, $y, !$a, $mode);
$response = new FileDisplayResponse($preview, Http::STATUS_OK, [ $response = new FileDisplayResponse($preview, Http::STATUS_OK, [
'Content-Type' => $preview->getMimeType(), 'Content-Type' => $preview->getMimeType(),
]); ]);

View File

@ -144,7 +144,7 @@ class PublicController extends AuthPublicShareController
} }
// Get user manager // Get user manager
$userManager = \OC::$server->getUserManager(); $userManager = \OC::$server->get(IUserManager::class);
// Check if share read is allowed // Check if share read is allowed
if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { if (!($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) {

View File

@ -201,7 +201,7 @@ trait TimelineQueryAlbums
private function collaboratorsTable() private function collaboratorsTable()
{ {
// https://github.com/nextcloud/photos/commit/20e3e61ad577014e5f092a292c90a8476f630355 // https://github.com/nextcloud/photos/commit/20e3e61ad577014e5f092a292c90a8476f630355
$appManager = \OC::$server->getAppManager(); $appManager = \OC::$server->get(\OCP\App\IAppManager::class);
$photosVersion = $appManager->getAppVersion('photos'); $photosVersion = $appManager->getAppVersion('photos');
if (version_compare($photosVersion, '2.0.1', '>=')) { if (version_compare($photosVersion, '2.0.1', '>=')) {
return 'photos_albums_collabs'; return 'photos_albums_collabs';

View File

@ -20,7 +20,7 @@ class TimelineWrite
public function __construct(IDBConnection $connection) public function __construct(IDBConnection $connection)
{ {
$this->connection = $connection; $this->connection = $connection;
$this->preview = \OC::$server->getPreviewManager(); $this->preview = \OC::$server->get(IPreview::class);
$this->livePhoto = new LivePhoto($connection); $this->livePhoto = new LivePhoto($connection);
} }

View File

@ -286,7 +286,7 @@ class Exif
private static function getExiftool() private static function getExiftool()
{ {
$configKey = 'memories.exiftool'; $configKey = 'memories.exiftool';
$config = \OC::$server->getConfig(); $config = \OC::$server->get(IConfig::class);
$configPath = $config->getSystemValue($configKey); $configPath = $config->getSystemValue($configKey);
$noLocal = $config->getSystemValue($configKey.'_no_local', false); $noLocal = $config->getSystemValue($configKey.'_no_local', false);

View File

@ -112,7 +112,7 @@ class Util
*/ */
public static function isEncryptionEnabled(): bool public static function isEncryptionEnabled(): bool
{ {
$encryptionManager = \OC::$server->getEncryptionManager(); $encryptionManager = \OC::$server->get(\OCP\Encryption\IManager::class);
if ($encryptionManager->isEnabled()) { if ($encryptionManager->isEnabled()) {
// Server-side encryption (OC_DEFAULT_MODULE) is okay, others like e2e are not // Server-side encryption (OC_DEFAULT_MODULE) is okay, others like e2e are not
return 'OC_DEFAULT_MODULE' !== $encryptionManager->getDefaultEncryptionModuleId(); return 'OC_DEFAULT_MODULE' !== $encryptionManager->getDefaultEncryptionModuleId();