@@ -31,22 +31,22 @@ |
||
31 | 31 | use OCP\Migration\SimpleMigrationStep; |
32 | 32 | |
33 | 33 | class Version21000Date20210309185127 extends SimpleMigrationStep { |
34 | - /** |
|
35 | - * @param IOutput $output |
|
36 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | - * @param array $options |
|
38 | - * @return null|ISchemaWrapper |
|
39 | - */ |
|
40 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
41 | - /** @var ISchemaWrapper $schema */ |
|
42 | - $schema = $schemaClosure(); |
|
34 | + /** |
|
35 | + * @param IOutput $output |
|
36 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
37 | + * @param array $options |
|
38 | + * @return null|ISchemaWrapper |
|
39 | + */ |
|
40 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
41 | + /** @var ISchemaWrapper $schema */ |
|
42 | + $schema = $schemaClosure(); |
|
43 | 43 | |
44 | - $table = $schema->getTable('known_users'); |
|
45 | - if (!$table->hasIndex('ku_known_user')) { |
|
46 | - $table->addIndex(['known_user'], 'ku_known_user'); |
|
47 | - return $schema; |
|
48 | - } |
|
44 | + $table = $schema->getTable('known_users'); |
|
45 | + if (!$table->hasIndex('ku_known_user')) { |
|
46 | + $table->addIndex(['known_user'], 'ku_known_user'); |
|
47 | + return $schema; |
|
48 | + } |
|
49 | 49 | |
50 | - return null; |
|
51 | - } |
|
50 | + return null; |
|
51 | + } |
|
52 | 52 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
91 | 91 | $path = Filesystem::getPath($params['fileSource']); |
92 | 92 | [$owner, $ownerPath] = $this->getOwnerPath($path); |
93 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
93 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
94 | 94 | $this->update($absPath); |
95 | 95 | } |
96 | 96 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
107 | 107 | $path = Filesystem::getPath($params['fileSource']); |
108 | 108 | [$owner, $ownerPath] = $this->getOwnerPath($path); |
109 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
109 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
110 | 110 | $this->update($absPath); |
111 | 111 | } |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function postRestore($params) { |
122 | 122 | if ($this->encryptionManager->isEnabled()) { |
123 | - $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']); |
|
123 | + $path = Filesystem::normalizePath('/'.$this->uid.'/files/'.$params['filePath']); |
|
124 | 124 | $this->update($path); |
125 | 125 | } |
126 | 126 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | dirname($source) !== dirname($target) |
140 | 140 | ) { |
141 | 141 | [$owner, $ownerPath] = $this->getOwnerPath($target); |
142 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
142 | + $absPath = '/'.$owner.'/files/'.$ownerPath; |
|
143 | 143 | $this->update($absPath); |
144 | 144 | } |
145 | 145 | } |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | protected function getOwnerPath($path) { |
155 | 155 | $info = Filesystem::getFileInfo($path); |
156 | 156 | $owner = Filesystem::getOwner($path); |
157 | - $view = new View('/' . $owner . '/files'); |
|
157 | + $view = new View('/'.$owner.'/files'); |
|
158 | 158 | $path = $view->getPath($info->getId()); |
159 | 159 | if ($path === null) { |
160 | - throw new InvalidArgumentException('No file found for ' . $info->getId()); |
|
160 | + throw new InvalidArgumentException('No file found for '.$info->getId()); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return [$owner, $path]; |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $encryptionModule->update($file, $this->uid, $usersSharing); |
194 | 194 | } catch (GenericEncryptionException $e) { |
195 | 195 | // If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure |
196 | - $this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]); |
|
196 | + $this->logger->error('Failed to update encryption module for '.$this->uid.' '.$file, ['exception' => $e]); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
@@ -18,163 +18,163 @@ |
||
18 | 18 | * update encrypted files, e.g. because a file was shared |
19 | 19 | */ |
20 | 20 | class Update { |
21 | - /** @var View */ |
|
22 | - protected $view; |
|
23 | - |
|
24 | - /** @var Util */ |
|
25 | - protected $util; |
|
26 | - |
|
27 | - /** @var \OC\Files\Mount\Manager */ |
|
28 | - protected $mountManager; |
|
29 | - |
|
30 | - /** @var Manager */ |
|
31 | - protected $encryptionManager; |
|
32 | - |
|
33 | - /** @var string */ |
|
34 | - protected $uid; |
|
35 | - |
|
36 | - /** @var File */ |
|
37 | - protected $file; |
|
38 | - |
|
39 | - /** @var LoggerInterface */ |
|
40 | - protected $logger; |
|
41 | - |
|
42 | - /** |
|
43 | - * @param string $uid |
|
44 | - */ |
|
45 | - public function __construct( |
|
46 | - View $view, |
|
47 | - Util $util, |
|
48 | - Mount\Manager $mountManager, |
|
49 | - Manager $encryptionManager, |
|
50 | - File $file, |
|
51 | - LoggerInterface $logger, |
|
52 | - $uid, |
|
53 | - ) { |
|
54 | - $this->view = $view; |
|
55 | - $this->util = $util; |
|
56 | - $this->mountManager = $mountManager; |
|
57 | - $this->encryptionManager = $encryptionManager; |
|
58 | - $this->file = $file; |
|
59 | - $this->logger = $logger; |
|
60 | - $this->uid = $uid; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * hook after file was shared |
|
65 | - * |
|
66 | - * @param array $params |
|
67 | - */ |
|
68 | - public function postShared($params) { |
|
69 | - if ($this->encryptionManager->isEnabled()) { |
|
70 | - if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
|
71 | - $path = Filesystem::getPath($params['fileSource']); |
|
72 | - [$owner, $ownerPath] = $this->getOwnerPath($path); |
|
73 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
74 | - $this->update($absPath); |
|
75 | - } |
|
76 | - } |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * hook after file was unshared |
|
81 | - * |
|
82 | - * @param array $params |
|
83 | - */ |
|
84 | - public function postUnshared($params) { |
|
85 | - if ($this->encryptionManager->isEnabled()) { |
|
86 | - if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
|
87 | - $path = Filesystem::getPath($params['fileSource']); |
|
88 | - [$owner, $ownerPath] = $this->getOwnerPath($path); |
|
89 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
90 | - $this->update($absPath); |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - |
|
95 | - /** |
|
96 | - * inform encryption module that a file was restored from the trash bin, |
|
97 | - * e.g. to update the encryption keys |
|
98 | - * |
|
99 | - * @param array $params |
|
100 | - */ |
|
101 | - public function postRestore($params) { |
|
102 | - if ($this->encryptionManager->isEnabled()) { |
|
103 | - $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']); |
|
104 | - $this->update($path); |
|
105 | - } |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * inform encryption module that a file was renamed, |
|
110 | - * e.g. to update the encryption keys |
|
111 | - * |
|
112 | - * @param array $params |
|
113 | - */ |
|
114 | - public function postRename($params) { |
|
115 | - $source = $params['oldpath']; |
|
116 | - $target = $params['newpath']; |
|
117 | - if ( |
|
118 | - $this->encryptionManager->isEnabled() && |
|
119 | - dirname($source) !== dirname($target) |
|
120 | - ) { |
|
121 | - [$owner, $ownerPath] = $this->getOwnerPath($target); |
|
122 | - $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
123 | - $this->update($absPath); |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * get owner and path relative to data/<owner>/files |
|
129 | - * |
|
130 | - * @param string $path path to file for current user |
|
131 | - * @return array ['owner' => $owner, 'path' => $path] |
|
132 | - * @throws \InvalidArgumentException |
|
133 | - */ |
|
134 | - protected function getOwnerPath($path) { |
|
135 | - $info = Filesystem::getFileInfo($path); |
|
136 | - $owner = Filesystem::getOwner($path); |
|
137 | - $view = new View('/' . $owner . '/files'); |
|
138 | - $path = $view->getPath($info->getId()); |
|
139 | - if ($path === null) { |
|
140 | - throw new InvalidArgumentException('No file found for ' . $info->getId()); |
|
141 | - } |
|
142 | - |
|
143 | - return [$owner, $path]; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * notify encryption module about added/removed users from a file/folder |
|
148 | - * |
|
149 | - * @param string $path relative to data/ |
|
150 | - * @throws Exceptions\ModuleDoesNotExistsException |
|
151 | - */ |
|
152 | - public function update($path) { |
|
153 | - $encryptionModule = $this->encryptionManager->getEncryptionModule(); |
|
154 | - |
|
155 | - // if the encryption module doesn't encrypt the files on a per-user basis |
|
156 | - // we have nothing to do here. |
|
157 | - if ($encryptionModule->needDetailedAccessList() === false) { |
|
158 | - return; |
|
159 | - } |
|
160 | - |
|
161 | - // if a folder was shared, get a list of all (sub-)folders |
|
162 | - if ($this->view->is_dir($path)) { |
|
163 | - $allFiles = $this->util->getAllFiles($path); |
|
164 | - } else { |
|
165 | - $allFiles = [$path]; |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - |
|
170 | - foreach ($allFiles as $file) { |
|
171 | - $usersSharing = $this->file->getAccessList($file); |
|
172 | - try { |
|
173 | - $encryptionModule->update($file, $this->uid, $usersSharing); |
|
174 | - } catch (GenericEncryptionException $e) { |
|
175 | - // If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure |
|
176 | - $this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]); |
|
177 | - } |
|
178 | - } |
|
179 | - } |
|
21 | + /** @var View */ |
|
22 | + protected $view; |
|
23 | + |
|
24 | + /** @var Util */ |
|
25 | + protected $util; |
|
26 | + |
|
27 | + /** @var \OC\Files\Mount\Manager */ |
|
28 | + protected $mountManager; |
|
29 | + |
|
30 | + /** @var Manager */ |
|
31 | + protected $encryptionManager; |
|
32 | + |
|
33 | + /** @var string */ |
|
34 | + protected $uid; |
|
35 | + |
|
36 | + /** @var File */ |
|
37 | + protected $file; |
|
38 | + |
|
39 | + /** @var LoggerInterface */ |
|
40 | + protected $logger; |
|
41 | + |
|
42 | + /** |
|
43 | + * @param string $uid |
|
44 | + */ |
|
45 | + public function __construct( |
|
46 | + View $view, |
|
47 | + Util $util, |
|
48 | + Mount\Manager $mountManager, |
|
49 | + Manager $encryptionManager, |
|
50 | + File $file, |
|
51 | + LoggerInterface $logger, |
|
52 | + $uid, |
|
53 | + ) { |
|
54 | + $this->view = $view; |
|
55 | + $this->util = $util; |
|
56 | + $this->mountManager = $mountManager; |
|
57 | + $this->encryptionManager = $encryptionManager; |
|
58 | + $this->file = $file; |
|
59 | + $this->logger = $logger; |
|
60 | + $this->uid = $uid; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * hook after file was shared |
|
65 | + * |
|
66 | + * @param array $params |
|
67 | + */ |
|
68 | + public function postShared($params) { |
|
69 | + if ($this->encryptionManager->isEnabled()) { |
|
70 | + if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
|
71 | + $path = Filesystem::getPath($params['fileSource']); |
|
72 | + [$owner, $ownerPath] = $this->getOwnerPath($path); |
|
73 | + $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
74 | + $this->update($absPath); |
|
75 | + } |
|
76 | + } |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * hook after file was unshared |
|
81 | + * |
|
82 | + * @param array $params |
|
83 | + */ |
|
84 | + public function postUnshared($params) { |
|
85 | + if ($this->encryptionManager->isEnabled()) { |
|
86 | + if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') { |
|
87 | + $path = Filesystem::getPath($params['fileSource']); |
|
88 | + [$owner, $ownerPath] = $this->getOwnerPath($path); |
|
89 | + $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
90 | + $this->update($absPath); |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + |
|
95 | + /** |
|
96 | + * inform encryption module that a file was restored from the trash bin, |
|
97 | + * e.g. to update the encryption keys |
|
98 | + * |
|
99 | + * @param array $params |
|
100 | + */ |
|
101 | + public function postRestore($params) { |
|
102 | + if ($this->encryptionManager->isEnabled()) { |
|
103 | + $path = Filesystem::normalizePath('/' . $this->uid . '/files/' . $params['filePath']); |
|
104 | + $this->update($path); |
|
105 | + } |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * inform encryption module that a file was renamed, |
|
110 | + * e.g. to update the encryption keys |
|
111 | + * |
|
112 | + * @param array $params |
|
113 | + */ |
|
114 | + public function postRename($params) { |
|
115 | + $source = $params['oldpath']; |
|
116 | + $target = $params['newpath']; |
|
117 | + if ( |
|
118 | + $this->encryptionManager->isEnabled() && |
|
119 | + dirname($source) !== dirname($target) |
|
120 | + ) { |
|
121 | + [$owner, $ownerPath] = $this->getOwnerPath($target); |
|
122 | + $absPath = '/' . $owner . '/files/' . $ownerPath; |
|
123 | + $this->update($absPath); |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * get owner and path relative to data/<owner>/files |
|
129 | + * |
|
130 | + * @param string $path path to file for current user |
|
131 | + * @return array ['owner' => $owner, 'path' => $path] |
|
132 | + * @throws \InvalidArgumentException |
|
133 | + */ |
|
134 | + protected function getOwnerPath($path) { |
|
135 | + $info = Filesystem::getFileInfo($path); |
|
136 | + $owner = Filesystem::getOwner($path); |
|
137 | + $view = new View('/' . $owner . '/files'); |
|
138 | + $path = $view->getPath($info->getId()); |
|
139 | + if ($path === null) { |
|
140 | + throw new InvalidArgumentException('No file found for ' . $info->getId()); |
|
141 | + } |
|
142 | + |
|
143 | + return [$owner, $path]; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * notify encryption module about added/removed users from a file/folder |
|
148 | + * |
|
149 | + * @param string $path relative to data/ |
|
150 | + * @throws Exceptions\ModuleDoesNotExistsException |
|
151 | + */ |
|
152 | + public function update($path) { |
|
153 | + $encryptionModule = $this->encryptionManager->getEncryptionModule(); |
|
154 | + |
|
155 | + // if the encryption module doesn't encrypt the files on a per-user basis |
|
156 | + // we have nothing to do here. |
|
157 | + if ($encryptionModule->needDetailedAccessList() === false) { |
|
158 | + return; |
|
159 | + } |
|
160 | + |
|
161 | + // if a folder was shared, get a list of all (sub-)folders |
|
162 | + if ($this->view->is_dir($path)) { |
|
163 | + $allFiles = $this->util->getAllFiles($path); |
|
164 | + } else { |
|
165 | + $allFiles = [$path]; |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + |
|
170 | + foreach ($allFiles as $file) { |
|
171 | + $usersSharing = $this->file->getAccessList($file); |
|
172 | + try { |
|
173 | + $encryptionModule->update($file, $this->uid, $usersSharing); |
|
174 | + } catch (GenericEncryptionException $e) { |
|
175 | + // If the update of an individual file fails e.g. due to a corrupt key we should continue the operation and just log the failure |
|
176 | + $this->logger->error('Failed to update encryption module for ' . $this->uid . ' ' . $file, [ 'exception' => $e ]); |
|
177 | + } |
|
178 | + } |
|
179 | + } |
|
180 | 180 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $avatarsToDeleteCount = 0; |
96 | 96 | |
97 | 97 | foreach ($this->getAvatarsToDelete() as [$userId, $avatar]) { |
98 | - $output->writeln('Deleting avatar for ' . $userId, OutputInterface::VERBOSITY_VERBOSE); |
|
98 | + $output->writeln('Deleting avatar for '.$userId, OutputInterface::VERBOSITY_VERBOSE); |
|
99 | 99 | |
100 | 100 | $avatarsToDeleteCount++; |
101 | 101 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - $output->writeln('Deleted ' . $avatarsToDeleteCount . ' avatars'); |
|
115 | + $output->writeln('Deleted '.$avatarsToDeleteCount.' avatars'); |
|
116 | 116 | $output->writeln(''); |
117 | 117 | } |
118 | 118 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $previewsToDeleteCount = 0; |
131 | 131 | |
132 | 132 | foreach ($this->getPreviewsToDelete() as ['name' => $previewFileId, 'path' => $filePath]) { |
133 | - $output->writeln('Deleting previews for ' . $filePath, OutputInterface::VERBOSITY_VERBOSE); |
|
133 | + $output->writeln('Deleting previews for '.$filePath, OutputInterface::VERBOSITY_VERBOSE); |
|
134 | 134 | |
135 | 135 | $previewsToDeleteCount++; |
136 | 136 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | try { |
142 | - $preview = $this->previewFolder->getFolder((string)$previewFileId); |
|
142 | + $preview = $this->previewFolder->getFolder((string) $previewFileId); |
|
143 | 143 | $preview->delete(); |
144 | 144 | } catch (NotFoundException $e) { |
145 | 145 | // continue |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | } |
149 | 149 | } |
150 | 150 | |
151 | - $output->writeln('Deleted ' . $previewsToDeleteCount . ' previews'); |
|
151 | + $output->writeln('Deleted '.$previewsToDeleteCount.' previews'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | // Copy pasted and adjusted from |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * We take the md5 of the name (fileid) and split the first 7 chars. That way |
172 | 172 | * there are not a gazillion files in the root of the preview appdata. |
173 | 173 | */ |
174 | - $like = $this->connection->escapeLikeParameter($data['path']) . '/_/_/_/_/_/_/_/%'; |
|
174 | + $like = $this->connection->escapeLikeParameter($data['path']).'/_/_/_/_/_/_/_/%'; |
|
175 | 175 | |
176 | 176 | $qb = $this->connection->getQueryBuilder(); |
177 | 177 | $qb->select('a.name', 'b.path') |
@@ -22,143 +22,143 @@ |
||
22 | 22 | use Symfony\Component\Console\Output\OutputInterface; |
23 | 23 | |
24 | 24 | class ResetRenderedTexts extends Command { |
25 | - public function __construct( |
|
26 | - protected IDBConnection $connection, |
|
27 | - protected IUserManager $userManager, |
|
28 | - protected IAvatarManager $avatarManager, |
|
29 | - private Root $previewFolder, |
|
30 | - private IMimeTypeLoader $mimeTypeLoader, |
|
31 | - ) { |
|
32 | - parent::__construct(); |
|
33 | - } |
|
34 | - |
|
35 | - protected function configure() { |
|
36 | - $this |
|
37 | - ->setName('preview:reset-rendered-texts') |
|
38 | - ->setDescription('Deletes all generated avatars and previews of text and md files') |
|
39 | - ->addOption('dry', 'd', InputOption::VALUE_NONE, 'Dry mode - will not delete any files - in combination with the verbose mode one could check the operations.'); |
|
40 | - } |
|
41 | - |
|
42 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
43 | - $dryMode = $input->getOption('dry'); |
|
44 | - |
|
45 | - if ($dryMode) { |
|
46 | - $output->writeln('INFO: The command is run in dry mode and will not modify anything.'); |
|
47 | - $output->writeln(''); |
|
48 | - } |
|
49 | - |
|
50 | - $this->deleteAvatars($output, $dryMode); |
|
51 | - $this->deletePreviews($output, $dryMode); |
|
52 | - |
|
53 | - return 0; |
|
54 | - } |
|
55 | - |
|
56 | - private function deleteAvatars(OutputInterface $output, bool $dryMode): void { |
|
57 | - $avatarsToDeleteCount = 0; |
|
58 | - |
|
59 | - foreach ($this->getAvatarsToDelete() as [$userId, $avatar]) { |
|
60 | - $output->writeln('Deleting avatar for ' . $userId, OutputInterface::VERBOSITY_VERBOSE); |
|
61 | - |
|
62 | - $avatarsToDeleteCount++; |
|
63 | - |
|
64 | - if ($dryMode) { |
|
65 | - continue; |
|
66 | - } |
|
67 | - |
|
68 | - try { |
|
69 | - $avatar->remove(); |
|
70 | - } catch (NotFoundException $e) { |
|
71 | - // continue |
|
72 | - } catch (NotPermittedException $e) { |
|
73 | - // continue |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - $output->writeln('Deleted ' . $avatarsToDeleteCount . ' avatars'); |
|
78 | - $output->writeln(''); |
|
79 | - } |
|
80 | - |
|
81 | - private function getAvatarsToDelete(): \Iterator { |
|
82 | - foreach ($this->userManager->search('') as $user) { |
|
83 | - $avatar = $this->avatarManager->getAvatar($user->getUID()); |
|
84 | - |
|
85 | - if (!$avatar->isCustomAvatar()) { |
|
86 | - yield [$user->getUID(), $avatar]; |
|
87 | - } |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - private function deletePreviews(OutputInterface $output, bool $dryMode): void { |
|
92 | - $previewsToDeleteCount = 0; |
|
93 | - |
|
94 | - foreach ($this->getPreviewsToDelete() as ['name' => $previewFileId, 'path' => $filePath]) { |
|
95 | - $output->writeln('Deleting previews for ' . $filePath, OutputInterface::VERBOSITY_VERBOSE); |
|
96 | - |
|
97 | - $previewsToDeleteCount++; |
|
98 | - |
|
99 | - if ($dryMode) { |
|
100 | - continue; |
|
101 | - } |
|
102 | - |
|
103 | - try { |
|
104 | - $preview = $this->previewFolder->getFolder((string)$previewFileId); |
|
105 | - $preview->delete(); |
|
106 | - } catch (NotFoundException $e) { |
|
107 | - // continue |
|
108 | - } catch (NotPermittedException $e) { |
|
109 | - // continue |
|
110 | - } |
|
111 | - } |
|
112 | - |
|
113 | - $output->writeln('Deleted ' . $previewsToDeleteCount . ' previews'); |
|
114 | - } |
|
115 | - |
|
116 | - // Copy pasted and adjusted from |
|
117 | - // "lib/private/Preview/BackgroundCleanupJob.php". |
|
118 | - private function getPreviewsToDelete(): \Iterator { |
|
119 | - $qb = $this->connection->getQueryBuilder(); |
|
120 | - $qb->select('path', 'mimetype') |
|
121 | - ->from('filecache') |
|
122 | - ->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId()))); |
|
123 | - $cursor = $qb->executeQuery(); |
|
124 | - $data = $cursor->fetch(); |
|
125 | - $cursor->closeCursor(); |
|
126 | - |
|
127 | - if ($data === null) { |
|
128 | - return []; |
|
129 | - } |
|
130 | - |
|
131 | - /* |
|
25 | + public function __construct( |
|
26 | + protected IDBConnection $connection, |
|
27 | + protected IUserManager $userManager, |
|
28 | + protected IAvatarManager $avatarManager, |
|
29 | + private Root $previewFolder, |
|
30 | + private IMimeTypeLoader $mimeTypeLoader, |
|
31 | + ) { |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | + |
|
35 | + protected function configure() { |
|
36 | + $this |
|
37 | + ->setName('preview:reset-rendered-texts') |
|
38 | + ->setDescription('Deletes all generated avatars and previews of text and md files') |
|
39 | + ->addOption('dry', 'd', InputOption::VALUE_NONE, 'Dry mode - will not delete any files - in combination with the verbose mode one could check the operations.'); |
|
40 | + } |
|
41 | + |
|
42 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
43 | + $dryMode = $input->getOption('dry'); |
|
44 | + |
|
45 | + if ($dryMode) { |
|
46 | + $output->writeln('INFO: The command is run in dry mode and will not modify anything.'); |
|
47 | + $output->writeln(''); |
|
48 | + } |
|
49 | + |
|
50 | + $this->deleteAvatars($output, $dryMode); |
|
51 | + $this->deletePreviews($output, $dryMode); |
|
52 | + |
|
53 | + return 0; |
|
54 | + } |
|
55 | + |
|
56 | + private function deleteAvatars(OutputInterface $output, bool $dryMode): void { |
|
57 | + $avatarsToDeleteCount = 0; |
|
58 | + |
|
59 | + foreach ($this->getAvatarsToDelete() as [$userId, $avatar]) { |
|
60 | + $output->writeln('Deleting avatar for ' . $userId, OutputInterface::VERBOSITY_VERBOSE); |
|
61 | + |
|
62 | + $avatarsToDeleteCount++; |
|
63 | + |
|
64 | + if ($dryMode) { |
|
65 | + continue; |
|
66 | + } |
|
67 | + |
|
68 | + try { |
|
69 | + $avatar->remove(); |
|
70 | + } catch (NotFoundException $e) { |
|
71 | + // continue |
|
72 | + } catch (NotPermittedException $e) { |
|
73 | + // continue |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + $output->writeln('Deleted ' . $avatarsToDeleteCount . ' avatars'); |
|
78 | + $output->writeln(''); |
|
79 | + } |
|
80 | + |
|
81 | + private function getAvatarsToDelete(): \Iterator { |
|
82 | + foreach ($this->userManager->search('') as $user) { |
|
83 | + $avatar = $this->avatarManager->getAvatar($user->getUID()); |
|
84 | + |
|
85 | + if (!$avatar->isCustomAvatar()) { |
|
86 | + yield [$user->getUID(), $avatar]; |
|
87 | + } |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + private function deletePreviews(OutputInterface $output, bool $dryMode): void { |
|
92 | + $previewsToDeleteCount = 0; |
|
93 | + |
|
94 | + foreach ($this->getPreviewsToDelete() as ['name' => $previewFileId, 'path' => $filePath]) { |
|
95 | + $output->writeln('Deleting previews for ' . $filePath, OutputInterface::VERBOSITY_VERBOSE); |
|
96 | + |
|
97 | + $previewsToDeleteCount++; |
|
98 | + |
|
99 | + if ($dryMode) { |
|
100 | + continue; |
|
101 | + } |
|
102 | + |
|
103 | + try { |
|
104 | + $preview = $this->previewFolder->getFolder((string)$previewFileId); |
|
105 | + $preview->delete(); |
|
106 | + } catch (NotFoundException $e) { |
|
107 | + // continue |
|
108 | + } catch (NotPermittedException $e) { |
|
109 | + // continue |
|
110 | + } |
|
111 | + } |
|
112 | + |
|
113 | + $output->writeln('Deleted ' . $previewsToDeleteCount . ' previews'); |
|
114 | + } |
|
115 | + |
|
116 | + // Copy pasted and adjusted from |
|
117 | + // "lib/private/Preview/BackgroundCleanupJob.php". |
|
118 | + private function getPreviewsToDelete(): \Iterator { |
|
119 | + $qb = $this->connection->getQueryBuilder(); |
|
120 | + $qb->select('path', 'mimetype') |
|
121 | + ->from('filecache') |
|
122 | + ->where($qb->expr()->eq('fileid', $qb->createNamedParameter($this->previewFolder->getId()))); |
|
123 | + $cursor = $qb->executeQuery(); |
|
124 | + $data = $cursor->fetch(); |
|
125 | + $cursor->closeCursor(); |
|
126 | + |
|
127 | + if ($data === null) { |
|
128 | + return []; |
|
129 | + } |
|
130 | + |
|
131 | + /* |
|
132 | 132 | * This lovely like is the result of the way the new previews are stored |
133 | 133 | * We take the md5 of the name (fileid) and split the first 7 chars. That way |
134 | 134 | * there are not a gazillion files in the root of the preview appdata. |
135 | 135 | */ |
136 | - $like = $this->connection->escapeLikeParameter($data['path']) . '/_/_/_/_/_/_/_/%'; |
|
137 | - |
|
138 | - $qb = $this->connection->getQueryBuilder(); |
|
139 | - $qb->select('a.name', 'b.path') |
|
140 | - ->from('filecache', 'a') |
|
141 | - ->leftJoin('a', 'filecache', 'b', $qb->expr()->eq( |
|
142 | - $qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid' |
|
143 | - )) |
|
144 | - ->where( |
|
145 | - $qb->expr()->andX( |
|
146 | - $qb->expr()->like('a.path', $qb->createNamedParameter($like)), |
|
147 | - $qb->expr()->eq('a.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('httpd/unix-directory'))), |
|
148 | - $qb->expr()->orX( |
|
149 | - $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/plain'))), |
|
150 | - $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/markdown'))), |
|
151 | - $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/x-markdown'))) |
|
152 | - ) |
|
153 | - ) |
|
154 | - ); |
|
155 | - |
|
156 | - $cursor = $qb->executeQuery(); |
|
157 | - |
|
158 | - while ($row = $cursor->fetch()) { |
|
159 | - yield $row; |
|
160 | - } |
|
161 | - |
|
162 | - $cursor->closeCursor(); |
|
163 | - } |
|
136 | + $like = $this->connection->escapeLikeParameter($data['path']) . '/_/_/_/_/_/_/_/%'; |
|
137 | + |
|
138 | + $qb = $this->connection->getQueryBuilder(); |
|
139 | + $qb->select('a.name', 'b.path') |
|
140 | + ->from('filecache', 'a') |
|
141 | + ->leftJoin('a', 'filecache', 'b', $qb->expr()->eq( |
|
142 | + $qb->expr()->castColumn('a.name', IQueryBuilder::PARAM_INT), 'b.fileid' |
|
143 | + )) |
|
144 | + ->where( |
|
145 | + $qb->expr()->andX( |
|
146 | + $qb->expr()->like('a.path', $qb->createNamedParameter($like)), |
|
147 | + $qb->expr()->eq('a.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('httpd/unix-directory'))), |
|
148 | + $qb->expr()->orX( |
|
149 | + $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/plain'))), |
|
150 | + $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/markdown'))), |
|
151 | + $qb->expr()->eq('b.mimetype', $qb->createNamedParameter($this->mimeTypeLoader->getId('text/x-markdown'))) |
|
152 | + ) |
|
153 | + ) |
|
154 | + ); |
|
155 | + |
|
156 | + $cursor = $qb->executeQuery(); |
|
157 | + |
|
158 | + while ($row = $cursor->fetch()) { |
|
159 | + yield $row; |
|
160 | + } |
|
161 | + |
|
162 | + $cursor->closeCursor(); |
|
163 | + } |
|
164 | 164 | } |
@@ -29,49 +29,49 @@ |
||
29 | 29 | * @since 12.0.0 |
30 | 30 | */ |
31 | 31 | interface ISearchQuery { |
32 | - /** |
|
33 | - * @return ISearchOperator |
|
34 | - * @since 12.0.0 |
|
35 | - */ |
|
36 | - public function getSearchOperation(); |
|
32 | + /** |
|
33 | + * @return ISearchOperator |
|
34 | + * @since 12.0.0 |
|
35 | + */ |
|
36 | + public function getSearchOperation(); |
|
37 | 37 | |
38 | - /** |
|
39 | - * Get the maximum number of results to return |
|
40 | - * |
|
41 | - * @return integer |
|
42 | - * @since 12.0.0 |
|
43 | - */ |
|
44 | - public function getLimit(); |
|
38 | + /** |
|
39 | + * Get the maximum number of results to return |
|
40 | + * |
|
41 | + * @return integer |
|
42 | + * @since 12.0.0 |
|
43 | + */ |
|
44 | + public function getLimit(); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the offset for returned results |
|
48 | - * |
|
49 | - * @return integer |
|
50 | - * @since 12.0.0 |
|
51 | - */ |
|
52 | - public function getOffset(); |
|
46 | + /** |
|
47 | + * Get the offset for returned results |
|
48 | + * |
|
49 | + * @return integer |
|
50 | + * @since 12.0.0 |
|
51 | + */ |
|
52 | + public function getOffset(); |
|
53 | 53 | |
54 | - /** |
|
55 | - * The fields and directions to order by |
|
56 | - * |
|
57 | - * @return ISearchOrder[] |
|
58 | - * @since 12.0.0 |
|
59 | - */ |
|
60 | - public function getOrder(); |
|
54 | + /** |
|
55 | + * The fields and directions to order by |
|
56 | + * |
|
57 | + * @return ISearchOrder[] |
|
58 | + * @since 12.0.0 |
|
59 | + */ |
|
60 | + public function getOrder(); |
|
61 | 61 | |
62 | - /** |
|
63 | - * The user that issued the search |
|
64 | - * |
|
65 | - * @return ?IUser |
|
66 | - * @since 12.0.0 |
|
67 | - */ |
|
68 | - public function getUser(); |
|
62 | + /** |
|
63 | + * The user that issued the search |
|
64 | + * |
|
65 | + * @return ?IUser |
|
66 | + * @since 12.0.0 |
|
67 | + */ |
|
68 | + public function getUser(); |
|
69 | 69 | |
70 | - /** |
|
71 | - * Whether or not the search should be limited to the users home storage |
|
72 | - * |
|
73 | - * @return bool |
|
74 | - * @since 18.0.0 |
|
75 | - */ |
|
76 | - public function limitToHome(): bool; |
|
70 | + /** |
|
71 | + * Whether or not the search should be limited to the users home storage |
|
72 | + * |
|
73 | + * @return bool |
|
74 | + * @since 18.0.0 |
|
75 | + */ |
|
76 | + public function limitToHome(): bool; |
|
77 | 77 | } |
@@ -43,6 +43,6 @@ |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function getData(): int { |
46 | - return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); |
|
46 | + return (int) $this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); |
|
47 | 47 | } |
48 | 48 | } |
@@ -12,16 +12,16 @@ |
||
12 | 12 | use OCP\IConfig; |
13 | 13 | |
14 | 14 | class MaxAutoCompleteResultsInitialState extends InitialStateProvider { |
15 | - public function __construct( |
|
16 | - private IConfig $config, |
|
17 | - ) { |
|
18 | - } |
|
15 | + public function __construct( |
|
16 | + private IConfig $config, |
|
17 | + ) { |
|
18 | + } |
|
19 | 19 | |
20 | - public function getKey(): string { |
|
21 | - return 'maxAutoCompleteResults'; |
|
22 | - } |
|
20 | + public function getKey(): string { |
|
21 | + return 'maxAutoCompleteResults'; |
|
22 | + } |
|
23 | 23 | |
24 | - public function getData(): int { |
|
25 | - return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); |
|
26 | - } |
|
24 | + public function getData(): int { |
|
25 | + return (int)$this->config->getAppValue('comments', 'maxAutoCompleteResults', '10'); |
|
26 | + } |
|
27 | 27 | } |
@@ -36,27 +36,27 @@ |
||
36 | 36 | |
37 | 37 | class Version1002Date20170919123342 extends SimpleMigrationStep { |
38 | 38 | |
39 | - /** |
|
40 | - * @param IOutput $output |
|
41 | - * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
42 | - * @param array $options |
|
43 | - * @return null|ISchemaWrapper |
|
44 | - * @since 13.0.0 |
|
45 | - */ |
|
46 | - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
47 | - /** @var ISchemaWrapper $schema */ |
|
48 | - $schema = $schemaClosure(); |
|
49 | - |
|
50 | - $table = $schema->getTable('twofactor_backupcodes'); |
|
51 | - $column = $table->getColumn('user_id'); |
|
52 | - $column->setDefault(''); |
|
53 | - |
|
54 | - $column = $table->getColumn('used'); |
|
55 | - if ($column->getType()->getName() !== Types::SMALLINT) { |
|
56 | - $column->setType(Type::getType(Types::SMALLINT)); |
|
57 | - $column->setOptions(['length' => 6]); |
|
58 | - } |
|
59 | - |
|
60 | - return $schema; |
|
61 | - } |
|
39 | + /** |
|
40 | + * @param IOutput $output |
|
41 | + * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
42 | + * @param array $options |
|
43 | + * @return null|ISchemaWrapper |
|
44 | + * @since 13.0.0 |
|
45 | + */ |
|
46 | + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { |
|
47 | + /** @var ISchemaWrapper $schema */ |
|
48 | + $schema = $schemaClosure(); |
|
49 | + |
|
50 | + $table = $schema->getTable('twofactor_backupcodes'); |
|
51 | + $column = $table->getColumn('user_id'); |
|
52 | + $column->setDefault(''); |
|
53 | + |
|
54 | + $column = $table->getColumn('used'); |
|
55 | + if ($column->getType()->getName() !== Types::SMALLINT) { |
|
56 | + $column->setType(Type::getType(Types::SMALLINT)); |
|
57 | + $column->setOptions(['length' => 6]); |
|
58 | + } |
|
59 | + |
|
60 | + return $schema; |
|
61 | + } |
|
62 | 62 | } |
@@ -6,51 +6,51 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitTwoFactorBackupCodes |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\TwoFactorBackupCodes\\' => 25, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\TwoFactorBackupCodes\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
25 | - 'OCA\\TwoFactorBackupCodes\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php', |
|
26 | - 'OCA\\TwoFactorBackupCodes\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
27 | - 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\CheckBackupCodes' => __DIR__ . '/..' . '/../lib/BackgroundJob/CheckBackupCodes.php', |
|
28 | - 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\RememberBackupCodesJob' => __DIR__ . '/..' . '/../lib/BackgroundJob/RememberBackupCodesJob.php', |
|
29 | - 'OCA\\TwoFactorBackupCodes\\Controller\\SettingsController' => __DIR__ . '/..' . '/../lib/Controller/SettingsController.php', |
|
30 | - 'OCA\\TwoFactorBackupCodes\\Db\\BackupCode' => __DIR__ . '/..' . '/../lib/Db/BackupCode.php', |
|
31 | - 'OCA\\TwoFactorBackupCodes\\Db\\BackupCodeMapper' => __DIR__ . '/..' . '/../lib/Db/BackupCodeMapper.php', |
|
32 | - 'OCA\\TwoFactorBackupCodes\\Event\\CodesGenerated' => __DIR__ . '/..' . '/../lib/Event/CodesGenerated.php', |
|
33 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ActivityPublisher' => __DIR__ . '/..' . '/../lib/Listener/ActivityPublisher.php', |
|
34 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ClearNotifications' => __DIR__ . '/..' . '/../lib/Listener/ClearNotifications.php', |
|
35 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderDisabled' => __DIR__ . '/..' . '/../lib/Listener/ProviderDisabled.php', |
|
36 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderEnabled' => __DIR__ . '/..' . '/../lib/Listener/ProviderEnabled.php', |
|
37 | - 'OCA\\TwoFactorBackupCodes\\Listener\\RegistryUpdater' => __DIR__ . '/..' . '/../lib/Listener/RegistryUpdater.php', |
|
38 | - 'OCA\\TwoFactorBackupCodes\\Listener\\UserDeleted' => __DIR__ . '/..' . '/../lib/Listener/UserDeleted.php', |
|
39 | - 'OCA\\TwoFactorBackupCodes\\Migration\\CheckBackupCodes' => __DIR__ . '/..' . '/../lib/Migration/CheckBackupCodes.php', |
|
40 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607104347' => __DIR__ . '/..' . '/../lib/Migration/Version1002Date20170607104347.php', |
|
41 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607113030' => __DIR__ . '/..' . '/../lib/Migration/Version1002Date20170607113030.php', |
|
42 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170919123342' => __DIR__ . '/..' . '/../lib/Migration/Version1002Date20170919123342.php', |
|
43 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170926101419' => __DIR__ . '/..' . '/../lib/Migration/Version1002Date20170926101419.php', |
|
44 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20180821043638' => __DIR__ . '/..' . '/../lib/Migration/Version1002Date20180821043638.php', |
|
45 | - 'OCA\\TwoFactorBackupCodes\\Notifications\\Notifier' => __DIR__ . '/..' . '/../lib/Notifications/Notifier.php', |
|
46 | - 'OCA\\TwoFactorBackupCodes\\Provider\\BackupCodesProvider' => __DIR__ . '/..' . '/../lib/Provider/BackupCodesProvider.php', |
|
47 | - 'OCA\\TwoFactorBackupCodes\\Service\\BackupCodeStorage' => __DIR__ . '/..' . '/../lib/Service/BackupCodeStorage.php', |
|
48 | - 'OCA\\TwoFactorBackupCodes\\Settings\\Personal' => __DIR__ . '/..' . '/../lib/Settings/Personal.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php', |
|
25 | + 'OCA\\TwoFactorBackupCodes\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php', |
|
26 | + 'OCA\\TwoFactorBackupCodes\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
27 | + 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\CheckBackupCodes' => __DIR__.'/..'.'/../lib/BackgroundJob/CheckBackupCodes.php', |
|
28 | + 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\RememberBackupCodesJob' => __DIR__.'/..'.'/../lib/BackgroundJob/RememberBackupCodesJob.php', |
|
29 | + 'OCA\\TwoFactorBackupCodes\\Controller\\SettingsController' => __DIR__.'/..'.'/../lib/Controller/SettingsController.php', |
|
30 | + 'OCA\\TwoFactorBackupCodes\\Db\\BackupCode' => __DIR__.'/..'.'/../lib/Db/BackupCode.php', |
|
31 | + 'OCA\\TwoFactorBackupCodes\\Db\\BackupCodeMapper' => __DIR__.'/..'.'/../lib/Db/BackupCodeMapper.php', |
|
32 | + 'OCA\\TwoFactorBackupCodes\\Event\\CodesGenerated' => __DIR__.'/..'.'/../lib/Event/CodesGenerated.php', |
|
33 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ActivityPublisher' => __DIR__.'/..'.'/../lib/Listener/ActivityPublisher.php', |
|
34 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ClearNotifications' => __DIR__.'/..'.'/../lib/Listener/ClearNotifications.php', |
|
35 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderDisabled' => __DIR__.'/..'.'/../lib/Listener/ProviderDisabled.php', |
|
36 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderEnabled' => __DIR__.'/..'.'/../lib/Listener/ProviderEnabled.php', |
|
37 | + 'OCA\\TwoFactorBackupCodes\\Listener\\RegistryUpdater' => __DIR__.'/..'.'/../lib/Listener/RegistryUpdater.php', |
|
38 | + 'OCA\\TwoFactorBackupCodes\\Listener\\UserDeleted' => __DIR__.'/..'.'/../lib/Listener/UserDeleted.php', |
|
39 | + 'OCA\\TwoFactorBackupCodes\\Migration\\CheckBackupCodes' => __DIR__.'/..'.'/../lib/Migration/CheckBackupCodes.php', |
|
40 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607104347' => __DIR__.'/..'.'/../lib/Migration/Version1002Date20170607104347.php', |
|
41 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607113030' => __DIR__.'/..'.'/../lib/Migration/Version1002Date20170607113030.php', |
|
42 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170919123342' => __DIR__.'/..'.'/../lib/Migration/Version1002Date20170919123342.php', |
|
43 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170926101419' => __DIR__.'/..'.'/../lib/Migration/Version1002Date20170926101419.php', |
|
44 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20180821043638' => __DIR__.'/..'.'/../lib/Migration/Version1002Date20180821043638.php', |
|
45 | + 'OCA\\TwoFactorBackupCodes\\Notifications\\Notifier' => __DIR__.'/..'.'/../lib/Notifications/Notifier.php', |
|
46 | + 'OCA\\TwoFactorBackupCodes\\Provider\\BackupCodesProvider' => __DIR__.'/..'.'/../lib/Provider/BackupCodesProvider.php', |
|
47 | + 'OCA\\TwoFactorBackupCodes\\Service\\BackupCodeStorage' => __DIR__.'/..'.'/../lib/Service/BackupCodeStorage.php', |
|
48 | + 'OCA\\TwoFactorBackupCodes\\Settings\\Personal' => __DIR__.'/..'.'/../lib/Settings/Personal.php', |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | public static function getInitializer(ClassLoader $loader) |
52 | 52 | { |
53 | - return \Closure::bind(function () use ($loader) { |
|
53 | + return \Closure::bind(function() use ($loader) { |
|
54 | 54 | $loader->prefixLengthsPsr4 = ComposerStaticInitTwoFactorBackupCodes::$prefixLengthsPsr4; |
55 | 55 | $loader->prefixDirsPsr4 = ComposerStaticInitTwoFactorBackupCodes::$prefixDirsPsr4; |
56 | 56 | $loader->classMap = ComposerStaticInitTwoFactorBackupCodes::$classMap; |
@@ -6,29 +6,29 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', |
|
10 | - 'OCA\\TwoFactorBackupCodes\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php', |
|
11 | - 'OCA\\TwoFactorBackupCodes\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
12 | - 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\CheckBackupCodes' => $baseDir . '/../lib/BackgroundJob/CheckBackupCodes.php', |
|
13 | - 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\RememberBackupCodesJob' => $baseDir . '/../lib/BackgroundJob/RememberBackupCodesJob.php', |
|
14 | - 'OCA\\TwoFactorBackupCodes\\Controller\\SettingsController' => $baseDir . '/../lib/Controller/SettingsController.php', |
|
15 | - 'OCA\\TwoFactorBackupCodes\\Db\\BackupCode' => $baseDir . '/../lib/Db/BackupCode.php', |
|
16 | - 'OCA\\TwoFactorBackupCodes\\Db\\BackupCodeMapper' => $baseDir . '/../lib/Db/BackupCodeMapper.php', |
|
17 | - 'OCA\\TwoFactorBackupCodes\\Event\\CodesGenerated' => $baseDir . '/../lib/Event/CodesGenerated.php', |
|
18 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ActivityPublisher' => $baseDir . '/../lib/Listener/ActivityPublisher.php', |
|
19 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ClearNotifications' => $baseDir . '/../lib/Listener/ClearNotifications.php', |
|
20 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderDisabled' => $baseDir . '/../lib/Listener/ProviderDisabled.php', |
|
21 | - 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderEnabled' => $baseDir . '/../lib/Listener/ProviderEnabled.php', |
|
22 | - 'OCA\\TwoFactorBackupCodes\\Listener\\RegistryUpdater' => $baseDir . '/../lib/Listener/RegistryUpdater.php', |
|
23 | - 'OCA\\TwoFactorBackupCodes\\Listener\\UserDeleted' => $baseDir . '/../lib/Listener/UserDeleted.php', |
|
24 | - 'OCA\\TwoFactorBackupCodes\\Migration\\CheckBackupCodes' => $baseDir . '/../lib/Migration/CheckBackupCodes.php', |
|
25 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607104347' => $baseDir . '/../lib/Migration/Version1002Date20170607104347.php', |
|
26 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607113030' => $baseDir . '/../lib/Migration/Version1002Date20170607113030.php', |
|
27 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170919123342' => $baseDir . '/../lib/Migration/Version1002Date20170919123342.php', |
|
28 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170926101419' => $baseDir . '/../lib/Migration/Version1002Date20170926101419.php', |
|
29 | - 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20180821043638' => $baseDir . '/../lib/Migration/Version1002Date20180821043638.php', |
|
30 | - 'OCA\\TwoFactorBackupCodes\\Notifications\\Notifier' => $baseDir . '/../lib/Notifications/Notifier.php', |
|
31 | - 'OCA\\TwoFactorBackupCodes\\Provider\\BackupCodesProvider' => $baseDir . '/../lib/Provider/BackupCodesProvider.php', |
|
32 | - 'OCA\\TwoFactorBackupCodes\\Service\\BackupCodeStorage' => $baseDir . '/../lib/Service/BackupCodeStorage.php', |
|
33 | - 'OCA\\TwoFactorBackupCodes\\Settings\\Personal' => $baseDir . '/../lib/Settings/Personal.php', |
|
9 | + 'Composer\\InstalledVersions' => $vendorDir.'/composer/InstalledVersions.php', |
|
10 | + 'OCA\\TwoFactorBackupCodes\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php', |
|
11 | + 'OCA\\TwoFactorBackupCodes\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
12 | + 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\CheckBackupCodes' => $baseDir.'/../lib/BackgroundJob/CheckBackupCodes.php', |
|
13 | + 'OCA\\TwoFactorBackupCodes\\BackgroundJob\\RememberBackupCodesJob' => $baseDir.'/../lib/BackgroundJob/RememberBackupCodesJob.php', |
|
14 | + 'OCA\\TwoFactorBackupCodes\\Controller\\SettingsController' => $baseDir.'/../lib/Controller/SettingsController.php', |
|
15 | + 'OCA\\TwoFactorBackupCodes\\Db\\BackupCode' => $baseDir.'/../lib/Db/BackupCode.php', |
|
16 | + 'OCA\\TwoFactorBackupCodes\\Db\\BackupCodeMapper' => $baseDir.'/../lib/Db/BackupCodeMapper.php', |
|
17 | + 'OCA\\TwoFactorBackupCodes\\Event\\CodesGenerated' => $baseDir.'/../lib/Event/CodesGenerated.php', |
|
18 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ActivityPublisher' => $baseDir.'/../lib/Listener/ActivityPublisher.php', |
|
19 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ClearNotifications' => $baseDir.'/../lib/Listener/ClearNotifications.php', |
|
20 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderDisabled' => $baseDir.'/../lib/Listener/ProviderDisabled.php', |
|
21 | + 'OCA\\TwoFactorBackupCodes\\Listener\\ProviderEnabled' => $baseDir.'/../lib/Listener/ProviderEnabled.php', |
|
22 | + 'OCA\\TwoFactorBackupCodes\\Listener\\RegistryUpdater' => $baseDir.'/../lib/Listener/RegistryUpdater.php', |
|
23 | + 'OCA\\TwoFactorBackupCodes\\Listener\\UserDeleted' => $baseDir.'/../lib/Listener/UserDeleted.php', |
|
24 | + 'OCA\\TwoFactorBackupCodes\\Migration\\CheckBackupCodes' => $baseDir.'/../lib/Migration/CheckBackupCodes.php', |
|
25 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607104347' => $baseDir.'/../lib/Migration/Version1002Date20170607104347.php', |
|
26 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170607113030' => $baseDir.'/../lib/Migration/Version1002Date20170607113030.php', |
|
27 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170919123342' => $baseDir.'/../lib/Migration/Version1002Date20170919123342.php', |
|
28 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20170926101419' => $baseDir.'/../lib/Migration/Version1002Date20170926101419.php', |
|
29 | + 'OCA\\TwoFactorBackupCodes\\Migration\\Version1002Date20180821043638' => $baseDir.'/../lib/Migration/Version1002Date20180821043638.php', |
|
30 | + 'OCA\\TwoFactorBackupCodes\\Notifications\\Notifier' => $baseDir.'/../lib/Notifications/Notifier.php', |
|
31 | + 'OCA\\TwoFactorBackupCodes\\Provider\\BackupCodesProvider' => $baseDir.'/../lib/Provider/BackupCodesProvider.php', |
|
32 | + 'OCA\\TwoFactorBackupCodes\\Service\\BackupCodeStorage' => $baseDir.'/../lib/Service/BackupCodeStorage.php', |
|
33 | + 'OCA\\TwoFactorBackupCodes\\Settings\\Personal' => $baseDir.'/../lib/Settings/Personal.php', |
|
34 | 34 | ); |
@@ -16,10 +16,10 @@ |
||
16 | 16 | <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
17 | 17 | <span class="status success"></span> |
18 | 18 | <?php |
19 | - } elseif ( |
|
20 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | - ) { ?> |
|
19 | + } elseif ( |
|
20 | + (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
21 | + (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
22 | + ) { ?> |
|
23 | 23 | <span class="status indeterminate"></span> |
24 | 24 | <?php } else {?> |
25 | 25 | <span class="status error"></span> |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | Util::addStyle('federation', 'settings-admin'); |
18 | 18 | |
19 | 19 | $urlGenerator = Server::get(IURLGenerator::class); |
20 | -$documentationLink = $urlGenerator->linkToDocs('admin-sharing-federated') . '#configuring-trusted-nextcloud-servers'; |
|
20 | +$documentationLink = $urlGenerator->linkToDocs('admin-sharing-federated').'#configuring-trusted-nextcloud-servers'; |
|
21 | 21 | $documentationLabel = $l->t('External documentation for Federated Cloud Sharing'); |
22 | 22 | ?> |
23 | 23 | <div id="ocFederationSettings" class="section"> |
24 | 24 | <h2> |
25 | 25 | <?php p($l->t('Trusted servers')); ?> |
26 | 26 | <a target="_blank" rel="noreferrer noopener" class="icon-info" |
27 | - title="<?php p($documentationLabel);?>" |
|
27 | + title="<?php p($documentationLabel); ?>" |
|
28 | 28 | href="<?php p($documentationLink); ?>"></a> |
29 | 29 | </h2> |
30 | 30 | <p class="settings-hint"><?php p($l->t('Federation allows you to connect with other trusted servers to exchange the account directory. For example this will be used to auto-complete external accounts for federated sharing. It is not necessary to add a server as trusted server in order to create a federated share.')); ?></p> |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | <ul id="listOfTrustedServers"> |
34 | 34 | <?php foreach ($_['trustedServers'] as $trustedServer) { ?> |
35 | 35 | <li id="<?php p($trustedServer['id']); ?>"> |
36 | - <?php if ((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
36 | + <?php if ((int) $trustedServer['status'] === TrustedServers::STATUS_OK) { ?> |
|
37 | 37 | <span class="status success"></span> |
38 | 38 | <?php |
39 | 39 | } elseif ( |
40 | - (int)$trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
41 | - (int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
40 | + (int) $trustedServer['status'] === TrustedServers::STATUS_PENDING || |
|
41 | + (int) $trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED |
|
42 | 42 | ) { ?> |
43 | 43 | <span class="status indeterminate"></span> |
44 | 44 | <?php } else {?> |