@@ -33,16 +33,16 @@ |
||
33 | 33 | use OCP\Contacts\Events\ContactInteractedWithEvent; |
34 | 34 | |
35 | 35 | class Application extends App implements IBootstrap { |
36 | - public const APP_ID = 'contactsinteraction'; |
|
36 | + public const APP_ID = 'contactsinteraction'; |
|
37 | 37 | |
38 | - public function __construct() { |
|
39 | - parent::__construct(self::APP_ID); |
|
40 | - } |
|
38 | + public function __construct() { |
|
39 | + parent::__construct(self::APP_ID); |
|
40 | + } |
|
41 | 41 | |
42 | - public function register(IRegistrationContext $context): void { |
|
43 | - $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class); |
|
44 | - } |
|
42 | + public function register(IRegistrationContext $context): void { |
|
43 | + $context->registerEventListener(ContactInteractedWithEvent::class, ContactInteractionListener::class); |
|
44 | + } |
|
45 | 45 | |
46 | - public function boot(IBootContext $context): void { |
|
47 | - } |
|
46 | + public function boot(IBootContext $context): void { |
|
47 | + } |
|
48 | 48 | } |
@@ -33,84 +33,84 @@ |
||
33 | 33 | * Delete all file entries that have no matching entries in the storage table. |
34 | 34 | */ |
35 | 35 | class DeleteOrphanedFiles extends Command { |
36 | - public const CHUNK_SIZE = 200; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var IDBConnection |
|
40 | - */ |
|
41 | - protected $connection; |
|
42 | - |
|
43 | - public function __construct(IDBConnection $connection) { |
|
44 | - $this->connection = $connection; |
|
45 | - parent::__construct(); |
|
46 | - } |
|
47 | - |
|
48 | - protected function configure() { |
|
49 | - $this |
|
50 | - ->setName('files:cleanup') |
|
51 | - ->setDescription('cleanup filecache'); |
|
52 | - } |
|
53 | - |
|
54 | - public function execute(InputInterface $input, OutputInterface $output): int { |
|
55 | - $deletedEntries = 0; |
|
56 | - |
|
57 | - $query = $this->connection->getQueryBuilder(); |
|
58 | - $query->select('fc.fileid') |
|
59 | - ->from('filecache', 'fc') |
|
60 | - ->where($query->expr()->isNull('s.numeric_id')) |
|
61 | - ->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id')) |
|
62 | - ->setMaxResults(self::CHUNK_SIZE); |
|
63 | - |
|
64 | - $deleteQuery = $this->connection->getQueryBuilder(); |
|
65 | - $deleteQuery->delete('filecache') |
|
66 | - ->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid'))); |
|
67 | - |
|
68 | - $deletedInLastChunk = self::CHUNK_SIZE; |
|
69 | - while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
70 | - $deletedInLastChunk = 0; |
|
71 | - $result = $query->execute(); |
|
72 | - while ($row = $result->fetch()) { |
|
73 | - $deletedInLastChunk++; |
|
74 | - $deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid']) |
|
75 | - ->execute(); |
|
76 | - } |
|
77 | - $result->closeCursor(); |
|
78 | - } |
|
79 | - |
|
80 | - $output->writeln("$deletedEntries orphaned file cache entries deleted"); |
|
81 | - |
|
82 | - $deletedMounts = $this->cleanupOrphanedMounts(); |
|
83 | - $output->writeln("$deletedMounts orphaned mount entries deleted"); |
|
84 | - return 0; |
|
85 | - } |
|
86 | - |
|
87 | - private function cleanupOrphanedMounts() { |
|
88 | - $deletedEntries = 0; |
|
89 | - |
|
90 | - $query = $this->connection->getQueryBuilder(); |
|
91 | - $query->select('m.storage_id') |
|
92 | - ->from('mounts', 'm') |
|
93 | - ->where($query->expr()->isNull('s.numeric_id')) |
|
94 | - ->leftJoin('m', 'storages', 's', $query->expr()->eq('m.storage_id', 's.numeric_id')) |
|
95 | - ->groupBy('storage_id') |
|
96 | - ->setMaxResults(self::CHUNK_SIZE); |
|
97 | - |
|
98 | - $deleteQuery = $this->connection->getQueryBuilder(); |
|
99 | - $deleteQuery->delete('mounts') |
|
100 | - ->where($deleteQuery->expr()->eq('storage_id', $deleteQuery->createParameter('storageid'))); |
|
101 | - |
|
102 | - $deletedInLastChunk = self::CHUNK_SIZE; |
|
103 | - while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
104 | - $deletedInLastChunk = 0; |
|
105 | - $result = $query->execute(); |
|
106 | - while ($row = $result->fetch()) { |
|
107 | - $deletedInLastChunk++; |
|
108 | - $deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id']) |
|
109 | - ->execute(); |
|
110 | - } |
|
111 | - $result->closeCursor(); |
|
112 | - } |
|
113 | - |
|
114 | - return $deletedEntries; |
|
115 | - } |
|
36 | + public const CHUNK_SIZE = 200; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var IDBConnection |
|
40 | + */ |
|
41 | + protected $connection; |
|
42 | + |
|
43 | + public function __construct(IDBConnection $connection) { |
|
44 | + $this->connection = $connection; |
|
45 | + parent::__construct(); |
|
46 | + } |
|
47 | + |
|
48 | + protected function configure() { |
|
49 | + $this |
|
50 | + ->setName('files:cleanup') |
|
51 | + ->setDescription('cleanup filecache'); |
|
52 | + } |
|
53 | + |
|
54 | + public function execute(InputInterface $input, OutputInterface $output): int { |
|
55 | + $deletedEntries = 0; |
|
56 | + |
|
57 | + $query = $this->connection->getQueryBuilder(); |
|
58 | + $query->select('fc.fileid') |
|
59 | + ->from('filecache', 'fc') |
|
60 | + ->where($query->expr()->isNull('s.numeric_id')) |
|
61 | + ->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id')) |
|
62 | + ->setMaxResults(self::CHUNK_SIZE); |
|
63 | + |
|
64 | + $deleteQuery = $this->connection->getQueryBuilder(); |
|
65 | + $deleteQuery->delete('filecache') |
|
66 | + ->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid'))); |
|
67 | + |
|
68 | + $deletedInLastChunk = self::CHUNK_SIZE; |
|
69 | + while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
70 | + $deletedInLastChunk = 0; |
|
71 | + $result = $query->execute(); |
|
72 | + while ($row = $result->fetch()) { |
|
73 | + $deletedInLastChunk++; |
|
74 | + $deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid']) |
|
75 | + ->execute(); |
|
76 | + } |
|
77 | + $result->closeCursor(); |
|
78 | + } |
|
79 | + |
|
80 | + $output->writeln("$deletedEntries orphaned file cache entries deleted"); |
|
81 | + |
|
82 | + $deletedMounts = $this->cleanupOrphanedMounts(); |
|
83 | + $output->writeln("$deletedMounts orphaned mount entries deleted"); |
|
84 | + return 0; |
|
85 | + } |
|
86 | + |
|
87 | + private function cleanupOrphanedMounts() { |
|
88 | + $deletedEntries = 0; |
|
89 | + |
|
90 | + $query = $this->connection->getQueryBuilder(); |
|
91 | + $query->select('m.storage_id') |
|
92 | + ->from('mounts', 'm') |
|
93 | + ->where($query->expr()->isNull('s.numeric_id')) |
|
94 | + ->leftJoin('m', 'storages', 's', $query->expr()->eq('m.storage_id', 's.numeric_id')) |
|
95 | + ->groupBy('storage_id') |
|
96 | + ->setMaxResults(self::CHUNK_SIZE); |
|
97 | + |
|
98 | + $deleteQuery = $this->connection->getQueryBuilder(); |
|
99 | + $deleteQuery->delete('mounts') |
|
100 | + ->where($deleteQuery->expr()->eq('storage_id', $deleteQuery->createParameter('storageid'))); |
|
101 | + |
|
102 | + $deletedInLastChunk = self::CHUNK_SIZE; |
|
103 | + while ($deletedInLastChunk === self::CHUNK_SIZE) { |
|
104 | + $deletedInLastChunk = 0; |
|
105 | + $result = $query->execute(); |
|
106 | + while ($row = $result->fetch()) { |
|
107 | + $deletedInLastChunk++; |
|
108 | + $deletedEntries += $deleteQuery->setParameter('storageid', (int) $row['storage_id']) |
|
109 | + ->execute(); |
|
110 | + } |
|
111 | + $result->closeCursor(); |
|
112 | + } |
|
113 | + |
|
114 | + return $deletedEntries; |
|
115 | + } |
|
116 | 116 | } |
@@ -33,16 +33,16 @@ |
||
33 | 33 | use OCP\AppFramework\Bootstrap\IRegistrationContext; |
34 | 34 | |
35 | 35 | class Application extends App implements IBootstrap { |
36 | - public const APP_ID = 'cloud_federation_api'; |
|
36 | + public const APP_ID = 'cloud_federation_api'; |
|
37 | 37 | |
38 | - public function __construct() { |
|
39 | - parent::__construct(self::APP_ID); |
|
40 | - } |
|
38 | + public function __construct() { |
|
39 | + parent::__construct(self::APP_ID); |
|
40 | + } |
|
41 | 41 | |
42 | - public function register(IRegistrationContext $context): void { |
|
43 | - $context->registerCapability(Capabilities::class); |
|
44 | - } |
|
42 | + public function register(IRegistrationContext $context): void { |
|
43 | + $context->registerCapability(Capabilities::class); |
|
44 | + } |
|
45 | 45 | |
46 | - public function boot(IBootContext $context): void { |
|
47 | - } |
|
46 | + public function boot(IBootContext $context): void { |
|
47 | + } |
|
48 | 48 | } |
@@ -32,72 +32,72 @@ |
||
32 | 32 | * Legacy compatibility for OCA\Files_External\MountConfig::registerBackend() |
33 | 33 | */ |
34 | 34 | class LegacyBackend extends Backend { |
35 | - use LegacyDependencyCheckPolyfill { |
|
36 | - LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies; |
|
37 | - } |
|
35 | + use LegacyDependencyCheckPolyfill { |
|
36 | + LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies; |
|
37 | + } |
|
38 | 38 | |
39 | - /** @var bool */ |
|
40 | - protected $hasDependencies = false; |
|
39 | + /** @var bool */ |
|
40 | + protected $hasDependencies = false; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param string $class |
|
44 | - * @param array $definition |
|
45 | - * @param Builtin $authMechanism |
|
46 | - */ |
|
47 | - public function __construct($class, array $definition, Builtin $authMechanism) { |
|
48 | - $this |
|
49 | - ->setIdentifier($class) |
|
50 | - ->setStorageClass($class) |
|
51 | - ->setText($definition['backend']) |
|
52 | - ->addAuthScheme(Builtin::SCHEME_BUILTIN) |
|
53 | - ->setLegacyAuthMechanism($authMechanism) |
|
54 | - ; |
|
42 | + /** |
|
43 | + * @param string $class |
|
44 | + * @param array $definition |
|
45 | + * @param Builtin $authMechanism |
|
46 | + */ |
|
47 | + public function __construct($class, array $definition, Builtin $authMechanism) { |
|
48 | + $this |
|
49 | + ->setIdentifier($class) |
|
50 | + ->setStorageClass($class) |
|
51 | + ->setText($definition['backend']) |
|
52 | + ->addAuthScheme(Builtin::SCHEME_BUILTIN) |
|
53 | + ->setLegacyAuthMechanism($authMechanism) |
|
54 | + ; |
|
55 | 55 | |
56 | - foreach ($definition['configuration'] as $name => $placeholder) { |
|
57 | - $flags = DefinitionParameter::FLAG_NONE; |
|
58 | - $type = DefinitionParameter::VALUE_TEXT; |
|
59 | - if ($placeholder[0] === '&') { |
|
60 | - $flags = DefinitionParameter::FLAG_OPTIONAL; |
|
61 | - $placeholder = substr($placeholder, 1); |
|
62 | - } |
|
63 | - switch ($placeholder[0]) { |
|
64 | - case '!': |
|
65 | - $type = DefinitionParameter::VALUE_BOOLEAN; |
|
66 | - $placeholder = substr($placeholder, 1); |
|
67 | - break; |
|
68 | - case '*': |
|
69 | - $type = DefinitionParameter::VALUE_PASSWORD; |
|
70 | - $placeholder = substr($placeholder, 1); |
|
71 | - break; |
|
72 | - case '#': |
|
73 | - $type = DefinitionParameter::VALUE_HIDDEN; |
|
74 | - $placeholder = substr($placeholder, 1); |
|
75 | - break; |
|
76 | - } |
|
77 | - $this->addParameter((new DefinitionParameter($name, $placeholder)) |
|
78 | - ->setType($type) |
|
79 | - ->setFlags($flags) |
|
80 | - ); |
|
81 | - } |
|
56 | + foreach ($definition['configuration'] as $name => $placeholder) { |
|
57 | + $flags = DefinitionParameter::FLAG_NONE; |
|
58 | + $type = DefinitionParameter::VALUE_TEXT; |
|
59 | + if ($placeholder[0] === '&') { |
|
60 | + $flags = DefinitionParameter::FLAG_OPTIONAL; |
|
61 | + $placeholder = substr($placeholder, 1); |
|
62 | + } |
|
63 | + switch ($placeholder[0]) { |
|
64 | + case '!': |
|
65 | + $type = DefinitionParameter::VALUE_BOOLEAN; |
|
66 | + $placeholder = substr($placeholder, 1); |
|
67 | + break; |
|
68 | + case '*': |
|
69 | + $type = DefinitionParameter::VALUE_PASSWORD; |
|
70 | + $placeholder = substr($placeholder, 1); |
|
71 | + break; |
|
72 | + case '#': |
|
73 | + $type = DefinitionParameter::VALUE_HIDDEN; |
|
74 | + $placeholder = substr($placeholder, 1); |
|
75 | + break; |
|
76 | + } |
|
77 | + $this->addParameter((new DefinitionParameter($name, $placeholder)) |
|
78 | + ->setType($type) |
|
79 | + ->setFlags($flags) |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | |
83 | - if (isset($definition['priority'])) { |
|
84 | - $this->setPriority($definition['priority']); |
|
85 | - } |
|
86 | - if (isset($definition['custom'])) { |
|
87 | - $this->addCustomJs($definition['custom']); |
|
88 | - } |
|
89 | - if (isset($definition['has_dependencies']) && $definition['has_dependencies']) { |
|
90 | - $this->hasDependencies = true; |
|
91 | - } |
|
92 | - } |
|
83 | + if (isset($definition['priority'])) { |
|
84 | + $this->setPriority($definition['priority']); |
|
85 | + } |
|
86 | + if (isset($definition['custom'])) { |
|
87 | + $this->addCustomJs($definition['custom']); |
|
88 | + } |
|
89 | + if (isset($definition['has_dependencies']) && $definition['has_dependencies']) { |
|
90 | + $this->hasDependencies = true; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * @return MissingDependency[] |
|
96 | - */ |
|
97 | - public function checkDependencies() { |
|
98 | - if ($this->hasDependencies) { |
|
99 | - return $this->doCheckDependencies(); |
|
100 | - } |
|
101 | - return []; |
|
102 | - } |
|
94 | + /** |
|
95 | + * @return MissingDependency[] |
|
96 | + */ |
|
97 | + public function checkDependencies() { |
|
98 | + if ($this->hasDependencies) { |
|
99 | + return $this->doCheckDependencies(); |
|
100 | + } |
|
101 | + return []; |
|
102 | + } |
|
103 | 103 | } |
@@ -40,79 +40,79 @@ |
||
40 | 40 | |
41 | 41 | class Authtokens implements ISettings { |
42 | 42 | |
43 | - /** @var IAuthTokenProvider */ |
|
44 | - private $tokenProvider; |
|
45 | - |
|
46 | - /** @var ISession */ |
|
47 | - private $session; |
|
48 | - |
|
49 | - /** @var IInitialState */ |
|
50 | - private $initialState; |
|
51 | - |
|
52 | - /** @var string|null */ |
|
53 | - private $uid; |
|
54 | - |
|
55 | - /** @var IUserSession */ |
|
56 | - private $userSession; |
|
57 | - |
|
58 | - public function __construct(IAuthTokenProvider $tokenProvider, |
|
59 | - ISession $session, |
|
60 | - IUserSession $userSession, |
|
61 | - IInitialState $initialState, |
|
62 | - ?string $UserId) { |
|
63 | - $this->tokenProvider = $tokenProvider; |
|
64 | - $this->session = $session; |
|
65 | - $this->initialState = $initialState; |
|
66 | - $this->uid = $UserId; |
|
67 | - $this->userSession = $userSession; |
|
68 | - } |
|
69 | - |
|
70 | - public function getForm(): TemplateResponse { |
|
71 | - $this->initialState->provideInitialState( |
|
72 | - 'app_tokens', |
|
73 | - $this->getAppTokens() |
|
74 | - ); |
|
75 | - |
|
76 | - $this->initialState->provideInitialState( |
|
77 | - 'can_create_app_token', |
|
78 | - $this->userSession->getImpersonatingUserID() === null |
|
79 | - ); |
|
80 | - |
|
81 | - return new TemplateResponse('settings', 'settings/personal/security/authtokens'); |
|
82 | - } |
|
83 | - |
|
84 | - public function getSection(): string { |
|
85 | - return 'security'; |
|
86 | - } |
|
87 | - |
|
88 | - public function getPriority(): int { |
|
89 | - return 100; |
|
90 | - } |
|
91 | - |
|
92 | - private function getAppTokens(): array { |
|
93 | - $tokens = $this->tokenProvider->getTokenByUser($this->uid); |
|
94 | - |
|
95 | - try { |
|
96 | - $sessionId = $this->session->getId(); |
|
97 | - } catch (SessionNotAvailableException $ex) { |
|
98 | - return []; |
|
99 | - } |
|
100 | - try { |
|
101 | - $sessionToken = $this->tokenProvider->getToken($sessionId); |
|
102 | - } catch (InvalidTokenException $ex) { |
|
103 | - return []; |
|
104 | - } |
|
105 | - |
|
106 | - return array_map(function (IToken $token) use ($sessionToken) { |
|
107 | - $data = $token->jsonSerialize(); |
|
108 | - $data['canDelete'] = true; |
|
109 | - $data['canRename'] = $token instanceof INamedToken; |
|
110 | - if ($sessionToken->getId() === $token->getId()) { |
|
111 | - $data['canDelete'] = false; |
|
112 | - $data['canRename'] = false; |
|
113 | - $data['current'] = true; |
|
114 | - } |
|
115 | - return $data; |
|
116 | - }, $tokens); |
|
117 | - } |
|
43 | + /** @var IAuthTokenProvider */ |
|
44 | + private $tokenProvider; |
|
45 | + |
|
46 | + /** @var ISession */ |
|
47 | + private $session; |
|
48 | + |
|
49 | + /** @var IInitialState */ |
|
50 | + private $initialState; |
|
51 | + |
|
52 | + /** @var string|null */ |
|
53 | + private $uid; |
|
54 | + |
|
55 | + /** @var IUserSession */ |
|
56 | + private $userSession; |
|
57 | + |
|
58 | + public function __construct(IAuthTokenProvider $tokenProvider, |
|
59 | + ISession $session, |
|
60 | + IUserSession $userSession, |
|
61 | + IInitialState $initialState, |
|
62 | + ?string $UserId) { |
|
63 | + $this->tokenProvider = $tokenProvider; |
|
64 | + $this->session = $session; |
|
65 | + $this->initialState = $initialState; |
|
66 | + $this->uid = $UserId; |
|
67 | + $this->userSession = $userSession; |
|
68 | + } |
|
69 | + |
|
70 | + public function getForm(): TemplateResponse { |
|
71 | + $this->initialState->provideInitialState( |
|
72 | + 'app_tokens', |
|
73 | + $this->getAppTokens() |
|
74 | + ); |
|
75 | + |
|
76 | + $this->initialState->provideInitialState( |
|
77 | + 'can_create_app_token', |
|
78 | + $this->userSession->getImpersonatingUserID() === null |
|
79 | + ); |
|
80 | + |
|
81 | + return new TemplateResponse('settings', 'settings/personal/security/authtokens'); |
|
82 | + } |
|
83 | + |
|
84 | + public function getSection(): string { |
|
85 | + return 'security'; |
|
86 | + } |
|
87 | + |
|
88 | + public function getPriority(): int { |
|
89 | + return 100; |
|
90 | + } |
|
91 | + |
|
92 | + private function getAppTokens(): array { |
|
93 | + $tokens = $this->tokenProvider->getTokenByUser($this->uid); |
|
94 | + |
|
95 | + try { |
|
96 | + $sessionId = $this->session->getId(); |
|
97 | + } catch (SessionNotAvailableException $ex) { |
|
98 | + return []; |
|
99 | + } |
|
100 | + try { |
|
101 | + $sessionToken = $this->tokenProvider->getToken($sessionId); |
|
102 | + } catch (InvalidTokenException $ex) { |
|
103 | + return []; |
|
104 | + } |
|
105 | + |
|
106 | + return array_map(function (IToken $token) use ($sessionToken) { |
|
107 | + $data = $token->jsonSerialize(); |
|
108 | + $data['canDelete'] = true; |
|
109 | + $data['canRename'] = $token instanceof INamedToken; |
|
110 | + if ($sessionToken->getId() === $token->getId()) { |
|
111 | + $data['canDelete'] = false; |
|
112 | + $data['canRename'] = false; |
|
113 | + $data['current'] = true; |
|
114 | + } |
|
115 | + return $data; |
|
116 | + }, $tokens); |
|
117 | + } |
|
118 | 118 | } |
@@ -30,14 +30,14 @@ |
||
30 | 30 | |
31 | 31 | class FederatedShareProviderFactory { |
32 | 32 | |
33 | - /** @var IServerContainer */ |
|
34 | - private $serverContainer; |
|
33 | + /** @var IServerContainer */ |
|
34 | + private $serverContainer; |
|
35 | 35 | |
36 | - public function __construct(IServerContainer $serverContainer) { |
|
37 | - $this->serverContainer = $serverContainer; |
|
38 | - } |
|
36 | + public function __construct(IServerContainer $serverContainer) { |
|
37 | + $this->serverContainer = $serverContainer; |
|
38 | + } |
|
39 | 39 | |
40 | - public function get(): FederatedShareProvider { |
|
41 | - return $this->serverContainer->query(FederatedShareProvider::class); |
|
42 | - } |
|
40 | + public function get(): FederatedShareProvider { |
|
41 | + return $this->serverContainer->query(FederatedShareProvider::class); |
|
42 | + } |
|
43 | 43 | } |
@@ -31,20 +31,20 @@ |
||
31 | 31 | use OCP\EventDispatcher\IEventListener; |
32 | 32 | |
33 | 33 | class LoadAdditionalScriptsListener implements IEventListener { |
34 | - /** @var FederatedShareProvider */ |
|
35 | - protected $federatedShareProvider; |
|
34 | + /** @var FederatedShareProvider */ |
|
35 | + protected $federatedShareProvider; |
|
36 | 36 | |
37 | - public function __construct(FederatedShareProvider $federatedShareProvider) { |
|
38 | - $this->federatedShareProvider = $federatedShareProvider; |
|
39 | - } |
|
37 | + public function __construct(FederatedShareProvider $federatedShareProvider) { |
|
38 | + $this->federatedShareProvider = $federatedShareProvider; |
|
39 | + } |
|
40 | 40 | |
41 | - public function handle(Event $event): void { |
|
42 | - if (!$event instanceof LoadAdditionalScriptsEvent) { |
|
43 | - return; |
|
44 | - } |
|
41 | + public function handle(Event $event): void { |
|
42 | + if (!$event instanceof LoadAdditionalScriptsEvent) { |
|
43 | + return; |
|
44 | + } |
|
45 | 45 | |
46 | - if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled()) { |
|
47 | - \OCP\Util::addScript('federatedfilesharing', 'external'); |
|
48 | - } |
|
49 | - } |
|
46 | + if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled()) { |
|
47 | + \OCP\Util::addScript('federatedfilesharing', 'external'); |
|
48 | + } |
|
49 | + } |
|
50 | 50 | } |
@@ -35,25 +35,25 @@ |
||
35 | 35 | |
36 | 36 | class LegacyBeforeTemplateRenderedListener implements IEventListener { |
37 | 37 | |
38 | - /** @var SymfonyAdapter */ |
|
39 | - private $dispatcher; |
|
38 | + /** @var SymfonyAdapter */ |
|
39 | + private $dispatcher; |
|
40 | 40 | |
41 | - public function __construct(SymfonyAdapter $dispatcher) { |
|
42 | - $this->dispatcher = $dispatcher; |
|
43 | - } |
|
41 | + public function __construct(SymfonyAdapter $dispatcher) { |
|
42 | + $this->dispatcher = $dispatcher; |
|
43 | + } |
|
44 | 44 | |
45 | - public function handle(Event $event): void { |
|
46 | - if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
47 | - return; |
|
48 | - } |
|
45 | + public function handle(Event $event): void { |
|
46 | + if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
47 | + return; |
|
48 | + } |
|
49 | 49 | |
50 | - $eventName = 'OCA\Files_Sharing::loadAdditionalScripts'; |
|
50 | + $eventName = 'OCA\Files_Sharing::loadAdditionalScripts'; |
|
51 | 51 | |
52 | - if ($event->getScope() !== null) { |
|
53 | - $eventName .= '::' . $event->getScope(); |
|
54 | - } |
|
52 | + if ($event->getScope() !== null) { |
|
53 | + $eventName .= '::' . $event->getScope(); |
|
54 | + } |
|
55 | 55 | |
56 | - $legacyEvent = new GenericEvent(null, ['share' => $event->getShare()]); |
|
57 | - $this->dispatcher->dispatch($eventName, $legacyEvent); |
|
58 | - } |
|
56 | + $legacyEvent = new GenericEvent(null, ['share' => $event->getShare()]); |
|
57 | + $this->dispatcher->dispatch($eventName, $legacyEvent); |
|
58 | + } |
|
59 | 59 | } |
@@ -36,37 +36,37 @@ |
||
36 | 36 | * @since 20.0.0 |
37 | 37 | */ |
38 | 38 | class BeforeTemplateRenderedEvent extends Event { |
39 | - /** |
|
40 | - * @since 20.0.0 |
|
41 | - */ |
|
42 | - public const SCOPE_PUBLIC_SHARE_AUTH = 'publicShareAuth'; |
|
39 | + /** |
|
40 | + * @since 20.0.0 |
|
41 | + */ |
|
42 | + public const SCOPE_PUBLIC_SHARE_AUTH = 'publicShareAuth'; |
|
43 | 43 | |
44 | - /** @var IShare */ |
|
45 | - private $share; |
|
46 | - /** @var string|null */ |
|
47 | - private $scope; |
|
44 | + /** @var IShare */ |
|
45 | + private $share; |
|
46 | + /** @var string|null */ |
|
47 | + private $scope; |
|
48 | 48 | |
49 | - /** |
|
50 | - * @since 20.0.0 |
|
51 | - */ |
|
52 | - public function __construct(IShare $share, ?string $scope = null) { |
|
53 | - parent::__construct(); |
|
49 | + /** |
|
50 | + * @since 20.0.0 |
|
51 | + */ |
|
52 | + public function __construct(IShare $share, ?string $scope = null) { |
|
53 | + parent::__construct(); |
|
54 | 54 | |
55 | - $this->share = $share; |
|
56 | - $this->scope = $scope; |
|
57 | - } |
|
55 | + $this->share = $share; |
|
56 | + $this->scope = $scope; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @since 20.0.0 |
|
61 | - */ |
|
62 | - public function getShare(): IShare { |
|
63 | - return $this->share; |
|
64 | - } |
|
59 | + /** |
|
60 | + * @since 20.0.0 |
|
61 | + */ |
|
62 | + public function getShare(): IShare { |
|
63 | + return $this->share; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @since 20.0.0 |
|
68 | - */ |
|
69 | - public function getScope(): ?string { |
|
70 | - return $this->scope; |
|
71 | - } |
|
66 | + /** |
|
67 | + * @since 20.0.0 |
|
68 | + */ |
|
69 | + public function getScope(): ?string { |
|
70 | + return $this->scope; |
|
71 | + } |
|
72 | 72 | } |