@@ -29,46 +29,46 @@ |
||
29 | 29 | |
30 | 30 | class Admin implements ISettings { |
31 | 31 | |
32 | - /** @var IInitialStateService */ |
|
33 | - private $initialStateService; |
|
32 | + /** @var IInitialStateService */ |
|
33 | + private $initialStateService; |
|
34 | 34 | |
35 | - /** @var ClientMapper */ |
|
36 | - private $clientMapper; |
|
35 | + /** @var ClientMapper */ |
|
36 | + private $clientMapper; |
|
37 | 37 | |
38 | - public function __construct(IInitialStateService $initialStateService, |
|
39 | - ClientMapper $clientMapper) { |
|
40 | - $this->initialStateService = $initialStateService; |
|
41 | - $this->clientMapper = $clientMapper; |
|
42 | - } |
|
38 | + public function __construct(IInitialStateService $initialStateService, |
|
39 | + ClientMapper $clientMapper) { |
|
40 | + $this->initialStateService = $initialStateService; |
|
41 | + $this->clientMapper = $clientMapper; |
|
42 | + } |
|
43 | 43 | |
44 | - public function getForm(): TemplateResponse { |
|
45 | - $clients = $this->clientMapper->getClients(); |
|
46 | - $result = []; |
|
44 | + public function getForm(): TemplateResponse { |
|
45 | + $clients = $this->clientMapper->getClients(); |
|
46 | + $result = []; |
|
47 | 47 | |
48 | - foreach ($clients as $client) { |
|
49 | - $result[] = [ |
|
50 | - 'id' => $client->getId(), |
|
51 | - 'name' => $client->getName(), |
|
52 | - 'redirectUri' => $client->getRedirectUri(), |
|
53 | - 'clientId' => $client->getClientIdentifier(), |
|
54 | - 'clientSecret' => $client->getSecret(), |
|
55 | - ]; |
|
56 | - } |
|
57 | - $this->initialStateService->provideInitialState('oauth2', 'clients', $result); |
|
48 | + foreach ($clients as $client) { |
|
49 | + $result[] = [ |
|
50 | + 'id' => $client->getId(), |
|
51 | + 'name' => $client->getName(), |
|
52 | + 'redirectUri' => $client->getRedirectUri(), |
|
53 | + 'clientId' => $client->getClientIdentifier(), |
|
54 | + 'clientSecret' => $client->getSecret(), |
|
55 | + ]; |
|
56 | + } |
|
57 | + $this->initialStateService->provideInitialState('oauth2', 'clients', $result); |
|
58 | 58 | |
59 | - return new TemplateResponse( |
|
60 | - 'oauth2', |
|
61 | - 'admin', |
|
62 | - [], |
|
63 | - '' |
|
64 | - ); |
|
65 | - } |
|
59 | + return new TemplateResponse( |
|
60 | + 'oauth2', |
|
61 | + 'admin', |
|
62 | + [], |
|
63 | + '' |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | - public function getSection(): string { |
|
68 | - return 'security'; |
|
69 | - } |
|
67 | + public function getSection(): string { |
|
68 | + return 'security'; |
|
69 | + } |
|
70 | 70 | |
71 | - public function getPriority(): int { |
|
72 | - return 100; |
|
73 | - } |
|
71 | + public function getPriority(): int { |
|
72 | + return 100; |
|
73 | + } |
|
74 | 74 | } |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | protected function convertLevelString($level) { |
143 | 143 | $level = strtolower($level); |
144 | 144 | switch ($level) { |
145 | - case 'debug': |
|
146 | - return 0; |
|
147 | - case 'info': |
|
148 | - return 1; |
|
149 | - case 'warning': |
|
150 | - case 'warn': |
|
151 | - return 2; |
|
152 | - case 'error': |
|
153 | - case 'err': |
|
154 | - return 3; |
|
155 | - case 'fatal': |
|
156 | - return 4; |
|
145 | + case 'debug': |
|
146 | + return 0; |
|
147 | + case 'info': |
|
148 | + return 1; |
|
149 | + case 'warning': |
|
150 | + case 'warn': |
|
151 | + return 2; |
|
152 | + case 'error': |
|
153 | + case 'err': |
|
154 | + return 3; |
|
155 | + case 'fatal': |
|
156 | + return 4; |
|
157 | 157 | } |
158 | 158 | throw new \InvalidArgumentException('Invalid log level string'); |
159 | 159 | } |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | */ |
166 | 166 | protected function convertLevelNumber($levelNum) { |
167 | 167 | switch ($levelNum) { |
168 | - case 0: |
|
169 | - return 'Debug'; |
|
170 | - case 1: |
|
171 | - return 'Info'; |
|
172 | - case 2: |
|
173 | - return 'Warning'; |
|
174 | - case 3: |
|
175 | - return 'Error'; |
|
176 | - case 4: |
|
177 | - return 'Fatal'; |
|
168 | + case 0: |
|
169 | + return 'Debug'; |
|
170 | + case 1: |
|
171 | + return 'Info'; |
|
172 | + case 2: |
|
173 | + return 'Warning'; |
|
174 | + case 3: |
|
175 | + return 'Error'; |
|
176 | + case 4: |
|
177 | + return 'Fatal'; |
|
178 | 178 | } |
179 | 179 | throw new \InvalidArgumentException('Invalid log level number'); |
180 | 180 | } |
@@ -35,176 +35,176 @@ |
||
35 | 35 | use Symfony\Component\Console\Output\OutputInterface; |
36 | 36 | |
37 | 37 | class Manage extends Command implements CompletionAwareInterface { |
38 | - public const DEFAULT_BACKEND = 'file'; |
|
39 | - public const DEFAULT_LOG_LEVEL = 2; |
|
40 | - public const DEFAULT_TIMEZONE = 'UTC'; |
|
41 | - |
|
42 | - /** @var IConfig */ |
|
43 | - protected $config; |
|
44 | - |
|
45 | - public function __construct(IConfig $config) { |
|
46 | - $this->config = $config; |
|
47 | - parent::__construct(); |
|
48 | - } |
|
49 | - |
|
50 | - protected function configure() { |
|
51 | - $this |
|
52 | - ->setName('log:manage') |
|
53 | - ->setDescription('manage logging configuration') |
|
54 | - ->addOption( |
|
55 | - 'backend', |
|
56 | - null, |
|
57 | - InputOption::VALUE_REQUIRED, |
|
58 | - 'set the logging backend [file, syslog, errorlog, systemd]' |
|
59 | - ) |
|
60 | - ->addOption( |
|
61 | - 'level', |
|
62 | - null, |
|
63 | - InputOption::VALUE_REQUIRED, |
|
64 | - 'set the log level [debug, info, warning, error, fatal]' |
|
65 | - ) |
|
66 | - ->addOption( |
|
67 | - 'timezone', |
|
68 | - null, |
|
69 | - InputOption::VALUE_REQUIRED, |
|
70 | - 'set the logging timezone' |
|
71 | - ) |
|
72 | - ; |
|
73 | - } |
|
74 | - |
|
75 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
76 | - // collate config setting to the end, to avoid partial configuration |
|
77 | - $toBeSet = []; |
|
78 | - |
|
79 | - if ($backend = $input->getOption('backend')) { |
|
80 | - $this->validateBackend($backend); |
|
81 | - $toBeSet['log_type'] = $backend; |
|
82 | - } |
|
83 | - |
|
84 | - $level = $input->getOption('level'); |
|
85 | - if ($level !== null) { |
|
86 | - if (is_numeric($level)) { |
|
87 | - $levelNum = $level; |
|
88 | - // sanity check |
|
89 | - $this->convertLevelNumber($levelNum); |
|
90 | - } else { |
|
91 | - $levelNum = $this->convertLevelString($level); |
|
92 | - } |
|
93 | - $toBeSet['loglevel'] = $levelNum; |
|
94 | - } |
|
95 | - |
|
96 | - if ($timezone = $input->getOption('timezone')) { |
|
97 | - $this->validateTimezone($timezone); |
|
98 | - $toBeSet['logtimezone'] = $timezone; |
|
99 | - } |
|
100 | - |
|
101 | - // set config |
|
102 | - foreach ($toBeSet as $option => $value) { |
|
103 | - $this->config->setSystemValue($option, $value); |
|
104 | - } |
|
105 | - |
|
106 | - // display configuration |
|
107 | - $backend = $this->config->getSystemValue('log_type', self::DEFAULT_BACKEND); |
|
108 | - $output->writeln('Enabled logging backend: '.$backend); |
|
109 | - |
|
110 | - $levelNum = $this->config->getSystemValue('loglevel', self::DEFAULT_LOG_LEVEL); |
|
111 | - $level = $this->convertLevelNumber($levelNum); |
|
112 | - $output->writeln('Log level: '.$level.' ('.$levelNum.')'); |
|
113 | - |
|
114 | - $timezone = $this->config->getSystemValue('logtimezone', self::DEFAULT_TIMEZONE); |
|
115 | - $output->writeln('Log timezone: '.$timezone); |
|
116 | - return 0; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * @param string $backend |
|
121 | - * @throws \InvalidArgumentException |
|
122 | - */ |
|
123 | - protected function validateBackend($backend) { |
|
124 | - if (!class_exists('OC\\Log\\'.ucfirst($backend))) { |
|
125 | - throw new \InvalidArgumentException('Invalid backend'); |
|
126 | - } |
|
127 | - } |
|
128 | - |
|
129 | - /** |
|
130 | - * @param string $timezone |
|
131 | - * @throws \Exception |
|
132 | - */ |
|
133 | - protected function validateTimezone($timezone) { |
|
134 | - new \DateTimeZone($timezone); |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * @param string $level |
|
139 | - * @return int |
|
140 | - * @throws \InvalidArgumentException |
|
141 | - */ |
|
142 | - protected function convertLevelString($level) { |
|
143 | - $level = strtolower($level); |
|
144 | - switch ($level) { |
|
145 | - case 'debug': |
|
146 | - return 0; |
|
147 | - case 'info': |
|
148 | - return 1; |
|
149 | - case 'warning': |
|
150 | - case 'warn': |
|
151 | - return 2; |
|
152 | - case 'error': |
|
153 | - case 'err': |
|
154 | - return 3; |
|
155 | - case 'fatal': |
|
156 | - return 4; |
|
157 | - } |
|
158 | - throw new \InvalidArgumentException('Invalid log level string'); |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * @param int $levelNum |
|
163 | - * @return string |
|
164 | - * @throws \InvalidArgumentException |
|
165 | - */ |
|
166 | - protected function convertLevelNumber($levelNum) { |
|
167 | - switch ($levelNum) { |
|
168 | - case 0: |
|
169 | - return 'Debug'; |
|
170 | - case 1: |
|
171 | - return 'Info'; |
|
172 | - case 2: |
|
173 | - return 'Warning'; |
|
174 | - case 3: |
|
175 | - return 'Error'; |
|
176 | - case 4: |
|
177 | - return 'Fatal'; |
|
178 | - } |
|
179 | - throw new \InvalidArgumentException('Invalid log level number'); |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * @param string $optionName |
|
184 | - * @param CompletionContext $context |
|
185 | - * @return string[] |
|
186 | - */ |
|
187 | - public function completeOptionValues($optionName, CompletionContext $context) { |
|
188 | - if ($optionName === 'backend') { |
|
189 | - return ['file', 'syslog', 'errorlog', 'systemd']; |
|
190 | - } elseif ($optionName === 'level') { |
|
191 | - return ['debug', 'info', 'warning', 'error', 'fatal']; |
|
192 | - } elseif ($optionName === 'timezone') { |
|
193 | - $identifier = \DateTimeZone::listIdentifiers(); |
|
194 | - if ($identifier === false) { |
|
195 | - return []; |
|
196 | - } |
|
197 | - return $identifier; |
|
198 | - } |
|
199 | - return []; |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * @param string $argumentName |
|
204 | - * @param CompletionContext $context |
|
205 | - * @return string[] |
|
206 | - */ |
|
207 | - public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
208 | - return []; |
|
209 | - } |
|
38 | + public const DEFAULT_BACKEND = 'file'; |
|
39 | + public const DEFAULT_LOG_LEVEL = 2; |
|
40 | + public const DEFAULT_TIMEZONE = 'UTC'; |
|
41 | + |
|
42 | + /** @var IConfig */ |
|
43 | + protected $config; |
|
44 | + |
|
45 | + public function __construct(IConfig $config) { |
|
46 | + $this->config = $config; |
|
47 | + parent::__construct(); |
|
48 | + } |
|
49 | + |
|
50 | + protected function configure() { |
|
51 | + $this |
|
52 | + ->setName('log:manage') |
|
53 | + ->setDescription('manage logging configuration') |
|
54 | + ->addOption( |
|
55 | + 'backend', |
|
56 | + null, |
|
57 | + InputOption::VALUE_REQUIRED, |
|
58 | + 'set the logging backend [file, syslog, errorlog, systemd]' |
|
59 | + ) |
|
60 | + ->addOption( |
|
61 | + 'level', |
|
62 | + null, |
|
63 | + InputOption::VALUE_REQUIRED, |
|
64 | + 'set the log level [debug, info, warning, error, fatal]' |
|
65 | + ) |
|
66 | + ->addOption( |
|
67 | + 'timezone', |
|
68 | + null, |
|
69 | + InputOption::VALUE_REQUIRED, |
|
70 | + 'set the logging timezone' |
|
71 | + ) |
|
72 | + ; |
|
73 | + } |
|
74 | + |
|
75 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
76 | + // collate config setting to the end, to avoid partial configuration |
|
77 | + $toBeSet = []; |
|
78 | + |
|
79 | + if ($backend = $input->getOption('backend')) { |
|
80 | + $this->validateBackend($backend); |
|
81 | + $toBeSet['log_type'] = $backend; |
|
82 | + } |
|
83 | + |
|
84 | + $level = $input->getOption('level'); |
|
85 | + if ($level !== null) { |
|
86 | + if (is_numeric($level)) { |
|
87 | + $levelNum = $level; |
|
88 | + // sanity check |
|
89 | + $this->convertLevelNumber($levelNum); |
|
90 | + } else { |
|
91 | + $levelNum = $this->convertLevelString($level); |
|
92 | + } |
|
93 | + $toBeSet['loglevel'] = $levelNum; |
|
94 | + } |
|
95 | + |
|
96 | + if ($timezone = $input->getOption('timezone')) { |
|
97 | + $this->validateTimezone($timezone); |
|
98 | + $toBeSet['logtimezone'] = $timezone; |
|
99 | + } |
|
100 | + |
|
101 | + // set config |
|
102 | + foreach ($toBeSet as $option => $value) { |
|
103 | + $this->config->setSystemValue($option, $value); |
|
104 | + } |
|
105 | + |
|
106 | + // display configuration |
|
107 | + $backend = $this->config->getSystemValue('log_type', self::DEFAULT_BACKEND); |
|
108 | + $output->writeln('Enabled logging backend: '.$backend); |
|
109 | + |
|
110 | + $levelNum = $this->config->getSystemValue('loglevel', self::DEFAULT_LOG_LEVEL); |
|
111 | + $level = $this->convertLevelNumber($levelNum); |
|
112 | + $output->writeln('Log level: '.$level.' ('.$levelNum.')'); |
|
113 | + |
|
114 | + $timezone = $this->config->getSystemValue('logtimezone', self::DEFAULT_TIMEZONE); |
|
115 | + $output->writeln('Log timezone: '.$timezone); |
|
116 | + return 0; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * @param string $backend |
|
121 | + * @throws \InvalidArgumentException |
|
122 | + */ |
|
123 | + protected function validateBackend($backend) { |
|
124 | + if (!class_exists('OC\\Log\\'.ucfirst($backend))) { |
|
125 | + throw new \InvalidArgumentException('Invalid backend'); |
|
126 | + } |
|
127 | + } |
|
128 | + |
|
129 | + /** |
|
130 | + * @param string $timezone |
|
131 | + * @throws \Exception |
|
132 | + */ |
|
133 | + protected function validateTimezone($timezone) { |
|
134 | + new \DateTimeZone($timezone); |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * @param string $level |
|
139 | + * @return int |
|
140 | + * @throws \InvalidArgumentException |
|
141 | + */ |
|
142 | + protected function convertLevelString($level) { |
|
143 | + $level = strtolower($level); |
|
144 | + switch ($level) { |
|
145 | + case 'debug': |
|
146 | + return 0; |
|
147 | + case 'info': |
|
148 | + return 1; |
|
149 | + case 'warning': |
|
150 | + case 'warn': |
|
151 | + return 2; |
|
152 | + case 'error': |
|
153 | + case 'err': |
|
154 | + return 3; |
|
155 | + case 'fatal': |
|
156 | + return 4; |
|
157 | + } |
|
158 | + throw new \InvalidArgumentException('Invalid log level string'); |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * @param int $levelNum |
|
163 | + * @return string |
|
164 | + * @throws \InvalidArgumentException |
|
165 | + */ |
|
166 | + protected function convertLevelNumber($levelNum) { |
|
167 | + switch ($levelNum) { |
|
168 | + case 0: |
|
169 | + return 'Debug'; |
|
170 | + case 1: |
|
171 | + return 'Info'; |
|
172 | + case 2: |
|
173 | + return 'Warning'; |
|
174 | + case 3: |
|
175 | + return 'Error'; |
|
176 | + case 4: |
|
177 | + return 'Fatal'; |
|
178 | + } |
|
179 | + throw new \InvalidArgumentException('Invalid log level number'); |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * @param string $optionName |
|
184 | + * @param CompletionContext $context |
|
185 | + * @return string[] |
|
186 | + */ |
|
187 | + public function completeOptionValues($optionName, CompletionContext $context) { |
|
188 | + if ($optionName === 'backend') { |
|
189 | + return ['file', 'syslog', 'errorlog', 'systemd']; |
|
190 | + } elseif ($optionName === 'level') { |
|
191 | + return ['debug', 'info', 'warning', 'error', 'fatal']; |
|
192 | + } elseif ($optionName === 'timezone') { |
|
193 | + $identifier = \DateTimeZone::listIdentifiers(); |
|
194 | + if ($identifier === false) { |
|
195 | + return []; |
|
196 | + } |
|
197 | + return $identifier; |
|
198 | + } |
|
199 | + return []; |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * @param string $argumentName |
|
204 | + * @param CompletionContext $context |
|
205 | + * @return string[] |
|
206 | + */ |
|
207 | + public function completeArgumentValues($argumentName, CompletionContext $context) { |
|
208 | + return []; |
|
209 | + } |
|
210 | 210 | } |
@@ -27,12 +27,12 @@ |
||
27 | 27 | */ |
28 | 28 | interface ISetDisplayNameBackend { |
29 | 29 | |
30 | - /** |
|
31 | - * @param string $gid |
|
32 | - * @param string $displayName |
|
33 | - * @return bool |
|
34 | - * @since 18.0.0 |
|
35 | - */ |
|
36 | - public function setDisplayName(string $gid, string $displayName): bool; |
|
30 | + /** |
|
31 | + * @param string $gid |
|
32 | + * @param string $displayName |
|
33 | + * @return bool |
|
34 | + * @since 18.0.0 |
|
35 | + */ |
|
36 | + public function setDisplayName(string $gid, string $displayName): bool; |
|
37 | 37 | |
38 | 38 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | */ |
30 | 30 | interface IGetDisplayNameBackend { |
31 | 31 | |
32 | - /** |
|
33 | - * @param string $gid |
|
34 | - * @return string |
|
35 | - * @since 17.0.0 |
|
36 | - */ |
|
37 | - public function getDisplayName(string $gid): string; |
|
32 | + /** |
|
33 | + * @param string $gid |
|
34 | + * @return string |
|
35 | + * @since 17.0.0 |
|
36 | + */ |
|
37 | + public function getDisplayName(string $gid): string; |
|
38 | 38 | |
39 | 39 | } |
@@ -63,49 +63,49 @@ |
||
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) { |
|
66 | + $propFind->handle(self::TRASHBIN_FILENAME, function() use ($node) { |
|
67 | 67 | return $node->getFilename(); |
68 | 68 | }); |
69 | 69 | |
70 | - $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) { |
|
70 | + $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function() use ($node) { |
|
71 | 71 | return $node->getOriginalLocation(); |
72 | 72 | }); |
73 | 73 | |
74 | - $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) { |
|
74 | + $propFind->handle(self::TRASHBIN_TITLE, function() use ($node) { |
|
75 | 75 | return $node->getTitle(); |
76 | 76 | }); |
77 | 77 | |
78 | - $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) { |
|
78 | + $propFind->handle(self::TRASHBIN_DELETION_TIME, function() use ($node) { |
|
79 | 79 | return $node->getDeletionTime(); |
80 | 80 | }); |
81 | 81 | |
82 | - $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) { |
|
82 | + $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function() use ($node) { |
|
83 | 83 | return $node->getSize(); |
84 | 84 | }); |
85 | 85 | |
86 | - $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) { |
|
86 | + $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function() use ($node) { |
|
87 | 87 | return $node->getFileId(); |
88 | 88 | }); |
89 | 89 | |
90 | - $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () { |
|
90 | + $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function() { |
|
91 | 91 | return 'GD'; // read + delete |
92 | 92 | }); |
93 | 93 | |
94 | - $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) { |
|
94 | + $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function() use ($node) { |
|
95 | 95 | // add fake etag, it is only needed to identify the preview image |
96 | 96 | return $node->getLastModified(); |
97 | 97 | }); |
98 | 98 | |
99 | - $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
99 | + $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function() use ($node) { |
|
100 | 100 | // add fake etag, it is only needed to identify the preview image |
101 | 101 | return $node->getFileId(); |
102 | 102 | }); |
103 | 103 | |
104 | - $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
104 | + $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function() use ($node) { |
|
105 | 105 | return $this->previewManager->isAvailable($node->getFileInfo()); |
106 | 106 | }); |
107 | 107 | |
108 | - $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () { |
|
108 | + $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function() { |
|
109 | 109 | return ''; |
110 | 110 | }); |
111 | 111 | } |
@@ -35,79 +35,79 @@ |
||
35 | 35 | use Sabre\DAV\ServerPlugin; |
36 | 36 | |
37 | 37 | class PropfindPlugin extends ServerPlugin { |
38 | - public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; |
|
39 | - public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; |
|
40 | - public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time'; |
|
41 | - public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title'; |
|
38 | + public const TRASHBIN_FILENAME = '{http://nextcloud.org/ns}trashbin-filename'; |
|
39 | + public const TRASHBIN_ORIGINAL_LOCATION = '{http://nextcloud.org/ns}trashbin-original-location'; |
|
40 | + public const TRASHBIN_DELETION_TIME = '{http://nextcloud.org/ns}trashbin-deletion-time'; |
|
41 | + public const TRASHBIN_TITLE = '{http://nextcloud.org/ns}trashbin-title'; |
|
42 | 42 | |
43 | - /** @var Server */ |
|
44 | - private $server; |
|
43 | + /** @var Server */ |
|
44 | + private $server; |
|
45 | 45 | |
46 | - /** @var IPreview */ |
|
47 | - private $previewManager; |
|
46 | + /** @var IPreview */ |
|
47 | + private $previewManager; |
|
48 | 48 | |
49 | - public function __construct( |
|
50 | - IPreview $previewManager |
|
51 | - ) { |
|
52 | - $this->previewManager = $previewManager; |
|
53 | - } |
|
49 | + public function __construct( |
|
50 | + IPreview $previewManager |
|
51 | + ) { |
|
52 | + $this->previewManager = $previewManager; |
|
53 | + } |
|
54 | 54 | |
55 | - public function initialize(Server $server) { |
|
56 | - $this->server = $server; |
|
55 | + public function initialize(Server $server) { |
|
56 | + $this->server = $server; |
|
57 | 57 | |
58 | - $this->server->on('propFind', [$this, 'propFind']); |
|
59 | - } |
|
58 | + $this->server->on('propFind', [$this, 'propFind']); |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - public function propFind(PropFind $propFind, INode $node) { |
|
63 | - if (!($node instanceof ITrash)) { |
|
64 | - return; |
|
65 | - } |
|
62 | + public function propFind(PropFind $propFind, INode $node) { |
|
63 | + if (!($node instanceof ITrash)) { |
|
64 | + return; |
|
65 | + } |
|
66 | 66 | |
67 | - $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) { |
|
68 | - return $node->getFilename(); |
|
69 | - }); |
|
67 | + $propFind->handle(self::TRASHBIN_FILENAME, function () use ($node) { |
|
68 | + return $node->getFilename(); |
|
69 | + }); |
|
70 | 70 | |
71 | - $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) { |
|
72 | - return $node->getOriginalLocation(); |
|
73 | - }); |
|
71 | + $propFind->handle(self::TRASHBIN_ORIGINAL_LOCATION, function () use ($node) { |
|
72 | + return $node->getOriginalLocation(); |
|
73 | + }); |
|
74 | 74 | |
75 | - $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) { |
|
76 | - return $node->getTitle(); |
|
77 | - }); |
|
75 | + $propFind->handle(self::TRASHBIN_TITLE, function () use ($node) { |
|
76 | + return $node->getTitle(); |
|
77 | + }); |
|
78 | 78 | |
79 | - $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) { |
|
80 | - return $node->getDeletionTime(); |
|
81 | - }); |
|
79 | + $propFind->handle(self::TRASHBIN_DELETION_TIME, function () use ($node) { |
|
80 | + return $node->getDeletionTime(); |
|
81 | + }); |
|
82 | 82 | |
83 | - $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) { |
|
84 | - return $node->getSize(); |
|
85 | - }); |
|
83 | + $propFind->handle(FilesPlugin::SIZE_PROPERTYNAME, function () use ($node) { |
|
84 | + return $node->getSize(); |
|
85 | + }); |
|
86 | 86 | |
87 | - $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) { |
|
88 | - return $node->getFileId(); |
|
89 | - }); |
|
87 | + $propFind->handle(FilesPlugin::FILEID_PROPERTYNAME, function () use ($node) { |
|
88 | + return $node->getFileId(); |
|
89 | + }); |
|
90 | 90 | |
91 | - $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () { |
|
92 | - return 'GD'; // read + delete |
|
93 | - }); |
|
91 | + $propFind->handle(FilesPlugin::PERMISSIONS_PROPERTYNAME, function () { |
|
92 | + return 'GD'; // read + delete |
|
93 | + }); |
|
94 | 94 | |
95 | - $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) { |
|
96 | - // add fake etag, it is only needed to identify the preview image |
|
97 | - return $node->getLastModified(); |
|
98 | - }); |
|
95 | + $propFind->handle(FilesPlugin::GETETAG_PROPERTYNAME, function () use ($node) { |
|
96 | + // add fake etag, it is only needed to identify the preview image |
|
97 | + return $node->getLastModified(); |
|
98 | + }); |
|
99 | 99 | |
100 | - $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
101 | - // add fake etag, it is only needed to identify the preview image |
|
102 | - return $node->getFileId(); |
|
103 | - }); |
|
100 | + $propFind->handle(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, function () use ($node) { |
|
101 | + // add fake etag, it is only needed to identify the preview image |
|
102 | + return $node->getFileId(); |
|
103 | + }); |
|
104 | 104 | |
105 | - $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
106 | - return $this->previewManager->isAvailable($node->getFileInfo()); |
|
107 | - }); |
|
105 | + $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, function () use ($node) { |
|
106 | + return $this->previewManager->isAvailable($node->getFileInfo()); |
|
107 | + }); |
|
108 | 108 | |
109 | - $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () { |
|
110 | - return ''; |
|
111 | - }); |
|
112 | - } |
|
109 | + $propFind->handle(FilesPlugin::MOUNT_TYPE_PROPERTYNAME, function () { |
|
110 | + return ''; |
|
111 | + }); |
|
112 | + } |
|
113 | 113 | } |
@@ -26,19 +26,19 @@ |
||
26 | 26 | use OCP\Files\FileInfo; |
27 | 27 | |
28 | 28 | interface ITrash { |
29 | - public function restore(): bool; |
|
29 | + public function restore(): bool; |
|
30 | 30 | |
31 | - public function getFilename(): string; |
|
31 | + public function getFilename(): string; |
|
32 | 32 | |
33 | - public function getOriginalLocation(): string; |
|
33 | + public function getOriginalLocation(): string; |
|
34 | 34 | |
35 | - public function getTitle(): string; |
|
35 | + public function getTitle(): string; |
|
36 | 36 | |
37 | - public function getDeletionTime(): int; |
|
37 | + public function getDeletionTime(): int; |
|
38 | 38 | |
39 | - public function getSize(); |
|
39 | + public function getSize(); |
|
40 | 40 | |
41 | - public function getFileId(): int; |
|
41 | + public function getFileId(): int; |
|
42 | 42 | |
43 | - public function getFileInfo(): FileInfo; |
|
43 | + public function getFileInfo(): FileInfo; |
|
44 | 44 | } |
@@ -28,53 +28,53 @@ |
||
28 | 28 | * @since 15.0.0 |
29 | 29 | */ |
30 | 30 | interface ITrashItem extends FileInfo { |
31 | - /** |
|
32 | - * Get the trash backend for this item |
|
33 | - * |
|
34 | - * @return ITrashBackend |
|
35 | - * @since 15.0.0 |
|
36 | - */ |
|
37 | - public function getTrashBackend(): ITrashBackend; |
|
31 | + /** |
|
32 | + * Get the trash backend for this item |
|
33 | + * |
|
34 | + * @return ITrashBackend |
|
35 | + * @since 15.0.0 |
|
36 | + */ |
|
37 | + public function getTrashBackend(): ITrashBackend; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Get the original location for the trash item |
|
41 | - * |
|
42 | - * @return string |
|
43 | - * @since 15.0.0 |
|
44 | - */ |
|
45 | - public function getOriginalLocation(): string; |
|
39 | + /** |
|
40 | + * Get the original location for the trash item |
|
41 | + * |
|
42 | + * @return string |
|
43 | + * @since 15.0.0 |
|
44 | + */ |
|
45 | + public function getOriginalLocation(): string; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get the timestamp that the file was moved to trash |
|
49 | - * |
|
50 | - * @return int |
|
51 | - * @since 15.0.0 |
|
52 | - */ |
|
53 | - public function getDeletedTime(): int; |
|
47 | + /** |
|
48 | + * Get the timestamp that the file was moved to trash |
|
49 | + * |
|
50 | + * @return int |
|
51 | + * @since 15.0.0 |
|
52 | + */ |
|
53 | + public function getDeletedTime(): int; |
|
54 | 54 | |
55 | - /** |
|
56 | - * Get the path of the item relative to the users trashbin |
|
57 | - * |
|
58 | - * @return string |
|
59 | - * @since 15.0.0 |
|
60 | - */ |
|
61 | - public function getTrashPath(): string; |
|
55 | + /** |
|
56 | + * Get the path of the item relative to the users trashbin |
|
57 | + * |
|
58 | + * @return string |
|
59 | + * @since 15.0.0 |
|
60 | + */ |
|
61 | + public function getTrashPath(): string; |
|
62 | 62 | |
63 | - /** |
|
64 | - * Whether the item is a deleted item in the root of the trash, or a file in a subfolder |
|
65 | - * |
|
66 | - * @return bool |
|
67 | - * @since 15.0.0 |
|
68 | - */ |
|
69 | - public function isRootItem(): bool; |
|
63 | + /** |
|
64 | + * Whether the item is a deleted item in the root of the trash, or a file in a subfolder |
|
65 | + * |
|
66 | + * @return bool |
|
67 | + * @since 15.0.0 |
|
68 | + */ |
|
69 | + public function isRootItem(): bool; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get the user for which this trash item applies |
|
73 | - * |
|
74 | - * @return IUser |
|
75 | - * @since 15.0.0 |
|
76 | - */ |
|
77 | - public function getUser(): IUser; |
|
71 | + /** |
|
72 | + * Get the user for which this trash item applies |
|
73 | + * |
|
74 | + * @return IUser |
|
75 | + * @since 15.0.0 |
|
76 | + */ |
|
77 | + public function getUser(): IUser; |
|
78 | 78 | |
79 | - public function getTitle(): string; |
|
79 | + public function getTitle(): string; |
|
80 | 80 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <div id="two-factor-auth" class="section"> |
32 | - <h2><?php p($l->t('Two-Factor Authentication'));?></h2> |
|
33 | - <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-2fa')); ?>"></a> |
|
32 | + <h2><?php p($l->t('Two-Factor Authentication')); ?></h2> |
|
33 | + <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation')); ?>" href="<?php p(link_to_docs('admin-2fa')); ?>"></a> |
|
34 | 34 | <div id="two-factor-auth-settings"></div> |
35 | 35 | </div> |
36 | 36 | |
37 | 37 | <div class="section" id='encryptionAPI'> |
38 | 38 | <h2><?php p($l->t('Server-side encryption')); ?></h2> |
39 | 39 | <a target="_blank" rel="noreferrer noopener" class="icon-info" |
40 | - title="<?php p($l->t('Open documentation'));?>" |
|
40 | + title="<?php p($l->t('Open documentation')); ?>" |
|
41 | 41 | href="<?php p(link_to_docs('admin-encryption')); ?>"></a> |
42 | 42 | <p class="settings-hint"><?php p($l->t('Server-side encryption makes it possible to encrypt files which are uploaded to this server. This comes with limitations like a performance penalty, so enable this only if needed.')); ?></p> |
43 | 43 | <p id="enable"> |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | <input type="checkbox" |
45 | 45 | id="enableEncryption" class="checkbox" |
46 | 46 | value="1" <?php if ($_['encryptionEnabled']) { |
47 | - print_unescaped('checked="checked" disabled="disabled"'); |
|
47 | + print_unescaped('checked="checked" disabled="disabled"'); |
|
48 | 48 | } ?> /> |
49 | 49 | <label |
50 | 50 | for="enableEncryption"><?php p($l->t('Enable server-side encryption')); ?> <span id="startmigration_msg" class="msg"></span> </label><br/> |
@@ -65,15 +65,15 @@ discard block |
||
65 | 65 | </div> |
66 | 66 | |
67 | 67 | <div id="EncryptionSettingsArea" class="<?php if (!$_['encryptionEnabled']) { |
68 | - p('hidden'); |
|
68 | + p('hidden'); |
|
69 | 69 | } ?>"> |
70 | 70 | <div id='selectEncryptionModules' class="<?php if (!$_['encryptionReady']) { |
71 | - p('hidden'); |
|
71 | + p('hidden'); |
|
72 | 72 | } ?>"> |
73 | 73 | <?php |
74 | - if (empty($_['encryptionModules'])) { |
|
75 | - p($l->t('No encryption module loaded, please enable an encryption module in the app menu.')); |
|
76 | - } else { ?> |
|
74 | + if (empty($_['encryptionModules'])) { |
|
75 | + p($l->t('No encryption module loaded, please enable an encryption module in the app menu.')); |
|
76 | + } else { ?> |
|
77 | 77 | <h3><?php p($l->t('Select default encryption module:')) ?></h3> |
78 | 78 | <fieldset id='encryptionModules'> |
79 | 79 | <?php foreach ($_['encryptionModules'] as $id => $module): ?> |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | name="default_encryption_module" |
82 | 82 | value="<?php p($id) ?>" |
83 | 83 | <?php if ($module['default']) { |
84 | - p('checked'); |
|
85 | - } ?>> |
|
84 | + p('checked'); |
|
85 | + } ?>> |
|
86 | 86 | <label |
87 | 87 | for="<?php p($id) ?>"><?php p($module['displayName']) ?></label> |
88 | 88 | <br/> |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | <?php } ?> |
92 | 92 | </div> |
93 | 93 | <div id="migrationWarning" class="<?php if ($_['encryptionReady']) { |
94 | - p('hidden'); |
|
95 | - } ?>"> |
|
94 | + p('hidden'); |
|
95 | + } ?>"> |
|
96 | 96 | <?php |
97 | - if ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === true) { |
|
98 | - p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run \'occ encryption:migrate\'')); |
|
99 | - } elseif ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === false) { |
|
100 | - p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.')); ?> |
|
97 | + if ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === true) { |
|
98 | + p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run \'occ encryption:migrate\'')); |
|
99 | + } elseif ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === false) { |
|
100 | + p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.')); ?> |
|
101 | 101 | <input type="submit" name="startmigration" id="startmigration" |
102 | 102 | value="<?php p($l->t('Start migration')); ?>"/> |
103 | 103 | <?php |
104 | - } ?> |
|
104 | + } ?> |
|
105 | 105 | </div> |
106 | 106 | </div> |
107 | 107 | </div> |
@@ -28,7 +28,7 @@ |
||
28 | 28 | ?> |
29 | 29 | <div id="theming" class="section"> |
30 | 30 | <h2 class="inlineblock"><?php p($l->t('Theming')); ?></h2> |
31 | - <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation'));?>" href="<?php p(link_to_docs('admin-theming')); ?>"></a> |
|
31 | + <a target="_blank" rel="noreferrer" class="icon-info" title="<?php p($l->t('Open documentation')); ?>" href="<?php p(link_to_docs('admin-theming')); ?>"></a> |
|
32 | 32 | <p class="settings-hint"><?php p($l->t('Theming makes it possible to easily customize the look and feel of your instance and supported clients. This will be visible for all users.')); ?></p> |
33 | 33 | <div id="theming_settings_status"> |
34 | 34 | <div id="theming_settings_loading" class="icon-loading-small" style="display: none;"></div> |