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
$share = \OC::$server->getShareManager()->getShareByToken($token);
$share = \OC::$server->get(\OCP\Share\IManager::class)->getShareByToken($token);
if (!PublicController::validateShare($share)) {
return null;
}
// Check if share is password protected
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
if ($session->get('public_link_authenticated_token') !== $token

View File

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

View File

@ -62,7 +62,7 @@ class ImageController extends ApiBase
}
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, [
'Content-Type' => $preview->getMimeType(),
]);

View File

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

View File

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

View File

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

View File

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

View File

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