@@ -155,7 +155,7 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function supportedEntities(): array { |
158 | - return [ File::class ]; |
|
158 | + return [File::class]; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function isAvailableForScope(int $scope): bool { |
@@ -13,86 +13,86 @@ |
||
13 | 13 | |
14 | 14 | class FileSize implements ICheck { |
15 | 15 | |
16 | - /** @var int */ |
|
17 | - protected $size; |
|
16 | + /** @var int */ |
|
17 | + protected $size; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @param IL10N $l |
|
21 | - * @param IRequest $request |
|
22 | - */ |
|
23 | - public function __construct( |
|
24 | - protected IL10N $l, |
|
25 | - protected IRequest $request, |
|
26 | - ) { |
|
27 | - } |
|
19 | + /** |
|
20 | + * @param IL10N $l |
|
21 | + * @param IRequest $request |
|
22 | + */ |
|
23 | + public function __construct( |
|
24 | + protected IL10N $l, |
|
25 | + protected IRequest $request, |
|
26 | + ) { |
|
27 | + } |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param string $operator |
|
31 | - * @param string $value |
|
32 | - * @return bool |
|
33 | - */ |
|
34 | - public function executeCheck($operator, $value) { |
|
35 | - $size = $this->getFileSizeFromHeader(); |
|
29 | + /** |
|
30 | + * @param string $operator |
|
31 | + * @param string $value |
|
32 | + * @return bool |
|
33 | + */ |
|
34 | + public function executeCheck($operator, $value) { |
|
35 | + $size = $this->getFileSizeFromHeader(); |
|
36 | 36 | |
37 | - $value = Util::computerFileSize($value); |
|
38 | - if ($size !== false) { |
|
39 | - switch ($operator) { |
|
40 | - case 'less': |
|
41 | - return $size < $value; |
|
42 | - case '!less': |
|
43 | - return $size >= $value; |
|
44 | - case 'greater': |
|
45 | - return $size > $value; |
|
46 | - case '!greater': |
|
47 | - return $size <= $value; |
|
48 | - } |
|
49 | - } |
|
50 | - return false; |
|
51 | - } |
|
37 | + $value = Util::computerFileSize($value); |
|
38 | + if ($size !== false) { |
|
39 | + switch ($operator) { |
|
40 | + case 'less': |
|
41 | + return $size < $value; |
|
42 | + case '!less': |
|
43 | + return $size >= $value; |
|
44 | + case 'greater': |
|
45 | + return $size > $value; |
|
46 | + case '!greater': |
|
47 | + return $size <= $value; |
|
48 | + } |
|
49 | + } |
|
50 | + return false; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * @param string $operator |
|
55 | - * @param string $value |
|
56 | - * @throws \UnexpectedValueException |
|
57 | - */ |
|
58 | - public function validateCheck($operator, $value) { |
|
59 | - if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { |
|
60 | - throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); |
|
61 | - } |
|
53 | + /** |
|
54 | + * @param string $operator |
|
55 | + * @param string $value |
|
56 | + * @throws \UnexpectedValueException |
|
57 | + */ |
|
58 | + public function validateCheck($operator, $value) { |
|
59 | + if (!in_array($operator, ['less', '!less', 'greater', '!greater'])) { |
|
60 | + throw new \UnexpectedValueException($this->l->t('The given operator is invalid'), 1); |
|
61 | + } |
|
62 | 62 | |
63 | - if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) { |
|
64 | - throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2); |
|
65 | - } |
|
66 | - } |
|
63 | + if (!preg_match('/^[0-9]+[ ]?[kmgt]?b$/i', $value)) { |
|
64 | + throw new \UnexpectedValueException($this->l->t('The given file size is invalid'), 2); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return string |
|
70 | - */ |
|
71 | - protected function getFileSizeFromHeader() { |
|
72 | - if ($this->size !== null) { |
|
73 | - return $this->size; |
|
74 | - } |
|
68 | + /** |
|
69 | + * @return string |
|
70 | + */ |
|
71 | + protected function getFileSizeFromHeader() { |
|
72 | + if ($this->size !== null) { |
|
73 | + return $this->size; |
|
74 | + } |
|
75 | 75 | |
76 | - $size = $this->request->getHeader('OC-Total-Length'); |
|
77 | - if ($size === '') { |
|
78 | - if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
79 | - $size = $this->request->getHeader('Content-Length'); |
|
80 | - } |
|
81 | - } |
|
76 | + $size = $this->request->getHeader('OC-Total-Length'); |
|
77 | + if ($size === '') { |
|
78 | + if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { |
|
79 | + $size = $this->request->getHeader('Content-Length'); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - if ($size === '') { |
|
84 | - $size = false; |
|
85 | - } |
|
83 | + if ($size === '') { |
|
84 | + $size = false; |
|
85 | + } |
|
86 | 86 | |
87 | - $this->size = $size; |
|
88 | - return $this->size; |
|
89 | - } |
|
87 | + $this->size = $size; |
|
88 | + return $this->size; |
|
89 | + } |
|
90 | 90 | |
91 | - public function supportedEntities(): array { |
|
92 | - return [ File::class ]; |
|
93 | - } |
|
91 | + public function supportedEntities(): array { |
|
92 | + return [ File::class ]; |
|
93 | + } |
|
94 | 94 | |
95 | - public function isAvailableForScope(int $scope): bool { |
|
96 | - return true; |
|
97 | - } |
|
95 | + public function isAvailableForScope(int $scope): bool { |
|
96 | + return true; |
|
97 | + } |
|
98 | 98 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | public function supportedEntities(): array { |
158 | - return [ File::class ]; |
|
158 | + return [File::class]; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function isAvailableForScope(int $scope): bool { |
@@ -16,60 +16,60 @@ |
||
16 | 16 | use OCP\WorkflowEngine\IFileCheck; |
17 | 17 | |
18 | 18 | class FileName extends AbstractStringCheck implements IFileCheck { |
19 | - use TFileCheck; |
|
19 | + use TFileCheck; |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param IL10N $l |
|
23 | - * @param IRequest $request |
|
24 | - */ |
|
25 | - public function __construct( |
|
26 | - IL10N $l, |
|
27 | - protected IRequest $request, |
|
28 | - private IMountManager $mountManager, |
|
29 | - ) { |
|
30 | - parent::__construct($l); |
|
31 | - } |
|
21 | + /** |
|
22 | + * @param IL10N $l |
|
23 | + * @param IRequest $request |
|
24 | + */ |
|
25 | + public function __construct( |
|
26 | + IL10N $l, |
|
27 | + protected IRequest $request, |
|
28 | + private IMountManager $mountManager, |
|
29 | + ) { |
|
30 | + parent::__construct($l); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - protected function getActualValue(): string { |
|
37 | - $fileName = $this->path === null ? '' : basename($this->path); |
|
38 | - if ($fileName === '' && (!$this->storage->isLocal() || $this->storage->instanceOfStorage(Local::class))) { |
|
39 | - // Return the mountpoint name of external storage that are not mounted as user home |
|
40 | - $mountPoints = $this->mountManager->findByStorageId($this->storage->getId()); |
|
41 | - if (empty($mountPoints) || $mountPoints[0]->getMountType() !== 'external') { |
|
42 | - return $fileName; |
|
43 | - } |
|
44 | - $mountPointPath = rtrim($mountPoints[0]->getMountPoint(), '/'); |
|
45 | - $mountPointPieces = explode('/', $mountPointPath); |
|
46 | - $mountPointName = array_pop($mountPointPieces); |
|
47 | - if (!empty($mountPointName) && $mountPointName !== 'files' && count($mountPointPieces) !== 2) { |
|
48 | - return $mountPointName; |
|
49 | - } |
|
50 | - } |
|
51 | - return $fileName; |
|
52 | - } |
|
33 | + /** |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + protected function getActualValue(): string { |
|
37 | + $fileName = $this->path === null ? '' : basename($this->path); |
|
38 | + if ($fileName === '' && (!$this->storage->isLocal() || $this->storage->instanceOfStorage(Local::class))) { |
|
39 | + // Return the mountpoint name of external storage that are not mounted as user home |
|
40 | + $mountPoints = $this->mountManager->findByStorageId($this->storage->getId()); |
|
41 | + if (empty($mountPoints) || $mountPoints[0]->getMountType() !== 'external') { |
|
42 | + return $fileName; |
|
43 | + } |
|
44 | + $mountPointPath = rtrim($mountPoints[0]->getMountPoint(), '/'); |
|
45 | + $mountPointPieces = explode('/', $mountPointPath); |
|
46 | + $mountPointName = array_pop($mountPointPieces); |
|
47 | + if (!empty($mountPointName) && $mountPointName !== 'files' && count($mountPointPieces) !== 2) { |
|
48 | + return $mountPointName; |
|
49 | + } |
|
50 | + } |
|
51 | + return $fileName; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * @param string $operator |
|
56 | - * @param string $checkValue |
|
57 | - * @param string $actualValue |
|
58 | - * @return bool |
|
59 | - */ |
|
60 | - protected function executeStringCheck($operator, $checkValue, $actualValue): bool { |
|
61 | - if ($operator === 'is' || $operator === '!is') { |
|
62 | - $checkValue = mb_strtolower($checkValue); |
|
63 | - $actualValue = mb_strtolower($actualValue); |
|
64 | - } |
|
65 | - return parent::executeStringCheck($operator, $checkValue, $actualValue); |
|
66 | - } |
|
54 | + /** |
|
55 | + * @param string $operator |
|
56 | + * @param string $checkValue |
|
57 | + * @param string $actualValue |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | + protected function executeStringCheck($operator, $checkValue, $actualValue): bool { |
|
61 | + if ($operator === 'is' || $operator === '!is') { |
|
62 | + $checkValue = mb_strtolower($checkValue); |
|
63 | + $actualValue = mb_strtolower($actualValue); |
|
64 | + } |
|
65 | + return parent::executeStringCheck($operator, $checkValue, $actualValue); |
|
66 | + } |
|
67 | 67 | |
68 | - public function supportedEntities(): array { |
|
69 | - return [ File::class ]; |
|
70 | - } |
|
68 | + public function supportedEntities(): array { |
|
69 | + return [ File::class ]; |
|
70 | + } |
|
71 | 71 | |
72 | - public function isAvailableForScope(int $scope): bool { |
|
73 | - return true; |
|
74 | - } |
|
72 | + public function isAvailableForScope(int $scope): bool { |
|
73 | + return true; |
|
74 | + } |
|
75 | 75 | } |
@@ -370,18 +370,18 @@ discard block |
||
370 | 370 | private function findFileWithExtension($class, $ext) |
371 | 371 | { |
372 | 372 | // PSR-4 lookup |
373 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
373 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
374 | 374 | |
375 | 375 | $first = $class[0]; |
376 | 376 | if (isset($this->prefixLengthsPsr4[$first])) { |
377 | 377 | $subPath = $class; |
378 | 378 | while (false !== $lastPos = strrpos($subPath, '\\')) { |
379 | 379 | $subPath = substr($subPath, 0, $lastPos); |
380 | - $search = $subPath . '\\'; |
|
380 | + $search = $subPath.'\\'; |
|
381 | 381 | if (isset($this->prefixDirsPsr4[$search])) { |
382 | - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
|
382 | + $pathEnd = DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $lastPos + 1); |
|
383 | 383 | foreach ($this->prefixDirsPsr4[$search] as $dir) { |
384 | - if (file_exists($file = $dir . $pathEnd)) { |
|
384 | + if (file_exists($file = $dir.$pathEnd)) { |
|
385 | 385 | return $file; |
386 | 386 | } |
387 | 387 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | |
392 | 392 | // PSR-4 fallback dirs |
393 | 393 | foreach ($this->fallbackDirsPsr4 as $dir) { |
394 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
394 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
395 | 395 | return $file; |
396 | 396 | } |
397 | 397 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
404 | 404 | } else { |
405 | 405 | // PEAR-like class name |
406 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
406 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | if (isset($this->prefixesPsr0[$first])) { |
410 | 410 | foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
411 | 411 | if (0 === strpos($class, $prefix)) { |
412 | 412 | foreach ($dirs as $dir) { |
413 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
413 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
414 | 414 | return $file; |
415 | 415 | } |
416 | 416 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | // PSR-0 fallback dirs |
422 | 422 | foreach ($this->fallbackDirsPsr0 as $dir) { |
423 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
423 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
424 | 424 | return $file; |
425 | 425 | } |
426 | 426 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Settings\\' => array($baseDir . '/../lib'), |
|
9 | + 'OCA\\Settings\\' => array($baseDir.'/../lib'), |
|
10 | 10 | ); |
@@ -73,10 +73,10 @@ |
||
73 | 73 | Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
74 | 74 | Request::USER_AGENT_FREEBOX, |
75 | 75 | ])) { |
76 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
76 | + $response->addHeader('Content-Disposition', 'attachment; filename="'.rawurlencode($filename).'"'); |
|
77 | 77 | } else { |
78 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
79 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
78 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\''.rawurlencode($filename) |
|
79 | + . '; filename="'.rawurlencode($filename).'"'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -22,71 +22,71 @@ |
||
22 | 22 | use Sabre\HTTP\ResponseInterface; |
23 | 23 | |
24 | 24 | class Plugin extends ServerPlugin { |
25 | - private Server $server; |
|
26 | - |
|
27 | - public const VERSION_LABEL = '{http://nextcloud.org/ns}version-label'; |
|
28 | - |
|
29 | - public const VERSION_AUTHOR = '{http://nextcloud.org/ns}version-author'; // dav property for author |
|
30 | - |
|
31 | - public function __construct( |
|
32 | - private IRequest $request, |
|
33 | - private IPreview $previewManager, |
|
34 | - ) { |
|
35 | - $this->request = $request; |
|
36 | - } |
|
37 | - |
|
38 | - public function initialize(Server $server) { |
|
39 | - $this->server = $server; |
|
40 | - |
|
41 | - $server->on('afterMethod:GET', [$this, 'afterGet']); |
|
42 | - $server->on('propFind', [$this, 'propFind']); |
|
43 | - $server->on('propPatch', [$this, 'propPatch']); |
|
44 | - } |
|
45 | - |
|
46 | - public function afterGet(RequestInterface $request, ResponseInterface $response) { |
|
47 | - $path = $request->getPath(); |
|
48 | - if (!str_starts_with($path, 'versions')) { |
|
49 | - return; |
|
50 | - } |
|
51 | - |
|
52 | - try { |
|
53 | - $node = $this->server->tree->getNodeForPath($path); |
|
54 | - } catch (NotFound $e) { |
|
55 | - return; |
|
56 | - } |
|
57 | - |
|
58 | - if (!($node instanceof VersionFile)) { |
|
59 | - return; |
|
60 | - } |
|
61 | - |
|
62 | - $filename = $node->getVersion()->getSourceFileName(); |
|
63 | - |
|
64 | - if ($this->request->isUserAgent( |
|
65 | - [ |
|
66 | - Request::USER_AGENT_IE, |
|
67 | - Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
|
68 | - Request::USER_AGENT_FREEBOX, |
|
69 | - ])) { |
|
70 | - $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
71 | - } else { |
|
72 | - $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
73 | - . '; filename="' . rawurlencode($filename) . '"'); |
|
74 | - } |
|
75 | - } |
|
76 | - |
|
77 | - public function propFind(PropFind $propFind, INode $node): void { |
|
78 | - if ($node instanceof VersionFile) { |
|
79 | - $propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue('label')); |
|
80 | - $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue('author')); |
|
81 | - $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType())); |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - public function propPatch($path, PropPatch $propPatch): void { |
|
86 | - $node = $this->server->tree->getNodeForPath($path); |
|
87 | - |
|
88 | - if ($node instanceof VersionFile) { |
|
89 | - $propPatch->handle(self::VERSION_LABEL, fn (string $label) => $node->setMetadataValue('label', $label)); |
|
90 | - } |
|
91 | - } |
|
25 | + private Server $server; |
|
26 | + |
|
27 | + public const VERSION_LABEL = '{http://nextcloud.org/ns}version-label'; |
|
28 | + |
|
29 | + public const VERSION_AUTHOR = '{http://nextcloud.org/ns}version-author'; // dav property for author |
|
30 | + |
|
31 | + public function __construct( |
|
32 | + private IRequest $request, |
|
33 | + private IPreview $previewManager, |
|
34 | + ) { |
|
35 | + $this->request = $request; |
|
36 | + } |
|
37 | + |
|
38 | + public function initialize(Server $server) { |
|
39 | + $this->server = $server; |
|
40 | + |
|
41 | + $server->on('afterMethod:GET', [$this, 'afterGet']); |
|
42 | + $server->on('propFind', [$this, 'propFind']); |
|
43 | + $server->on('propPatch', [$this, 'propPatch']); |
|
44 | + } |
|
45 | + |
|
46 | + public function afterGet(RequestInterface $request, ResponseInterface $response) { |
|
47 | + $path = $request->getPath(); |
|
48 | + if (!str_starts_with($path, 'versions')) { |
|
49 | + return; |
|
50 | + } |
|
51 | + |
|
52 | + try { |
|
53 | + $node = $this->server->tree->getNodeForPath($path); |
|
54 | + } catch (NotFound $e) { |
|
55 | + return; |
|
56 | + } |
|
57 | + |
|
58 | + if (!($node instanceof VersionFile)) { |
|
59 | + return; |
|
60 | + } |
|
61 | + |
|
62 | + $filename = $node->getVersion()->getSourceFileName(); |
|
63 | + |
|
64 | + if ($this->request->isUserAgent( |
|
65 | + [ |
|
66 | + Request::USER_AGENT_IE, |
|
67 | + Request::USER_AGENT_ANDROID_MOBILE_CHROME, |
|
68 | + Request::USER_AGENT_FREEBOX, |
|
69 | + ])) { |
|
70 | + $response->addHeader('Content-Disposition', 'attachment; filename="' . rawurlencode($filename) . '"'); |
|
71 | + } else { |
|
72 | + $response->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($filename) |
|
73 | + . '; filename="' . rawurlencode($filename) . '"'); |
|
74 | + } |
|
75 | + } |
|
76 | + |
|
77 | + public function propFind(PropFind $propFind, INode $node): void { |
|
78 | + if ($node instanceof VersionFile) { |
|
79 | + $propFind->handle(self::VERSION_LABEL, fn () => $node->getMetadataValue('label')); |
|
80 | + $propFind->handle(self::VERSION_AUTHOR, fn () => $node->getMetadataValue('author')); |
|
81 | + $propFind->handle(FilesPlugin::HAS_PREVIEW_PROPERTYNAME, fn () => $this->previewManager->isMimeSupported($node->getContentType())); |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + public function propPatch($path, PropPatch $propPatch): void { |
|
86 | + $node = $this->server->tree->getNodeForPath($path); |
|
87 | + |
|
88 | + if ($node instanceof VersionFile) { |
|
89 | + $propPatch->handle(self::VERSION_LABEL, fn (string $label) => $node->setMetadataValue('label', $label)); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | } |
@@ -29,21 +29,21 @@ |
||
29 | 29 | use OC\AppFramework\DependencyInjection\DIContainer; |
30 | 30 | |
31 | 31 | class RouteActionHandler { |
32 | - private $controllerName; |
|
33 | - private $actionName; |
|
34 | - private $container; |
|
32 | + private $controllerName; |
|
33 | + private $actionName; |
|
34 | + private $container; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param string $controllerName |
|
38 | - * @param string $actionName |
|
39 | - */ |
|
40 | - public function __construct(DIContainer $container, $controllerName, $actionName) { |
|
41 | - $this->controllerName = $controllerName; |
|
42 | - $this->actionName = $actionName; |
|
43 | - $this->container = $container; |
|
44 | - } |
|
36 | + /** |
|
37 | + * @param string $controllerName |
|
38 | + * @param string $actionName |
|
39 | + */ |
|
40 | + public function __construct(DIContainer $container, $controllerName, $actionName) { |
|
41 | + $this->controllerName = $controllerName; |
|
42 | + $this->actionName = $actionName; |
|
43 | + $this->container = $container; |
|
44 | + } |
|
45 | 45 | |
46 | - public function __invoke($params) { |
|
47 | - App::main($this->controllerName, $this->actionName, $this->container, $params); |
|
48 | - } |
|
46 | + public function __invoke($params) { |
|
47 | + App::main($this->controllerName, $this->actionName, $this->container, $params); |
|
48 | + } |
|
49 | 49 | } |
@@ -30,48 +30,48 @@ |
||
30 | 30 | use Sabre\DAV\INode; |
31 | 31 | |
32 | 32 | class RestoreFolder implements ICollection, IMoveTarget { |
33 | - public function createFile($name, $data = null) { |
|
34 | - throw new Forbidden(); |
|
35 | - } |
|
33 | + public function createFile($name, $data = null) { |
|
34 | + throw new Forbidden(); |
|
35 | + } |
|
36 | 36 | |
37 | - public function createDirectory($name) { |
|
38 | - throw new Forbidden(); |
|
39 | - } |
|
37 | + public function createDirectory($name) { |
|
38 | + throw new Forbidden(); |
|
39 | + } |
|
40 | 40 | |
41 | - public function getChild($name) { |
|
42 | - return null; |
|
43 | - } |
|
41 | + public function getChild($name) { |
|
42 | + return null; |
|
43 | + } |
|
44 | 44 | |
45 | - public function delete() { |
|
46 | - throw new Forbidden(); |
|
47 | - } |
|
45 | + public function delete() { |
|
46 | + throw new Forbidden(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function getName() { |
|
50 | - return 'restore'; |
|
51 | - } |
|
49 | + public function getName() { |
|
50 | + return 'restore'; |
|
51 | + } |
|
52 | 52 | |
53 | - public function setName($name) { |
|
54 | - throw new Forbidden(); |
|
55 | - } |
|
53 | + public function setName($name) { |
|
54 | + throw new Forbidden(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function getLastModified(): int { |
|
58 | - return 0; |
|
59 | - } |
|
57 | + public function getLastModified(): int { |
|
58 | + return 0; |
|
59 | + } |
|
60 | 60 | |
61 | - public function getChildren(): array { |
|
62 | - return []; |
|
63 | - } |
|
61 | + public function getChildren(): array { |
|
62 | + return []; |
|
63 | + } |
|
64 | 64 | |
65 | - public function childExists($name): bool { |
|
66 | - return false; |
|
67 | - } |
|
65 | + public function childExists($name): bool { |
|
66 | + return false; |
|
67 | + } |
|
68 | 68 | |
69 | - public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { |
|
70 | - if (!($sourceNode instanceof ITrash)) { |
|
71 | - return false; |
|
72 | - } |
|
69 | + public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { |
|
70 | + if (!($sourceNode instanceof ITrash)) { |
|
71 | + return false; |
|
72 | + } |
|
73 | 73 | |
74 | - return $sourceNode->restore(); |
|
75 | - } |
|
74 | + return $sourceNode->restore(); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $gid = $input->getArgument('groupid'); |
66 | 66 | $group = $this->groupManager->get($gid); |
67 | 67 | if ($group) { |
68 | - $output->writeln('<error>Group "' . $gid . '" already exists.</error>'); |
|
68 | + $output->writeln('<error>Group "'.$gid.'" already exists.</error>'); |
|
69 | 69 | return 1; |
70 | 70 | } else { |
71 | 71 | $group = $this->groupManager->createGroup($gid); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | $output->writeln('<error>Could not create group</error>'); |
74 | 74 | return 2; |
75 | 75 | } |
76 | - $output->writeln('Created group "' . $group->getGID() . '"'); |
|
76 | + $output->writeln('Created group "'.$group->getGID().'"'); |
|
77 | 77 | |
78 | - $displayName = trim((string)$input->getOption('display-name')); |
|
78 | + $displayName = trim((string) $input->getOption('display-name')); |
|
79 | 79 | if ($displayName !== '') { |
80 | 80 | $group->setDisplayName($displayName); |
81 | 81 | } |
@@ -36,48 +36,48 @@ |
||
36 | 36 | use Symfony\Component\Console\Output\OutputInterface; |
37 | 37 | |
38 | 38 | class Add extends Base { |
39 | - public function __construct( |
|
40 | - protected IGroupManager $groupManager, |
|
41 | - ) { |
|
42 | - parent::__construct(); |
|
43 | - } |
|
39 | + public function __construct( |
|
40 | + protected IGroupManager $groupManager, |
|
41 | + ) { |
|
42 | + parent::__construct(); |
|
43 | + } |
|
44 | 44 | |
45 | - protected function configure() { |
|
46 | - $this |
|
47 | - ->setName('group:add') |
|
48 | - ->setDescription('Add a group') |
|
49 | - ->addArgument( |
|
50 | - 'groupid', |
|
51 | - InputArgument::REQUIRED, |
|
52 | - 'Group id' |
|
53 | - ) |
|
54 | - ->addOption( |
|
55 | - 'display-name', |
|
56 | - null, |
|
57 | - InputOption::VALUE_REQUIRED, |
|
58 | - 'Group name used in the web UI (can contain any characters)' |
|
59 | - ); |
|
60 | - } |
|
45 | + protected function configure() { |
|
46 | + $this |
|
47 | + ->setName('group:add') |
|
48 | + ->setDescription('Add a group') |
|
49 | + ->addArgument( |
|
50 | + 'groupid', |
|
51 | + InputArgument::REQUIRED, |
|
52 | + 'Group id' |
|
53 | + ) |
|
54 | + ->addOption( |
|
55 | + 'display-name', |
|
56 | + null, |
|
57 | + InputOption::VALUE_REQUIRED, |
|
58 | + 'Group name used in the web UI (can contain any characters)' |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
63 | - $gid = $input->getArgument('groupid'); |
|
64 | - $group = $this->groupManager->get($gid); |
|
65 | - if ($group) { |
|
66 | - $output->writeln('<error>Group "' . $gid . '" already exists.</error>'); |
|
67 | - return 1; |
|
68 | - } else { |
|
69 | - $group = $this->groupManager->createGroup($gid); |
|
70 | - if (!$group instanceof IGroup) { |
|
71 | - $output->writeln('<error>Could not create group</error>'); |
|
72 | - return 2; |
|
73 | - } |
|
74 | - $output->writeln('Created group "' . $group->getGID() . '"'); |
|
62 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
63 | + $gid = $input->getArgument('groupid'); |
|
64 | + $group = $this->groupManager->get($gid); |
|
65 | + if ($group) { |
|
66 | + $output->writeln('<error>Group "' . $gid . '" already exists.</error>'); |
|
67 | + return 1; |
|
68 | + } else { |
|
69 | + $group = $this->groupManager->createGroup($gid); |
|
70 | + if (!$group instanceof IGroup) { |
|
71 | + $output->writeln('<error>Could not create group</error>'); |
|
72 | + return 2; |
|
73 | + } |
|
74 | + $output->writeln('Created group "' . $group->getGID() . '"'); |
|
75 | 75 | |
76 | - $displayName = trim((string)$input->getOption('display-name')); |
|
77 | - if ($displayName !== '') { |
|
78 | - $group->setDisplayName($displayName); |
|
79 | - } |
|
80 | - } |
|
81 | - return 0; |
|
82 | - } |
|
76 | + $displayName = trim((string)$input->getOption('display-name')); |
|
77 | + if ($displayName !== '') { |
|
78 | + $group->setDisplayName($displayName); |
|
79 | + } |
|
80 | + } |
|
81 | + return 0; |
|
82 | + } |
|
83 | 83 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | * @since 18.0.0 |
33 | 33 | */ |
34 | 34 | interface IUrl { |
35 | - /** |
|
36 | - * returns a URL that is related to the entity, e.g. the link to a share |
|
37 | - * |
|
38 | - * @since 18.0.0 |
|
39 | - */ |
|
40 | - public function getUrl(): string; |
|
35 | + /** |
|
36 | + * returns a URL that is related to the entity, e.g. the link to a share |
|
37 | + * |
|
38 | + * @since 18.0.0 |
|
39 | + */ |
|
40 | + public function getUrl(): string; |
|
41 | 41 | } |