@@ -29,14 +29,14 @@ |
||
29 | 29 | * @since 26.0.0 |
30 | 30 | */ |
31 | 31 | interface IPublicShareTemplateProvider { |
32 | - /** |
|
33 | - * Returns whether the provider can respond for the given share. |
|
34 | - * @since 26.0.0 |
|
35 | - */ |
|
36 | - public function shouldRespond(IShare $share): bool; |
|
37 | - /** |
|
38 | - * Returns the a template for a given share. |
|
39 | - * @since 26.0.0 |
|
40 | - */ |
|
41 | - public function renderPage(IShare $share, string $token, string $path): TemplateResponse; |
|
32 | + /** |
|
33 | + * Returns whether the provider can respond for the given share. |
|
34 | + * @since 26.0.0 |
|
35 | + */ |
|
36 | + public function shouldRespond(IShare $share): bool; |
|
37 | + /** |
|
38 | + * Returns the a template for a given share. |
|
39 | + * @since 26.0.0 |
|
40 | + */ |
|
41 | + public function renderPage(IShare $share, string $token, string $path): TemplateResponse; |
|
42 | 42 | } |
@@ -34,123 +34,123 @@ |
||
34 | 34 | * @since 16.0.0 |
35 | 35 | */ |
36 | 36 | class InMemoryFile implements ISimpleFile { |
37 | - /** |
|
38 | - * Holds the file name. |
|
39 | - */ |
|
40 | - private string $name; |
|
41 | - |
|
42 | - /** |
|
43 | - * Holds the file contents. |
|
44 | - */ |
|
45 | - private string $contents; |
|
46 | - |
|
47 | - /** |
|
48 | - * InMemoryFile constructor. |
|
49 | - * |
|
50 | - * @param string $name The file name |
|
51 | - * @param string $contents The file contents |
|
52 | - * @since 16.0.0 |
|
53 | - */ |
|
54 | - public function __construct(string $name, string $contents) { |
|
55 | - $this->name = $name; |
|
56 | - $this->contents = $contents; |
|
57 | - } |
|
58 | - |
|
59 | - /** |
|
60 | - * @inheritdoc |
|
61 | - * @since 16.0.0 |
|
62 | - */ |
|
63 | - public function getName(): string { |
|
64 | - return $this->name; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * @inheritdoc |
|
69 | - * @since 16.0.0 |
|
70 | - */ |
|
71 | - public function getSize(): int|float { |
|
72 | - return strlen($this->contents); |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * @inheritdoc |
|
77 | - * @since 16.0.0 |
|
78 | - */ |
|
79 | - public function getETag(): string { |
|
80 | - return ''; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @inheritdoc |
|
85 | - * @since 16.0.0 |
|
86 | - */ |
|
87 | - public function getMTime(): int { |
|
88 | - return time(); |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @inheritdoc |
|
93 | - * @since 16.0.0 |
|
94 | - */ |
|
95 | - public function getContent(): string { |
|
96 | - return $this->contents; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @inheritdoc |
|
101 | - * @since 16.0.0 |
|
102 | - */ |
|
103 | - public function putContent($data): void { |
|
104 | - $this->contents = $data; |
|
105 | - } |
|
106 | - |
|
107 | - /** |
|
108 | - * In memory files can't be deleted. |
|
109 | - * |
|
110 | - * @since 16.0.0 |
|
111 | - */ |
|
112 | - public function delete(): void { |
|
113 | - // unimplemented for in memory files |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @inheritdoc |
|
118 | - * @since 16.0.0 |
|
119 | - */ |
|
120 | - public function getMimeType(): string { |
|
121 | - $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
122 | - return $fileInfo->buffer($this->contents); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * {@inheritDoc} |
|
127 | - * @since 24.0.0 |
|
128 | - */ |
|
129 | - public function getExtension(): string { |
|
130 | - return \pathinfo($this->name, PATHINFO_EXTENSION); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Stream reading is unsupported for in memory files. |
|
135 | - * |
|
136 | - * @throws NotPermittedException |
|
137 | - * @since 16.0.0 |
|
138 | - */ |
|
139 | - public function read() { |
|
140 | - throw new NotPermittedException( |
|
141 | - 'Stream reading is unsupported for in memory files' |
|
142 | - ); |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Stream writing isn't available for in memory files. |
|
147 | - * |
|
148 | - * @throws NotPermittedException |
|
149 | - * @since 16.0.0 |
|
150 | - */ |
|
151 | - public function write() { |
|
152 | - throw new NotPermittedException( |
|
153 | - 'Stream writing is unsupported for in memory files' |
|
154 | - ); |
|
155 | - } |
|
37 | + /** |
|
38 | + * Holds the file name. |
|
39 | + */ |
|
40 | + private string $name; |
|
41 | + |
|
42 | + /** |
|
43 | + * Holds the file contents. |
|
44 | + */ |
|
45 | + private string $contents; |
|
46 | + |
|
47 | + /** |
|
48 | + * InMemoryFile constructor. |
|
49 | + * |
|
50 | + * @param string $name The file name |
|
51 | + * @param string $contents The file contents |
|
52 | + * @since 16.0.0 |
|
53 | + */ |
|
54 | + public function __construct(string $name, string $contents) { |
|
55 | + $this->name = $name; |
|
56 | + $this->contents = $contents; |
|
57 | + } |
|
58 | + |
|
59 | + /** |
|
60 | + * @inheritdoc |
|
61 | + * @since 16.0.0 |
|
62 | + */ |
|
63 | + public function getName(): string { |
|
64 | + return $this->name; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * @inheritdoc |
|
69 | + * @since 16.0.0 |
|
70 | + */ |
|
71 | + public function getSize(): int|float { |
|
72 | + return strlen($this->contents); |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * @inheritdoc |
|
77 | + * @since 16.0.0 |
|
78 | + */ |
|
79 | + public function getETag(): string { |
|
80 | + return ''; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @inheritdoc |
|
85 | + * @since 16.0.0 |
|
86 | + */ |
|
87 | + public function getMTime(): int { |
|
88 | + return time(); |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @inheritdoc |
|
93 | + * @since 16.0.0 |
|
94 | + */ |
|
95 | + public function getContent(): string { |
|
96 | + return $this->contents; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @inheritdoc |
|
101 | + * @since 16.0.0 |
|
102 | + */ |
|
103 | + public function putContent($data): void { |
|
104 | + $this->contents = $data; |
|
105 | + } |
|
106 | + |
|
107 | + /** |
|
108 | + * In memory files can't be deleted. |
|
109 | + * |
|
110 | + * @since 16.0.0 |
|
111 | + */ |
|
112 | + public function delete(): void { |
|
113 | + // unimplemented for in memory files |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @inheritdoc |
|
118 | + * @since 16.0.0 |
|
119 | + */ |
|
120 | + public function getMimeType(): string { |
|
121 | + $fileInfo = new \finfo(FILEINFO_MIME_TYPE); |
|
122 | + return $fileInfo->buffer($this->contents); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * {@inheritDoc} |
|
127 | + * @since 24.0.0 |
|
128 | + */ |
|
129 | + public function getExtension(): string { |
|
130 | + return \pathinfo($this->name, PATHINFO_EXTENSION); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Stream reading is unsupported for in memory files. |
|
135 | + * |
|
136 | + * @throws NotPermittedException |
|
137 | + * @since 16.0.0 |
|
138 | + */ |
|
139 | + public function read() { |
|
140 | + throw new NotPermittedException( |
|
141 | + 'Stream reading is unsupported for in memory files' |
|
142 | + ); |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Stream writing isn't available for in memory files. |
|
147 | + * |
|
148 | + * @throws NotPermittedException |
|
149 | + * @since 16.0.0 |
|
150 | + */ |
|
151 | + public function write() { |
|
152 | + throw new NotPermittedException( |
|
153 | + 'Stream writing is unsupported for in memory files' |
|
154 | + ); |
|
155 | + } |
|
156 | 156 | } |
@@ -32,71 +32,71 @@ |
||
32 | 32 | * @since 15.0.0 |
33 | 33 | */ |
34 | 34 | interface IVersion { |
35 | - /** |
|
36 | - * @return IVersionBackend |
|
37 | - * @since 15.0.0 |
|
38 | - */ |
|
39 | - public function getBackend(): IVersionBackend; |
|
35 | + /** |
|
36 | + * @return IVersionBackend |
|
37 | + * @since 15.0.0 |
|
38 | + */ |
|
39 | + public function getBackend(): IVersionBackend; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Get the file info of the source file |
|
43 | - * |
|
44 | - * @return FileInfo |
|
45 | - * @since 15.0.0 |
|
46 | - */ |
|
47 | - public function getSourceFile(): FileInfo; |
|
41 | + /** |
|
42 | + * Get the file info of the source file |
|
43 | + * |
|
44 | + * @return FileInfo |
|
45 | + * @since 15.0.0 |
|
46 | + */ |
|
47 | + public function getSourceFile(): FileInfo; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Get the id of the revision for the file |
|
51 | - * |
|
52 | - * @return int|string |
|
53 | - * @since 15.0.0 |
|
54 | - */ |
|
55 | - public function getRevisionId(); |
|
49 | + /** |
|
50 | + * Get the id of the revision for the file |
|
51 | + * |
|
52 | + * @return int|string |
|
53 | + * @since 15.0.0 |
|
54 | + */ |
|
55 | + public function getRevisionId(); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Get the timestamp this version was created |
|
59 | - * |
|
60 | - * @return int |
|
61 | - * @since 15.0.0 |
|
62 | - */ |
|
63 | - public function getTimestamp(): int; |
|
57 | + /** |
|
58 | + * Get the timestamp this version was created |
|
59 | + * |
|
60 | + * @return int |
|
61 | + * @since 15.0.0 |
|
62 | + */ |
|
63 | + public function getTimestamp(): int; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Get the size of this version |
|
67 | - * |
|
68 | - * @return int|float |
|
69 | - * @since 15.0.0 |
|
70 | - */ |
|
71 | - public function getSize(): int|float; |
|
65 | + /** |
|
66 | + * Get the size of this version |
|
67 | + * |
|
68 | + * @return int|float |
|
69 | + * @since 15.0.0 |
|
70 | + */ |
|
71 | + public function getSize(): int|float; |
|
72 | 72 | |
73 | - /** |
|
74 | - * Get the name of the source file at the time of making this version |
|
75 | - * |
|
76 | - * @return string |
|
77 | - * @since 15.0.0 |
|
78 | - */ |
|
79 | - public function getSourceFileName(): string; |
|
73 | + /** |
|
74 | + * Get the name of the source file at the time of making this version |
|
75 | + * |
|
76 | + * @return string |
|
77 | + * @since 15.0.0 |
|
78 | + */ |
|
79 | + public function getSourceFileName(): string; |
|
80 | 80 | |
81 | - /** |
|
82 | - * Get the mimetype of this version |
|
83 | - * |
|
84 | - * @return string |
|
85 | - * @since 15.0.0 |
|
86 | - */ |
|
87 | - public function getMimeType(): string; |
|
81 | + /** |
|
82 | + * Get the mimetype of this version |
|
83 | + * |
|
84 | + * @return string |
|
85 | + * @since 15.0.0 |
|
86 | + */ |
|
87 | + public function getMimeType(): string; |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get the path of this version |
|
91 | - * |
|
92 | - * @return string |
|
93 | - * @since 15.0.0 |
|
94 | - */ |
|
95 | - public function getVersionPath(): string; |
|
89 | + /** |
|
90 | + * Get the path of this version |
|
91 | + * |
|
92 | + * @return string |
|
93 | + * @since 15.0.0 |
|
94 | + */ |
|
95 | + public function getVersionPath(): string; |
|
96 | 96 | |
97 | - /** |
|
98 | - * @return IUser |
|
99 | - * @since 15.0.0 |
|
100 | - */ |
|
101 | - public function getUser(): IUser; |
|
97 | + /** |
|
98 | + * @return IUser |
|
99 | + * @since 15.0.0 |
|
100 | + */ |
|
101 | + public function getUser(): IUser; |
|
102 | 102 | } |
@@ -44,75 +44,75 @@ |
||
44 | 44 | * @deprecated 20.0.0 use \Psr\Container\ContainerInterface |
45 | 45 | */ |
46 | 46 | interface IContainer extends ContainerInterface { |
47 | - /** |
|
48 | - * @template T |
|
49 | - * |
|
50 | - * If a parameter is not registered in the container try to instantiate it |
|
51 | - * by using reflection to find out how to build the class |
|
52 | - * @param string $name the class name to resolve |
|
53 | - * @psalm-param string|class-string<T> $name |
|
54 | - * @return \stdClass |
|
55 | - * @psalm-return ($name is class-string ? T : mixed) |
|
56 | - * @since 8.2.0 |
|
57 | - * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get |
|
58 | - * @throws ContainerExceptionInterface if the class could not be found or instantiated |
|
59 | - * @throws QueryException if the class could not be found or instantiated |
|
60 | - */ |
|
61 | - public function resolve($name); |
|
47 | + /** |
|
48 | + * @template T |
|
49 | + * |
|
50 | + * If a parameter is not registered in the container try to instantiate it |
|
51 | + * by using reflection to find out how to build the class |
|
52 | + * @param string $name the class name to resolve |
|
53 | + * @psalm-param string|class-string<T> $name |
|
54 | + * @return \stdClass |
|
55 | + * @psalm-return ($name is class-string ? T : mixed) |
|
56 | + * @since 8.2.0 |
|
57 | + * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get |
|
58 | + * @throws ContainerExceptionInterface if the class could not be found or instantiated |
|
59 | + * @throws QueryException if the class could not be found or instantiated |
|
60 | + */ |
|
61 | + public function resolve($name); |
|
62 | 62 | |
63 | - /** |
|
64 | - * Look up a service for a given name in the container. |
|
65 | - * |
|
66 | - * @template T |
|
67 | - * |
|
68 | - * @param string $name |
|
69 | - * @psalm-param string|class-string<T> $name |
|
70 | - * @param bool $autoload Should we try to autoload the service. If we are trying to resolve built in types this makes no sense for example |
|
71 | - * @return mixed |
|
72 | - * @psalm-return ($name is class-string ? T : mixed) |
|
73 | - * @throws ContainerExceptionInterface if the query could not be resolved |
|
74 | - * @throws NotFoundExceptionInterface if the name could not be found within the container |
|
75 | - * @throws QueryException if the query could not be resolved |
|
76 | - * @since 6.0.0 |
|
77 | - * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get |
|
78 | - */ |
|
79 | - public function query(string $name, bool $autoload = true); |
|
63 | + /** |
|
64 | + * Look up a service for a given name in the container. |
|
65 | + * |
|
66 | + * @template T |
|
67 | + * |
|
68 | + * @param string $name |
|
69 | + * @psalm-param string|class-string<T> $name |
|
70 | + * @param bool $autoload Should we try to autoload the service. If we are trying to resolve built in types this makes no sense for example |
|
71 | + * @return mixed |
|
72 | + * @psalm-return ($name is class-string ? T : mixed) |
|
73 | + * @throws ContainerExceptionInterface if the query could not be resolved |
|
74 | + * @throws NotFoundExceptionInterface if the name could not be found within the container |
|
75 | + * @throws QueryException if the query could not be resolved |
|
76 | + * @since 6.0.0 |
|
77 | + * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get |
|
78 | + */ |
|
79 | + public function query(string $name, bool $autoload = true); |
|
80 | 80 | |
81 | - /** |
|
82 | - * A value is stored in the container with it's corresponding name |
|
83 | - * |
|
84 | - * @param string $name |
|
85 | - * @param mixed $value |
|
86 | - * @return void |
|
87 | - * @since 6.0.0 |
|
88 | - * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerParameter |
|
89 | - */ |
|
90 | - public function registerParameter($name, $value); |
|
81 | + /** |
|
82 | + * A value is stored in the container with it's corresponding name |
|
83 | + * |
|
84 | + * @param string $name |
|
85 | + * @param mixed $value |
|
86 | + * @return void |
|
87 | + * @since 6.0.0 |
|
88 | + * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerParameter |
|
89 | + */ |
|
90 | + public function registerParameter($name, $value); |
|
91 | 91 | |
92 | - /** |
|
93 | - * A service is registered in the container where a closure is passed in which will actually |
|
94 | - * create the service on demand. |
|
95 | - * In case the parameter $shared is set to true (the default usage) the once created service will remain in |
|
96 | - * memory and be reused on subsequent calls. |
|
97 | - * In case the parameter is false the service will be recreated on every call. |
|
98 | - * |
|
99 | - * @param string $name |
|
100 | - * @param \Closure $closure |
|
101 | - * @param bool $shared |
|
102 | - * @return void |
|
103 | - * @since 6.0.0 |
|
104 | - * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerService |
|
105 | - */ |
|
106 | - public function registerService($name, Closure $closure, $shared = true); |
|
92 | + /** |
|
93 | + * A service is registered in the container where a closure is passed in which will actually |
|
94 | + * create the service on demand. |
|
95 | + * In case the parameter $shared is set to true (the default usage) the once created service will remain in |
|
96 | + * memory and be reused on subsequent calls. |
|
97 | + * In case the parameter is false the service will be recreated on every call. |
|
98 | + * |
|
99 | + * @param string $name |
|
100 | + * @param \Closure $closure |
|
101 | + * @param bool $shared |
|
102 | + * @return void |
|
103 | + * @since 6.0.0 |
|
104 | + * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerService |
|
105 | + */ |
|
106 | + public function registerService($name, Closure $closure, $shared = true); |
|
107 | 107 | |
108 | - /** |
|
109 | - * Shortcut for returning a service from a service under a different key, |
|
110 | - * e.g. to tell the container to return a class when queried for an |
|
111 | - * interface |
|
112 | - * @param string $alias the alias that should be registered |
|
113 | - * @param string $target the target that should be resolved instead |
|
114 | - * @since 8.2.0 |
|
115 | - * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerServiceAlias |
|
116 | - */ |
|
117 | - public function registerAlias($alias, $target); |
|
108 | + /** |
|
109 | + * Shortcut for returning a service from a service under a different key, |
|
110 | + * e.g. to tell the container to return a class when queried for an |
|
111 | + * interface |
|
112 | + * @param string $alias the alias that should be registered |
|
113 | + * @param string $target the target that should be resolved instead |
|
114 | + * @since 8.2.0 |
|
115 | + * @deprecated 20.0.0 use \OCP\AppFramework\Bootstrap\IRegistrationContext::registerServiceAlias |
|
116 | + */ |
|
117 | + public function registerAlias($alias, $target); |
|
118 | 118 | } |
@@ -28,111 +28,111 @@ |
||
28 | 28 | * @since 8.0.0 |
29 | 29 | */ |
30 | 30 | interface IMountPoint { |
31 | - /** |
|
32 | - * get complete path to the mount point |
|
33 | - * |
|
34 | - * @return string |
|
35 | - * @since 8.0.0 |
|
36 | - */ |
|
37 | - public function getMountPoint(); |
|
31 | + /** |
|
32 | + * get complete path to the mount point |
|
33 | + * |
|
34 | + * @return string |
|
35 | + * @since 8.0.0 |
|
36 | + */ |
|
37 | + public function getMountPoint(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Set the mountpoint |
|
41 | - * |
|
42 | - * @param string $mountPoint new mount point |
|
43 | - * @since 8.0.0 |
|
44 | - */ |
|
45 | - public function setMountPoint($mountPoint); |
|
39 | + /** |
|
40 | + * Set the mountpoint |
|
41 | + * |
|
42 | + * @param string $mountPoint new mount point |
|
43 | + * @since 8.0.0 |
|
44 | + */ |
|
45 | + public function setMountPoint($mountPoint); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get the storage that is mounted |
|
49 | - * |
|
50 | - * @return \OCP\Files\Storage\IStorage|null |
|
51 | - * @since 8.0.0 |
|
52 | - */ |
|
53 | - public function getStorage(); |
|
47 | + /** |
|
48 | + * Get the storage that is mounted |
|
49 | + * |
|
50 | + * @return \OCP\Files\Storage\IStorage|null |
|
51 | + * @since 8.0.0 |
|
52 | + */ |
|
53 | + public function getStorage(); |
|
54 | 54 | |
55 | - /** |
|
56 | - * Get the id of the storages |
|
57 | - * |
|
58 | - * @return string|null |
|
59 | - * @since 8.0.0 |
|
60 | - */ |
|
61 | - public function getStorageId(); |
|
55 | + /** |
|
56 | + * Get the id of the storages |
|
57 | + * |
|
58 | + * @return string|null |
|
59 | + * @since 8.0.0 |
|
60 | + */ |
|
61 | + public function getStorageId(); |
|
62 | 62 | |
63 | - /** |
|
64 | - * Get the id of the storages |
|
65 | - * |
|
66 | - * @return int|null |
|
67 | - * @since 9.1.0 |
|
68 | - */ |
|
69 | - public function getNumericStorageId(); |
|
63 | + /** |
|
64 | + * Get the id of the storages |
|
65 | + * |
|
66 | + * @return int|null |
|
67 | + * @since 9.1.0 |
|
68 | + */ |
|
69 | + public function getNumericStorageId(); |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get the path relative to the mountpoint |
|
73 | - * |
|
74 | - * @param string $path absolute path to a file or folder |
|
75 | - * @return string |
|
76 | - * @since 8.0.0 |
|
77 | - */ |
|
78 | - public function getInternalPath($path); |
|
71 | + /** |
|
72 | + * Get the path relative to the mountpoint |
|
73 | + * |
|
74 | + * @param string $path absolute path to a file or folder |
|
75 | + * @return string |
|
76 | + * @since 8.0.0 |
|
77 | + */ |
|
78 | + public function getInternalPath($path); |
|
79 | 79 | |
80 | - /** |
|
81 | - * Apply a storage wrapper to the mounted storage |
|
82 | - * |
|
83 | - * @param callable $wrapper |
|
84 | - * @since 8.0.0 |
|
85 | - */ |
|
86 | - public function wrapStorage($wrapper); |
|
80 | + /** |
|
81 | + * Apply a storage wrapper to the mounted storage |
|
82 | + * |
|
83 | + * @param callable $wrapper |
|
84 | + * @since 8.0.0 |
|
85 | + */ |
|
86 | + public function wrapStorage($wrapper); |
|
87 | 87 | |
88 | - /** |
|
89 | - * Get a mount option |
|
90 | - * |
|
91 | - * @param string $name Name of the mount option to get |
|
92 | - * @param mixed $default Default value for the mount option |
|
93 | - * @return mixed |
|
94 | - * @since 8.0.0 |
|
95 | - */ |
|
96 | - public function getOption($name, $default); |
|
88 | + /** |
|
89 | + * Get a mount option |
|
90 | + * |
|
91 | + * @param string $name Name of the mount option to get |
|
92 | + * @param mixed $default Default value for the mount option |
|
93 | + * @return mixed |
|
94 | + * @since 8.0.0 |
|
95 | + */ |
|
96 | + public function getOption($name, $default); |
|
97 | 97 | |
98 | - /** |
|
99 | - * Get all options for the mount |
|
100 | - * |
|
101 | - * @return array |
|
102 | - * @since 8.1.0 |
|
103 | - */ |
|
104 | - public function getOptions(); |
|
98 | + /** |
|
99 | + * Get all options for the mount |
|
100 | + * |
|
101 | + * @return array |
|
102 | + * @since 8.1.0 |
|
103 | + */ |
|
104 | + public function getOptions(); |
|
105 | 105 | |
106 | - /** |
|
107 | - * Get the file id of the root of the storage |
|
108 | - * |
|
109 | - * @return int |
|
110 | - * @since 9.1.0 |
|
111 | - */ |
|
112 | - public function getStorageRootId(); |
|
106 | + /** |
|
107 | + * Get the file id of the root of the storage |
|
108 | + * |
|
109 | + * @return int |
|
110 | + * @since 9.1.0 |
|
111 | + */ |
|
112 | + public function getStorageRootId(); |
|
113 | 113 | |
114 | - /** |
|
115 | - * Get the id of the configured mount |
|
116 | - * |
|
117 | - * @return int|null mount id or null if not applicable |
|
118 | - * @since 9.1.0 |
|
119 | - */ |
|
120 | - public function getMountId(); |
|
114 | + /** |
|
115 | + * Get the id of the configured mount |
|
116 | + * |
|
117 | + * @return int|null mount id or null if not applicable |
|
118 | + * @since 9.1.0 |
|
119 | + */ |
|
120 | + public function getMountId(); |
|
121 | 121 | |
122 | - /** |
|
123 | - * Get the type of mount point, used to distinguish things like shares and external storage |
|
124 | - * in the web interface |
|
125 | - * |
|
126 | - * @return string |
|
127 | - * @since 12.0.0 |
|
128 | - */ |
|
129 | - public function getMountType(); |
|
122 | + /** |
|
123 | + * Get the type of mount point, used to distinguish things like shares and external storage |
|
124 | + * in the web interface |
|
125 | + * |
|
126 | + * @return string |
|
127 | + * @since 12.0.0 |
|
128 | + */ |
|
129 | + public function getMountType(); |
|
130 | 130 | |
131 | - /** |
|
132 | - * Get the class of the mount provider that this mount originates from |
|
133 | - * |
|
134 | - * @return string |
|
135 | - * @since 24.0.0 |
|
136 | - */ |
|
137 | - public function getMountProvider(): string; |
|
131 | + /** |
|
132 | + * Get the class of the mount provider that this mount originates from |
|
133 | + * |
|
134 | + * @return string |
|
135 | + * @since 24.0.0 |
|
136 | + */ |
|
137 | + public function getMountProvider(): string; |
|
138 | 138 | } |
@@ -6,35 +6,35 @@ |
||
6 | 6 | use OCP\ICacheFactory; |
7 | 7 | |
8 | 8 | class IMagickSupport { |
9 | - private ICache $cache; |
|
10 | - private ?\Imagick $imagick; |
|
11 | - |
|
12 | - public function __construct(ICacheFactory $cacheFactory) { |
|
13 | - $this->cache = $cacheFactory->createLocal('imagick'); |
|
14 | - |
|
15 | - if (extension_loaded('imagick')) { |
|
16 | - $this->imagick = new \Imagick(); |
|
17 | - } else { |
|
18 | - $this->imagick = null; |
|
19 | - } |
|
20 | - } |
|
21 | - |
|
22 | - public function hasExtension(): bool { |
|
23 | - return !is_null($this->imagick); |
|
24 | - } |
|
25 | - |
|
26 | - public function supportsFormat(string $format): bool { |
|
27 | - if (is_null($this->imagick)) { |
|
28 | - return false; |
|
29 | - } |
|
30 | - |
|
31 | - $cached = $this->cache->get($format); |
|
32 | - if (!is_null($cached)) { |
|
33 | - return $cached; |
|
34 | - } |
|
35 | - |
|
36 | - $formatSupported = count($this->imagick->queryFormats($format)) === 1; |
|
37 | - $this->cache->set($format, $cached); |
|
38 | - return $formatSupported; |
|
39 | - } |
|
9 | + private ICache $cache; |
|
10 | + private ?\Imagick $imagick; |
|
11 | + |
|
12 | + public function __construct(ICacheFactory $cacheFactory) { |
|
13 | + $this->cache = $cacheFactory->createLocal('imagick'); |
|
14 | + |
|
15 | + if (extension_loaded('imagick')) { |
|
16 | + $this->imagick = new \Imagick(); |
|
17 | + } else { |
|
18 | + $this->imagick = null; |
|
19 | + } |
|
20 | + } |
|
21 | + |
|
22 | + public function hasExtension(): bool { |
|
23 | + return !is_null($this->imagick); |
|
24 | + } |
|
25 | + |
|
26 | + public function supportsFormat(string $format): bool { |
|
27 | + if (is_null($this->imagick)) { |
|
28 | + return false; |
|
29 | + } |
|
30 | + |
|
31 | + $cached = $this->cache->get($format); |
|
32 | + if (!is_null($cached)) { |
|
33 | + return $cached; |
|
34 | + } |
|
35 | + |
|
36 | + $formatSupported = count($this->imagick->queryFormats($format)) === 1; |
|
37 | + $this->cache->set($format, $cached); |
|
38 | + return $formatSupported; |
|
39 | + } |
|
40 | 40 | } |
@@ -26,10 +26,10 @@ |
||
26 | 26 | use Doctrine\DBAL\Logging\DebugStack; |
27 | 27 | |
28 | 28 | class BacktraceDebugStack extends DebugStack { |
29 | - public function startQuery($sql, ?array $params = null, ?array $types = null) { |
|
30 | - parent::startQuery($sql, $params, $types); |
|
31 | - $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
32 | - $this->queries[$this->currentQuery]['backtrace'] = $backtrace; |
|
33 | - $this->queries[$this->currentQuery]['start'] = $this->start; |
|
34 | - } |
|
29 | + public function startQuery($sql, ?array $params = null, ?array $types = null) { |
|
30 | + parent::startQuery($sql, $params, $types); |
|
31 | + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
|
32 | + $this->queries[$this->currentQuery]['backtrace'] = $backtrace; |
|
33 | + $this->queries[$this->currentQuery]['start'] = $this->start; |
|
34 | + } |
|
35 | 35 | } |
@@ -9,46 +9,46 @@ |
||
9 | 9 | * Wrap a cache instance with an extra later of local, in-memory caching |
10 | 10 | */ |
11 | 11 | class WithLocalCache implements ICache { |
12 | - private ICache $inner; |
|
13 | - private CappedMemoryCache $cached; |
|
14 | - |
|
15 | - public function __construct(ICache $inner, int $localCapacity = 512) { |
|
16 | - $this->inner = $inner; |
|
17 | - $this->cached = new CappedMemoryCache($localCapacity); |
|
18 | - } |
|
19 | - |
|
20 | - public function get($key) { |
|
21 | - if (isset($this->cached[$key])) { |
|
22 | - return $this->cached[$key]; |
|
23 | - } else { |
|
24 | - $value = $this->inner->get($key); |
|
25 | - if (!is_null($value)) { |
|
26 | - $this->cached[$key] = $value; |
|
27 | - } |
|
28 | - return $value; |
|
29 | - } |
|
30 | - } |
|
31 | - |
|
32 | - public function set($key, $value, $ttl = 0) { |
|
33 | - $this->cached[$key] = $value; |
|
34 | - return $this->inner->set($key, $value, $ttl); |
|
35 | - } |
|
36 | - |
|
37 | - public function hasKey($key) { |
|
38 | - return isset($this->cached[$key]) || $this->inner->hasKey($key); |
|
39 | - } |
|
40 | - |
|
41 | - public function remove($key) { |
|
42 | - unset($this->cached[$key]); |
|
43 | - return $this->inner->remove($key); |
|
44 | - } |
|
45 | - |
|
46 | - public function clear($prefix = '') { |
|
47 | - $this->cached->clear(); |
|
48 | - return $this->inner->clear($prefix); |
|
49 | - } |
|
50 | - |
|
51 | - public static function isAvailable(): bool { |
|
52 | - return false; |
|
53 | - } |
|
12 | + private ICache $inner; |
|
13 | + private CappedMemoryCache $cached; |
|
14 | + |
|
15 | + public function __construct(ICache $inner, int $localCapacity = 512) { |
|
16 | + $this->inner = $inner; |
|
17 | + $this->cached = new CappedMemoryCache($localCapacity); |
|
18 | + } |
|
19 | + |
|
20 | + public function get($key) { |
|
21 | + if (isset($this->cached[$key])) { |
|
22 | + return $this->cached[$key]; |
|
23 | + } else { |
|
24 | + $value = $this->inner->get($key); |
|
25 | + if (!is_null($value)) { |
|
26 | + $this->cached[$key] = $value; |
|
27 | + } |
|
28 | + return $value; |
|
29 | + } |
|
30 | + } |
|
31 | + |
|
32 | + public function set($key, $value, $ttl = 0) { |
|
33 | + $this->cached[$key] = $value; |
|
34 | + return $this->inner->set($key, $value, $ttl); |
|
35 | + } |
|
36 | + |
|
37 | + public function hasKey($key) { |
|
38 | + return isset($this->cached[$key]) || $this->inner->hasKey($key); |
|
39 | + } |
|
40 | + |
|
41 | + public function remove($key) { |
|
42 | + unset($this->cached[$key]); |
|
43 | + return $this->inner->remove($key); |
|
44 | + } |
|
45 | + |
|
46 | + public function clear($prefix = '') { |
|
47 | + $this->cached->clear(); |
|
48 | + return $this->inner->clear($prefix); |
|
49 | + } |
|
50 | + |
|
51 | + public static function isAvailable(): bool { |
|
52 | + return false; |
|
53 | + } |
|
54 | 54 | } |
@@ -34,67 +34,67 @@ |
||
34 | 34 | use Sabre\HTTP\RequestInterface; |
35 | 35 | |
36 | 36 | class LockPlugin extends ServerPlugin { |
37 | - /** |
|
38 | - * Reference to main server object |
|
39 | - * |
|
40 | - * @var \Sabre\DAV\Server |
|
41 | - */ |
|
42 | - private $server; |
|
37 | + /** |
|
38 | + * Reference to main server object |
|
39 | + * |
|
40 | + * @var \Sabre\DAV\Server |
|
41 | + */ |
|
42 | + private $server; |
|
43 | 43 | |
44 | - /** |
|
45 | - * State of the lock |
|
46 | - * |
|
47 | - * @var bool |
|
48 | - */ |
|
49 | - private $isLocked; |
|
44 | + /** |
|
45 | + * State of the lock |
|
46 | + * |
|
47 | + * @var bool |
|
48 | + */ |
|
49 | + private $isLocked; |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inheritdoc} |
|
53 | - */ |
|
54 | - public function initialize(\Sabre\DAV\Server $server) { |
|
55 | - $this->server = $server; |
|
56 | - $this->server->on('beforeMethod:*', [$this, 'getLock'], 50); |
|
57 | - $this->server->on('afterMethod:*', [$this, 'releaseLock'], 50); |
|
58 | - $this->isLocked = false; |
|
59 | - } |
|
51 | + /** |
|
52 | + * {@inheritdoc} |
|
53 | + */ |
|
54 | + public function initialize(\Sabre\DAV\Server $server) { |
|
55 | + $this->server = $server; |
|
56 | + $this->server->on('beforeMethod:*', [$this, 'getLock'], 50); |
|
57 | + $this->server->on('afterMethod:*', [$this, 'releaseLock'], 50); |
|
58 | + $this->isLocked = false; |
|
59 | + } |
|
60 | 60 | |
61 | - public function getLock(RequestInterface $request) { |
|
62 | - // we can't listen on 'beforeMethod:PUT' due to order of operations with setting up the tree |
|
63 | - // so instead we limit ourselves to the PUT method manually |
|
64 | - if ($request->getMethod() !== 'PUT') { |
|
65 | - return; |
|
66 | - } |
|
67 | - try { |
|
68 | - $node = $this->server->tree->getNodeForPath($request->getPath()); |
|
69 | - } catch (NotFound $e) { |
|
70 | - return; |
|
71 | - } |
|
72 | - if ($node instanceof Node) { |
|
73 | - try { |
|
74 | - $node->acquireLock(ILockingProvider::LOCK_SHARED); |
|
75 | - } catch (LockedException $e) { |
|
76 | - throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
|
77 | - } |
|
78 | - $this->isLocked = true; |
|
79 | - } |
|
80 | - } |
|
61 | + public function getLock(RequestInterface $request) { |
|
62 | + // we can't listen on 'beforeMethod:PUT' due to order of operations with setting up the tree |
|
63 | + // so instead we limit ourselves to the PUT method manually |
|
64 | + if ($request->getMethod() !== 'PUT') { |
|
65 | + return; |
|
66 | + } |
|
67 | + try { |
|
68 | + $node = $this->server->tree->getNodeForPath($request->getPath()); |
|
69 | + } catch (NotFound $e) { |
|
70 | + return; |
|
71 | + } |
|
72 | + if ($node instanceof Node) { |
|
73 | + try { |
|
74 | + $node->acquireLock(ILockingProvider::LOCK_SHARED); |
|
75 | + } catch (LockedException $e) { |
|
76 | + throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
|
77 | + } |
|
78 | + $this->isLocked = true; |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | - public function releaseLock(RequestInterface $request) { |
|
83 | - // don't try to release the lock if we never locked one |
|
84 | - if ($this->isLocked === false) { |
|
85 | - return; |
|
86 | - } |
|
87 | - if ($request->getMethod() !== 'PUT') { |
|
88 | - return; |
|
89 | - } |
|
90 | - try { |
|
91 | - $node = $this->server->tree->getNodeForPath($request->getPath()); |
|
92 | - } catch (NotFound $e) { |
|
93 | - return; |
|
94 | - } |
|
95 | - if ($node instanceof Node) { |
|
96 | - $node->releaseLock(ILockingProvider::LOCK_SHARED); |
|
97 | - $this->isLocked = false; |
|
98 | - } |
|
99 | - } |
|
82 | + public function releaseLock(RequestInterface $request) { |
|
83 | + // don't try to release the lock if we never locked one |
|
84 | + if ($this->isLocked === false) { |
|
85 | + return; |
|
86 | + } |
|
87 | + if ($request->getMethod() !== 'PUT') { |
|
88 | + return; |
|
89 | + } |
|
90 | + try { |
|
91 | + $node = $this->server->tree->getNodeForPath($request->getPath()); |
|
92 | + } catch (NotFound $e) { |
|
93 | + return; |
|
94 | + } |
|
95 | + if ($node instanceof Node) { |
|
96 | + $node->releaseLock(ILockingProvider::LOCK_SHARED); |
|
97 | + $this->isLocked = false; |
|
98 | + } |
|
99 | + } |
|
100 | 100 | } |