@@ -32,64 +32,64 @@ |
||
32 | 32 | */ |
33 | 33 | interface IMessage { |
34 | 34 | |
35 | - /** |
|
36 | - * @param IAttachment $attachment |
|
37 | - * @return IMessage |
|
38 | - * @since 13.0.0 |
|
39 | - */ |
|
40 | - public function attach(IAttachment $attachment): IMessage; |
|
35 | + /** |
|
36 | + * @param IAttachment $attachment |
|
37 | + * @return IMessage |
|
38 | + * @since 13.0.0 |
|
39 | + */ |
|
40 | + public function attach(IAttachment $attachment): IMessage; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Set the from address of this message. |
|
44 | - * |
|
45 | - * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php |
|
46 | - * |
|
47 | - * @param array $addresses Example: array('[email protected]', '[email protected]' => 'A name') |
|
48 | - * @return IMessage |
|
49 | - * @since 13.0.0 |
|
50 | - */ |
|
51 | - public function setFrom(array $addresses): IMessage; |
|
42 | + /** |
|
43 | + * Set the from address of this message. |
|
44 | + * |
|
45 | + * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php |
|
46 | + * |
|
47 | + * @param array $addresses Example: array('[email protected]', '[email protected]' => 'A name') |
|
48 | + * @return IMessage |
|
49 | + * @since 13.0.0 |
|
50 | + */ |
|
51 | + public function setFrom(array $addresses): IMessage; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Set the Reply-To address of this message |
|
55 | - * |
|
56 | - * @param array $addresses |
|
57 | - * @return IMessage |
|
58 | - * @since 13.0.0 |
|
59 | - */ |
|
60 | - public function setReplyTo(array $addresses): IMessage; |
|
53 | + /** |
|
54 | + * Set the Reply-To address of this message |
|
55 | + * |
|
56 | + * @param array $addresses |
|
57 | + * @return IMessage |
|
58 | + * @since 13.0.0 |
|
59 | + */ |
|
60 | + public function setReplyTo(array $addresses): IMessage; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Set the to addresses of this message. |
|
64 | - * |
|
65 | - * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
66 | - * @return IMessage |
|
67 | - * @since 13.0.0 |
|
68 | - */ |
|
69 | - public function setTo(array $recipients): IMessage; |
|
62 | + /** |
|
63 | + * Set the to addresses of this message. |
|
64 | + * |
|
65 | + * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
66 | + * @return IMessage |
|
67 | + * @since 13.0.0 |
|
68 | + */ |
|
69 | + public function setTo(array $recipients): IMessage; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Set the CC recipients of this message. |
|
73 | - * |
|
74 | - * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
75 | - * @return IMessage |
|
76 | - * @since 13.0.0 |
|
77 | - */ |
|
78 | - public function setCc(array $recipients): IMessage; |
|
71 | + /** |
|
72 | + * Set the CC recipients of this message. |
|
73 | + * |
|
74 | + * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
75 | + * @return IMessage |
|
76 | + * @since 13.0.0 |
|
77 | + */ |
|
78 | + public function setCc(array $recipients): IMessage; |
|
79 | 79 | |
80 | - /** |
|
81 | - * Set the BCC recipients of this message. |
|
82 | - * |
|
83 | - * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
84 | - * @return IMessage |
|
85 | - * @since 13.0.0 |
|
86 | - */ |
|
87 | - public function setBcc(array $recipients): IMessage; |
|
80 | + /** |
|
81 | + * Set the BCC recipients of this message. |
|
82 | + * |
|
83 | + * @param array $recipients Example: array('[email protected]', '[email protected]' => 'A name') |
|
84 | + * @return IMessage |
|
85 | + * @since 13.0.0 |
|
86 | + */ |
|
87 | + public function setBcc(array $recipients): IMessage; |
|
88 | 88 | |
89 | - /** |
|
90 | - * @param IEMailTemplate $emailTemplate |
|
91 | - * @return IMessage |
|
92 | - * @since 13.0.0 |
|
93 | - */ |
|
94 | - public function useTemplate(IEMailTemplate $emailTemplate): IMessage; |
|
89 | + /** |
|
90 | + * @param IEMailTemplate $emailTemplate |
|
91 | + * @return IMessage |
|
92 | + * @since 13.0.0 |
|
93 | + */ |
|
94 | + public function useTemplate(IEMailTemplate $emailTemplate): IMessage; |
|
95 | 95 | } |
@@ -56,117 +56,117 @@ |
||
56 | 56 | */ |
57 | 57 | interface IEMailTemplate { |
58 | 58 | |
59 | - /** |
|
60 | - * Sets the subject of the email |
|
61 | - * |
|
62 | - * @param string $subject |
|
63 | - * |
|
64 | - * @since 13.0.0 |
|
65 | - */ |
|
66 | - public function setSubject(string $subject); |
|
59 | + /** |
|
60 | + * Sets the subject of the email |
|
61 | + * |
|
62 | + * @param string $subject |
|
63 | + * |
|
64 | + * @since 13.0.0 |
|
65 | + */ |
|
66 | + public function setSubject(string $subject); |
|
67 | 67 | |
68 | - /** |
|
69 | - * Adds a header to the email |
|
70 | - * |
|
71 | - * @since 12.0.0 |
|
72 | - */ |
|
73 | - public function addHeader(); |
|
68 | + /** |
|
69 | + * Adds a header to the email |
|
70 | + * |
|
71 | + * @since 12.0.0 |
|
72 | + */ |
|
73 | + public function addHeader(); |
|
74 | 74 | |
75 | - /** |
|
76 | - * Adds a heading to the email |
|
77 | - * |
|
78 | - * @param string $title |
|
79 | - * @param string|bool $plainTitle Title that is used in the plain text email |
|
80 | - * if empty the $title is used, if false none will be used |
|
81 | - * |
|
82 | - * @since 12.0.0 |
|
83 | - */ |
|
84 | - public function addHeading(string $title, $plainTitle = ''); |
|
75 | + /** |
|
76 | + * Adds a heading to the email |
|
77 | + * |
|
78 | + * @param string $title |
|
79 | + * @param string|bool $plainTitle Title that is used in the plain text email |
|
80 | + * if empty the $title is used, if false none will be used |
|
81 | + * |
|
82 | + * @since 12.0.0 |
|
83 | + */ |
|
84 | + public function addHeading(string $title, $plainTitle = ''); |
|
85 | 85 | |
86 | - /** |
|
87 | - * Adds a paragraph to the body of the email |
|
88 | - * |
|
89 | - * @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
90 | - * @param string|bool $plainText Text that is used in the plain text email |
|
91 | - * if empty the $text is used, if false none will be used |
|
92 | - * |
|
93 | - * @since 12.0.0 |
|
94 | - */ |
|
95 | - public function addBodyText(string $text, $plainText = ''); |
|
86 | + /** |
|
87 | + * Adds a paragraph to the body of the email |
|
88 | + * |
|
89 | + * @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
90 | + * @param string|bool $plainText Text that is used in the plain text email |
|
91 | + * if empty the $text is used, if false none will be used |
|
92 | + * |
|
93 | + * @since 12.0.0 |
|
94 | + */ |
|
95 | + public function addBodyText(string $text, $plainText = ''); |
|
96 | 96 | |
97 | - /** |
|
98 | - * Adds a list item to the body of the email |
|
99 | - * |
|
100 | - * @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
101 | - * @param string $metaInfo; Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email |
|
102 | - * @param string $icon Absolute path, must be 16*16 pixels |
|
103 | - * @param string|bool $plainText Text that is used in the plain text email |
|
104 | - * if empty the $text is used, if false none will be used |
|
105 | - * @param string|bool $plainMetaInfo Meta info that is used in the plain text email |
|
106 | - * if empty the $metaInfo is used, if false none will be used |
|
107 | - * @since 12.0.0 |
|
108 | - */ |
|
109 | - public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = ''); |
|
97 | + /** |
|
98 | + * Adds a list item to the body of the email |
|
99 | + * |
|
100 | + * @param string $text; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
101 | + * @param string $metaInfo; Note: When $plainMetaInfo falls back to this, HTML is automatically escaped in the HTML email |
|
102 | + * @param string $icon Absolute path, must be 16*16 pixels |
|
103 | + * @param string|bool $plainText Text that is used in the plain text email |
|
104 | + * if empty the $text is used, if false none will be used |
|
105 | + * @param string|bool $plainMetaInfo Meta info that is used in the plain text email |
|
106 | + * if empty the $metaInfo is used, if false none will be used |
|
107 | + * @since 12.0.0 |
|
108 | + */ |
|
109 | + public function addBodyListItem(string $text, string $metaInfo = '', string $icon = '', $plainText = '', $plainMetaInfo = ''); |
|
110 | 110 | |
111 | - /** |
|
112 | - * Adds a button group of two buttons to the body of the email |
|
113 | - * |
|
114 | - * @param string $textLeft Text of left button; Note: When $plainTextLeft falls back to this, HTML is automatically escaped in the HTML email |
|
115 | - * @param string $urlLeft URL of left button |
|
116 | - * @param string $textRight Text of right button; Note: When $plainTextRight falls back to this, HTML is automatically escaped in the HTML email |
|
117 | - * @param string $urlRight URL of right button |
|
118 | - * @param string $plainTextLeft Text of left button that is used in the plain text version - if empty the $textLeft is used |
|
119 | - * @param string $plainTextRight Text of right button that is used in the plain text version - if empty the $textRight is used |
|
120 | - * |
|
121 | - * @since 12.0.0 |
|
122 | - */ |
|
123 | - public function addBodyButtonGroup(string $textLeft, string $urlLeft, string $textRight, string $urlRight, string $plainTextLeft = '', string $plainTextRight = ''); |
|
111 | + /** |
|
112 | + * Adds a button group of two buttons to the body of the email |
|
113 | + * |
|
114 | + * @param string $textLeft Text of left button; Note: When $plainTextLeft falls back to this, HTML is automatically escaped in the HTML email |
|
115 | + * @param string $urlLeft URL of left button |
|
116 | + * @param string $textRight Text of right button; Note: When $plainTextRight falls back to this, HTML is automatically escaped in the HTML email |
|
117 | + * @param string $urlRight URL of right button |
|
118 | + * @param string $plainTextLeft Text of left button that is used in the plain text version - if empty the $textLeft is used |
|
119 | + * @param string $plainTextRight Text of right button that is used in the plain text version - if empty the $textRight is used |
|
120 | + * |
|
121 | + * @since 12.0.0 |
|
122 | + */ |
|
123 | + public function addBodyButtonGroup(string $textLeft, string $urlLeft, string $textRight, string $urlRight, string $plainTextLeft = '', string $plainTextRight = ''); |
|
124 | 124 | |
125 | - /** |
|
126 | - * Adds a button to the body of the email |
|
127 | - * |
|
128 | - * @param string $text Text of button; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
129 | - * @param string $url URL of button |
|
130 | - * @param string $plainText Text of button in plain text version |
|
131 | - * if empty the $text is used, if false none will be used |
|
132 | - * |
|
133 | - * @since 12.0.0 |
|
134 | - */ |
|
135 | - public function addBodyButton(string $text, string $url, $plainText = ''); |
|
125 | + /** |
|
126 | + * Adds a button to the body of the email |
|
127 | + * |
|
128 | + * @param string $text Text of button; Note: When $plainText falls back to this, HTML is automatically escaped in the HTML email |
|
129 | + * @param string $url URL of button |
|
130 | + * @param string $plainText Text of button in plain text version |
|
131 | + * if empty the $text is used, if false none will be used |
|
132 | + * |
|
133 | + * @since 12.0.0 |
|
134 | + */ |
|
135 | + public function addBodyButton(string $text, string $url, $plainText = ''); |
|
136 | 136 | |
137 | - /** |
|
138 | - * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
139 | - * |
|
140 | - * @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used |
|
141 | - * |
|
142 | - * @since 12.0.0 |
|
143 | - */ |
|
144 | - public function addFooter(string $text = ''); |
|
137 | + /** |
|
138 | + * Adds a logo and a text to the footer. <br> in the text will be replaced by new lines in the plain text email |
|
139 | + * |
|
140 | + * @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used |
|
141 | + * |
|
142 | + * @since 12.0.0 |
|
143 | + */ |
|
144 | + public function addFooter(string $text = ''); |
|
145 | 145 | |
146 | - /** |
|
147 | - * Returns the rendered email subject as string |
|
148 | - * |
|
149 | - * @return string |
|
150 | - * |
|
151 | - * @since 13.0.0 |
|
152 | - */ |
|
153 | - public function renderSubject(): string; |
|
146 | + /** |
|
147 | + * Returns the rendered email subject as string |
|
148 | + * |
|
149 | + * @return string |
|
150 | + * |
|
151 | + * @since 13.0.0 |
|
152 | + */ |
|
153 | + public function renderSubject(): string; |
|
154 | 154 | |
155 | - /** |
|
156 | - * Returns the rendered HTML email as string |
|
157 | - * |
|
158 | - * @return string |
|
159 | - * |
|
160 | - * @since 12.0.0 |
|
161 | - */ |
|
162 | - public function renderHtml(): string; |
|
155 | + /** |
|
156 | + * Returns the rendered HTML email as string |
|
157 | + * |
|
158 | + * @return string |
|
159 | + * |
|
160 | + * @since 12.0.0 |
|
161 | + */ |
|
162 | + public function renderHtml(): string; |
|
163 | 163 | |
164 | - /** |
|
165 | - * Returns the rendered plain text email as string |
|
166 | - * |
|
167 | - * @return string |
|
168 | - * |
|
169 | - * @since 12.0.0 |
|
170 | - */ |
|
171 | - public function renderText(): string; |
|
164 | + /** |
|
165 | + * Returns the rendered plain text email as string |
|
166 | + * |
|
167 | + * @return string |
|
168 | + * |
|
169 | + * @since 12.0.0 |
|
170 | + */ |
|
171 | + public function renderText(): string; |
|
172 | 172 | } |
@@ -32,23 +32,23 @@ |
||
32 | 32 | * @package OC\Security\CSRF |
33 | 33 | */ |
34 | 34 | class CsrfTokenGenerator { |
35 | - /** @var ISecureRandom */ |
|
36 | - private $random; |
|
35 | + /** @var ISecureRandom */ |
|
36 | + private $random; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param ISecureRandom $random |
|
40 | - */ |
|
41 | - public function __construct(ISecureRandom $random) { |
|
42 | - $this->random = $random; |
|
43 | - } |
|
38 | + /** |
|
39 | + * @param ISecureRandom $random |
|
40 | + */ |
|
41 | + public function __construct(ISecureRandom $random) { |
|
42 | + $this->random = $random; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Generate a new CSRF token. |
|
47 | - * |
|
48 | - * @param int $length Length of the token in characters. |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function generateToken(int $length = 32): string { |
|
52 | - return $this->random->generate($length); |
|
53 | - } |
|
45 | + /** |
|
46 | + * Generate a new CSRF token. |
|
47 | + * |
|
48 | + * @param int $length Length of the token in characters. |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function generateToken(int $length = 32): string { |
|
52 | + return $this->random->generate($length); |
|
53 | + } |
|
54 | 54 | } |
@@ -25,25 +25,25 @@ |
||
25 | 25 | namespace OC\Security\IdentityProof; |
26 | 26 | |
27 | 27 | class Key { |
28 | - /** @var string */ |
|
29 | - private $publicKey; |
|
30 | - /** @var string */ |
|
31 | - private $privateKey; |
|
28 | + /** @var string */ |
|
29 | + private $publicKey; |
|
30 | + /** @var string */ |
|
31 | + private $privateKey; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param string $publicKey |
|
35 | - * @param string $privateKey |
|
36 | - */ |
|
37 | - public function __construct(string $publicKey, string $privateKey) { |
|
38 | - $this->publicKey = $publicKey; |
|
39 | - $this->privateKey = $privateKey; |
|
40 | - } |
|
33 | + /** |
|
34 | + * @param string $publicKey |
|
35 | + * @param string $privateKey |
|
36 | + */ |
|
37 | + public function __construct(string $publicKey, string $privateKey) { |
|
38 | + $this->publicKey = $publicKey; |
|
39 | + $this->privateKey = $privateKey; |
|
40 | + } |
|
41 | 41 | |
42 | - public function getPrivate(): string { |
|
43 | - return $this->privateKey; |
|
44 | - } |
|
42 | + public function getPrivate(): string { |
|
43 | + return $this->privateKey; |
|
44 | + } |
|
45 | 45 | |
46 | - public function getPublic(): string { |
|
47 | - return $this->publicKey; |
|
48 | - } |
|
46 | + public function getPublic(): string { |
|
47 | + return $this->publicKey; |
|
48 | + } |
|
49 | 49 | } |
@@ -100,7 +100,7 @@ |
||
100 | 100 | |
101 | 101 | // casted to string because cast to float cause equality for non equal numbers |
102 | 102 | // and integer has the problem of limited size on 32 bit systems |
103 | - if ((string)$expectedSize !== (string)$actualSize) { |
|
103 | + if ((string) $expectedSize !== (string) $actualSize) { |
|
104 | 104 | throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes"); |
105 | 105 | } |
106 | 106 | } |
@@ -32,93 +32,93 @@ |
||
32 | 32 | |
33 | 33 | class ChunkingPlugin extends ServerPlugin { |
34 | 34 | |
35 | - /** @var Server */ |
|
36 | - private $server; |
|
37 | - /** @var FutureFile */ |
|
38 | - private $sourceNode; |
|
35 | + /** @var Server */ |
|
36 | + private $server; |
|
37 | + /** @var FutureFile */ |
|
38 | + private $sourceNode; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @inheritdoc |
|
42 | - */ |
|
43 | - public function initialize(Server $server) { |
|
44 | - $server->on('beforeMove', [$this, 'beforeMove']); |
|
45 | - $this->server = $server; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @inheritdoc |
|
42 | + */ |
|
43 | + public function initialize(Server $server) { |
|
44 | + $server->on('beforeMove', [$this, 'beforeMove']); |
|
45 | + $this->server = $server; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @param string $sourcePath source path |
|
50 | - * @param string $destination destination path |
|
51 | - * @return bool|void |
|
52 | - * @throws BadRequest |
|
53 | - * @throws NotFound |
|
54 | - */ |
|
55 | - public function beforeMove($sourcePath, $destination) { |
|
56 | - $this->sourceNode = $this->server->tree->getNodeForPath($sourcePath); |
|
57 | - if (!$this->sourceNode instanceof FutureFile) { |
|
58 | - // skip handling as the source is not a chunked FutureFile |
|
59 | - return; |
|
60 | - } |
|
48 | + /** |
|
49 | + * @param string $sourcePath source path |
|
50 | + * @param string $destination destination path |
|
51 | + * @return bool|void |
|
52 | + * @throws BadRequest |
|
53 | + * @throws NotFound |
|
54 | + */ |
|
55 | + public function beforeMove($sourcePath, $destination) { |
|
56 | + $this->sourceNode = $this->server->tree->getNodeForPath($sourcePath); |
|
57 | + if (!$this->sourceNode instanceof FutureFile) { |
|
58 | + // skip handling as the source is not a chunked FutureFile |
|
59 | + return; |
|
60 | + } |
|
61 | 61 | |
62 | - try { |
|
63 | - /** @var INode $destinationNode */ |
|
64 | - $destinationNode = $this->server->tree->getNodeForPath($destination); |
|
65 | - if ($destinationNode instanceof Directory) { |
|
66 | - throw new BadRequest("The given destination $destination is a directory."); |
|
67 | - } |
|
68 | - } catch (NotFound $e) { |
|
69 | - // If the destination does not exist yet it's not a directory either ;) |
|
70 | - } |
|
62 | + try { |
|
63 | + /** @var INode $destinationNode */ |
|
64 | + $destinationNode = $this->server->tree->getNodeForPath($destination); |
|
65 | + if ($destinationNode instanceof Directory) { |
|
66 | + throw new BadRequest("The given destination $destination is a directory."); |
|
67 | + } |
|
68 | + } catch (NotFound $e) { |
|
69 | + // If the destination does not exist yet it's not a directory either ;) |
|
70 | + } |
|
71 | 71 | |
72 | - $this->verifySize(); |
|
73 | - return $this->performMove($sourcePath, $destination); |
|
74 | - } |
|
72 | + $this->verifySize(); |
|
73 | + return $this->performMove($sourcePath, $destination); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Move handler for future file. |
|
78 | - * |
|
79 | - * This overrides the default move behavior to prevent Sabre |
|
80 | - * to delete the target file before moving. Because deleting would |
|
81 | - * lose the file id and metadata. |
|
82 | - * |
|
83 | - * @param string $path source path |
|
84 | - * @param string $destination destination path |
|
85 | - * @return bool|void false to stop handling, void to skip this handler |
|
86 | - */ |
|
87 | - public function performMove($path, $destination) { |
|
88 | - if (!$this->server->tree->nodeExists($destination)) { |
|
89 | - // skip and let the default handler do its work |
|
90 | - return; |
|
91 | - } |
|
76 | + /** |
|
77 | + * Move handler for future file. |
|
78 | + * |
|
79 | + * This overrides the default move behavior to prevent Sabre |
|
80 | + * to delete the target file before moving. Because deleting would |
|
81 | + * lose the file id and metadata. |
|
82 | + * |
|
83 | + * @param string $path source path |
|
84 | + * @param string $destination destination path |
|
85 | + * @return bool|void false to stop handling, void to skip this handler |
|
86 | + */ |
|
87 | + public function performMove($path, $destination) { |
|
88 | + if (!$this->server->tree->nodeExists($destination)) { |
|
89 | + // skip and let the default handler do its work |
|
90 | + return; |
|
91 | + } |
|
92 | 92 | |
93 | - // do a move manually, skipping Sabre's default "delete" for existing nodes |
|
94 | - $this->server->tree->move($path, $destination); |
|
93 | + // do a move manually, skipping Sabre's default "delete" for existing nodes |
|
94 | + $this->server->tree->move($path, $destination); |
|
95 | 95 | |
96 | - // trigger all default events (copied from CorePlugin::move) |
|
97 | - $this->server->emit('afterMove', [$path, $destination]); |
|
98 | - $this->server->emit('afterUnbind', [$path]); |
|
99 | - $this->server->emit('afterBind', [$destination]); |
|
96 | + // trigger all default events (copied from CorePlugin::move) |
|
97 | + $this->server->emit('afterMove', [$path, $destination]); |
|
98 | + $this->server->emit('afterUnbind', [$path]); |
|
99 | + $this->server->emit('afterBind', [$destination]); |
|
100 | 100 | |
101 | - $response = $this->server->httpResponse; |
|
102 | - $response->setHeader('Content-Length', '0'); |
|
103 | - $response->setStatus(204); |
|
101 | + $response = $this->server->httpResponse; |
|
102 | + $response->setHeader('Content-Length', '0'); |
|
103 | + $response->setStatus(204); |
|
104 | 104 | |
105 | - return false; |
|
106 | - } |
|
105 | + return false; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * @throws BadRequest |
|
110 | - */ |
|
111 | - private function verifySize() { |
|
112 | - $expectedSize = $this->server->httpRequest->getHeader('OC-Total-Length'); |
|
113 | - if ($expectedSize === null) { |
|
114 | - return; |
|
115 | - } |
|
116 | - $actualSize = $this->sourceNode->getSize(); |
|
108 | + /** |
|
109 | + * @throws BadRequest |
|
110 | + */ |
|
111 | + private function verifySize() { |
|
112 | + $expectedSize = $this->server->httpRequest->getHeader('OC-Total-Length'); |
|
113 | + if ($expectedSize === null) { |
|
114 | + return; |
|
115 | + } |
|
116 | + $actualSize = $this->sourceNode->getSize(); |
|
117 | 117 | |
118 | - // casted to string because cast to float cause equality for non equal numbers |
|
119 | - // and integer has the problem of limited size on 32 bit systems |
|
120 | - if ((string)$expectedSize !== (string)$actualSize) { |
|
121 | - throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes"); |
|
122 | - } |
|
123 | - } |
|
118 | + // casted to string because cast to float cause equality for non equal numbers |
|
119 | + // and integer has the problem of limited size on 32 bit systems |
|
120 | + if ((string)$expectedSize !== (string)$actualSize) { |
|
121 | + throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes"); |
|
122 | + } |
|
123 | + } |
|
124 | 124 | } |
@@ -31,23 +31,23 @@ |
||
31 | 31 | |
32 | 32 | class SearchController extends Controller { |
33 | 33 | |
34 | - /** @var ISearch */ |
|
35 | - private $searcher; |
|
34 | + /** @var ISearch */ |
|
35 | + private $searcher; |
|
36 | 36 | |
37 | - public function __construct(string $appName, |
|
38 | - IRequest $request, |
|
39 | - ISearch $search) { |
|
40 | - parent::__construct($appName, $request); |
|
37 | + public function __construct(string $appName, |
|
38 | + IRequest $request, |
|
39 | + ISearch $search) { |
|
40 | + parent::__construct($appName, $request); |
|
41 | 41 | |
42 | - $this->searcher = $search; |
|
43 | - } |
|
42 | + $this->searcher = $search; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * @NoAdminRequired |
|
47 | - */ |
|
48 | - public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { |
|
49 | - $results = $this->searcher->searchPaged($query, $inApps, $page, $size); |
|
45 | + /** |
|
46 | + * @NoAdminRequired |
|
47 | + */ |
|
48 | + public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { |
|
49 | + $results = $this->searcher->searchPaged($query, $inApps, $page, $size); |
|
50 | 50 | |
51 | - return new JSONResponse($results); |
|
52 | - } |
|
51 | + return new JSONResponse($results); |
|
52 | + } |
|
53 | 53 | } |
@@ -37,396 +37,396 @@ |
||
37 | 37 | use OCP\IDBConnection; |
38 | 38 | |
39 | 39 | class ExpressionBuilder implements IExpressionBuilder { |
40 | - /** @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */ |
|
41 | - protected $expressionBuilder; |
|
40 | + /** @var \Doctrine\DBAL\Query\Expression\ExpressionBuilder */ |
|
41 | + protected $expressionBuilder; |
|
42 | 42 | |
43 | - /** @var QuoteHelper */ |
|
44 | - protected $helper; |
|
43 | + /** @var QuoteHelper */ |
|
44 | + protected $helper; |
|
45 | 45 | |
46 | - /** @var IDBConnection */ |
|
47 | - protected $connection; |
|
46 | + /** @var IDBConnection */ |
|
47 | + protected $connection; |
|
48 | 48 | |
49 | - /** @var FunctionBuilder */ |
|
50 | - protected $functionBuilder; |
|
49 | + /** @var FunctionBuilder */ |
|
50 | + protected $functionBuilder; |
|
51 | 51 | |
52 | - /** |
|
53 | - * Initializes a new <tt>ExpressionBuilder</tt>. |
|
54 | - * |
|
55 | - * @param IDBConnection $connection |
|
56 | - * @param IQueryBuilder $queryBuilder |
|
57 | - */ |
|
58 | - public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) { |
|
59 | - $this->connection = $connection; |
|
60 | - $this->helper = new QuoteHelper(); |
|
61 | - $this->expressionBuilder = new DoctrineExpressionBuilder($connection); |
|
62 | - $this->functionBuilder = $queryBuilder->func(); |
|
63 | - } |
|
52 | + /** |
|
53 | + * Initializes a new <tt>ExpressionBuilder</tt>. |
|
54 | + * |
|
55 | + * @param IDBConnection $connection |
|
56 | + * @param IQueryBuilder $queryBuilder |
|
57 | + */ |
|
58 | + public function __construct(IDBConnection $connection, IQueryBuilder $queryBuilder) { |
|
59 | + $this->connection = $connection; |
|
60 | + $this->helper = new QuoteHelper(); |
|
61 | + $this->expressionBuilder = new DoctrineExpressionBuilder($connection); |
|
62 | + $this->functionBuilder = $queryBuilder->func(); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Creates a conjunction of the given boolean expressions. |
|
67 | - * |
|
68 | - * Example: |
|
69 | - * |
|
70 | - * [php] |
|
71 | - * // (u.type = ?) AND (u.role = ?) |
|
72 | - * $expr->andX('u.type = ?', 'u.role = ?')); |
|
73 | - * |
|
74 | - * @param mixed ...$x Optional clause. Defaults = null, but requires |
|
75 | - * at least one defined when converting to string. |
|
76 | - * |
|
77 | - * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
78 | - */ |
|
79 | - public function andX(...$x) { |
|
80 | - $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x); |
|
81 | - return new CompositeExpression($compositeExpression); |
|
82 | - } |
|
65 | + /** |
|
66 | + * Creates a conjunction of the given boolean expressions. |
|
67 | + * |
|
68 | + * Example: |
|
69 | + * |
|
70 | + * [php] |
|
71 | + * // (u.type = ?) AND (u.role = ?) |
|
72 | + * $expr->andX('u.type = ?', 'u.role = ?')); |
|
73 | + * |
|
74 | + * @param mixed ...$x Optional clause. Defaults = null, but requires |
|
75 | + * at least one defined when converting to string. |
|
76 | + * |
|
77 | + * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
78 | + */ |
|
79 | + public function andX(...$x) { |
|
80 | + $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x); |
|
81 | + return new CompositeExpression($compositeExpression); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Creates a disjunction of the given boolean expressions. |
|
86 | - * |
|
87 | - * Example: |
|
88 | - * |
|
89 | - * [php] |
|
90 | - * // (u.type = ?) OR (u.role = ?) |
|
91 | - * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); |
|
92 | - * |
|
93 | - * @param mixed ...$x Optional clause. Defaults = null, but requires |
|
94 | - * at least one defined when converting to string. |
|
95 | - * |
|
96 | - * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
97 | - */ |
|
98 | - public function orX(...$x) { |
|
99 | - $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x); |
|
100 | - return new CompositeExpression($compositeExpression); |
|
101 | - } |
|
84 | + /** |
|
85 | + * Creates a disjunction of the given boolean expressions. |
|
86 | + * |
|
87 | + * Example: |
|
88 | + * |
|
89 | + * [php] |
|
90 | + * // (u.type = ?) OR (u.role = ?) |
|
91 | + * $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?')); |
|
92 | + * |
|
93 | + * @param mixed ...$x Optional clause. Defaults = null, but requires |
|
94 | + * at least one defined when converting to string. |
|
95 | + * |
|
96 | + * @return \OCP\DB\QueryBuilder\ICompositeExpression |
|
97 | + */ |
|
98 | + public function orX(...$x) { |
|
99 | + $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x); |
|
100 | + return new CompositeExpression($compositeExpression); |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Creates a comparison expression. |
|
105 | - * |
|
106 | - * @param mixed $x The left expression. |
|
107 | - * @param string $operator One of the IExpressionBuilder::* constants. |
|
108 | - * @param mixed $y The right expression. |
|
109 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
110 | - * required when comparing text fields for oci compatibility |
|
111 | - * |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function comparison($x, $operator, $y, $type = null) { |
|
115 | - $x = $this->helper->quoteColumnName($x); |
|
116 | - $y = $this->helper->quoteColumnName($y); |
|
117 | - return $this->expressionBuilder->comparison($x, $operator, $y); |
|
118 | - } |
|
103 | + /** |
|
104 | + * Creates a comparison expression. |
|
105 | + * |
|
106 | + * @param mixed $x The left expression. |
|
107 | + * @param string $operator One of the IExpressionBuilder::* constants. |
|
108 | + * @param mixed $y The right expression. |
|
109 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
110 | + * required when comparing text fields for oci compatibility |
|
111 | + * |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function comparison($x, $operator, $y, $type = null) { |
|
115 | + $x = $this->helper->quoteColumnName($x); |
|
116 | + $y = $this->helper->quoteColumnName($y); |
|
117 | + return $this->expressionBuilder->comparison($x, $operator, $y); |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Creates an equality comparison expression with the given arguments. |
|
122 | - * |
|
123 | - * First argument is considered the left expression and the second is the right expression. |
|
124 | - * When converted to string, it will generated a <left expr> = <right expr>. Example: |
|
125 | - * |
|
126 | - * [php] |
|
127 | - * // u.id = ? |
|
128 | - * $expr->eq('u.id', '?'); |
|
129 | - * |
|
130 | - * @param mixed $x The left expression. |
|
131 | - * @param mixed $y The right expression. |
|
132 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
133 | - * required when comparing text fields for oci compatibility |
|
134 | - * |
|
135 | - * @return string |
|
136 | - */ |
|
137 | - public function eq($x, $y, $type = null) { |
|
138 | - $x = $this->helper->quoteColumnName($x); |
|
139 | - $y = $this->helper->quoteColumnName($y); |
|
140 | - return $this->expressionBuilder->eq($x, $y); |
|
141 | - } |
|
120 | + /** |
|
121 | + * Creates an equality comparison expression with the given arguments. |
|
122 | + * |
|
123 | + * First argument is considered the left expression and the second is the right expression. |
|
124 | + * When converted to string, it will generated a <left expr> = <right expr>. Example: |
|
125 | + * |
|
126 | + * [php] |
|
127 | + * // u.id = ? |
|
128 | + * $expr->eq('u.id', '?'); |
|
129 | + * |
|
130 | + * @param mixed $x The left expression. |
|
131 | + * @param mixed $y The right expression. |
|
132 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
133 | + * required when comparing text fields for oci compatibility |
|
134 | + * |
|
135 | + * @return string |
|
136 | + */ |
|
137 | + public function eq($x, $y, $type = null) { |
|
138 | + $x = $this->helper->quoteColumnName($x); |
|
139 | + $y = $this->helper->quoteColumnName($y); |
|
140 | + return $this->expressionBuilder->eq($x, $y); |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * Creates a non equality comparison expression with the given arguments. |
|
145 | - * First argument is considered the left expression and the second is the right expression. |
|
146 | - * When converted to string, it will generated a <left expr> <> <right expr>. Example: |
|
147 | - * |
|
148 | - * [php] |
|
149 | - * // u.id <> 1 |
|
150 | - * $q->where($q->expr()->neq('u.id', '1')); |
|
151 | - * |
|
152 | - * @param mixed $x The left expression. |
|
153 | - * @param mixed $y The right expression. |
|
154 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
155 | - * required when comparing text fields for oci compatibility |
|
156 | - * |
|
157 | - * @return string |
|
158 | - */ |
|
159 | - public function neq($x, $y, $type = null) { |
|
160 | - $x = $this->helper->quoteColumnName($x); |
|
161 | - $y = $this->helper->quoteColumnName($y); |
|
162 | - return $this->expressionBuilder->neq($x, $y); |
|
163 | - } |
|
143 | + /** |
|
144 | + * Creates a non equality comparison expression with the given arguments. |
|
145 | + * First argument is considered the left expression and the second is the right expression. |
|
146 | + * When converted to string, it will generated a <left expr> <> <right expr>. Example: |
|
147 | + * |
|
148 | + * [php] |
|
149 | + * // u.id <> 1 |
|
150 | + * $q->where($q->expr()->neq('u.id', '1')); |
|
151 | + * |
|
152 | + * @param mixed $x The left expression. |
|
153 | + * @param mixed $y The right expression. |
|
154 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
155 | + * required when comparing text fields for oci compatibility |
|
156 | + * |
|
157 | + * @return string |
|
158 | + */ |
|
159 | + public function neq($x, $y, $type = null) { |
|
160 | + $x = $this->helper->quoteColumnName($x); |
|
161 | + $y = $this->helper->quoteColumnName($y); |
|
162 | + return $this->expressionBuilder->neq($x, $y); |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * Creates a lower-than comparison expression with the given arguments. |
|
167 | - * First argument is considered the left expression and the second is the right expression. |
|
168 | - * When converted to string, it will generated a <left expr> < <right expr>. Example: |
|
169 | - * |
|
170 | - * [php] |
|
171 | - * // u.id < ? |
|
172 | - * $q->where($q->expr()->lt('u.id', '?')); |
|
173 | - * |
|
174 | - * @param mixed $x The left expression. |
|
175 | - * @param mixed $y The right expression. |
|
176 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
177 | - * required when comparing text fields for oci compatibility |
|
178 | - * |
|
179 | - * @return string |
|
180 | - */ |
|
181 | - public function lt($x, $y, $type = null) { |
|
182 | - $x = $this->helper->quoteColumnName($x); |
|
183 | - $y = $this->helper->quoteColumnName($y); |
|
184 | - return $this->expressionBuilder->lt($x, $y); |
|
185 | - } |
|
165 | + /** |
|
166 | + * Creates a lower-than comparison expression with the given arguments. |
|
167 | + * First argument is considered the left expression and the second is the right expression. |
|
168 | + * When converted to string, it will generated a <left expr> < <right expr>. Example: |
|
169 | + * |
|
170 | + * [php] |
|
171 | + * // u.id < ? |
|
172 | + * $q->where($q->expr()->lt('u.id', '?')); |
|
173 | + * |
|
174 | + * @param mixed $x The left expression. |
|
175 | + * @param mixed $y The right expression. |
|
176 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
177 | + * required when comparing text fields for oci compatibility |
|
178 | + * |
|
179 | + * @return string |
|
180 | + */ |
|
181 | + public function lt($x, $y, $type = null) { |
|
182 | + $x = $this->helper->quoteColumnName($x); |
|
183 | + $y = $this->helper->quoteColumnName($y); |
|
184 | + return $this->expressionBuilder->lt($x, $y); |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * Creates a lower-than-equal comparison expression with the given arguments. |
|
189 | - * First argument is considered the left expression and the second is the right expression. |
|
190 | - * When converted to string, it will generated a <left expr> <= <right expr>. Example: |
|
191 | - * |
|
192 | - * [php] |
|
193 | - * // u.id <= ? |
|
194 | - * $q->where($q->expr()->lte('u.id', '?')); |
|
195 | - * |
|
196 | - * @param mixed $x The left expression. |
|
197 | - * @param mixed $y The right expression. |
|
198 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
199 | - * required when comparing text fields for oci compatibility |
|
200 | - * |
|
201 | - * @return string |
|
202 | - */ |
|
203 | - public function lte($x, $y, $type = null) { |
|
204 | - $x = $this->helper->quoteColumnName($x); |
|
205 | - $y = $this->helper->quoteColumnName($y); |
|
206 | - return $this->expressionBuilder->lte($x, $y); |
|
207 | - } |
|
187 | + /** |
|
188 | + * Creates a lower-than-equal comparison expression with the given arguments. |
|
189 | + * First argument is considered the left expression and the second is the right expression. |
|
190 | + * When converted to string, it will generated a <left expr> <= <right expr>. Example: |
|
191 | + * |
|
192 | + * [php] |
|
193 | + * // u.id <= ? |
|
194 | + * $q->where($q->expr()->lte('u.id', '?')); |
|
195 | + * |
|
196 | + * @param mixed $x The left expression. |
|
197 | + * @param mixed $y The right expression. |
|
198 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
199 | + * required when comparing text fields for oci compatibility |
|
200 | + * |
|
201 | + * @return string |
|
202 | + */ |
|
203 | + public function lte($x, $y, $type = null) { |
|
204 | + $x = $this->helper->quoteColumnName($x); |
|
205 | + $y = $this->helper->quoteColumnName($y); |
|
206 | + return $this->expressionBuilder->lte($x, $y); |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * Creates a greater-than comparison expression with the given arguments. |
|
211 | - * First argument is considered the left expression and the second is the right expression. |
|
212 | - * When converted to string, it will generated a <left expr> > <right expr>. Example: |
|
213 | - * |
|
214 | - * [php] |
|
215 | - * // u.id > ? |
|
216 | - * $q->where($q->expr()->gt('u.id', '?')); |
|
217 | - * |
|
218 | - * @param mixed $x The left expression. |
|
219 | - * @param mixed $y The right expression. |
|
220 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
221 | - * required when comparing text fields for oci compatibility |
|
222 | - * |
|
223 | - * @return string |
|
224 | - */ |
|
225 | - public function gt($x, $y, $type = null) { |
|
226 | - $x = $this->helper->quoteColumnName($x); |
|
227 | - $y = $this->helper->quoteColumnName($y); |
|
228 | - return $this->expressionBuilder->gt($x, $y); |
|
229 | - } |
|
209 | + /** |
|
210 | + * Creates a greater-than comparison expression with the given arguments. |
|
211 | + * First argument is considered the left expression and the second is the right expression. |
|
212 | + * When converted to string, it will generated a <left expr> > <right expr>. Example: |
|
213 | + * |
|
214 | + * [php] |
|
215 | + * // u.id > ? |
|
216 | + * $q->where($q->expr()->gt('u.id', '?')); |
|
217 | + * |
|
218 | + * @param mixed $x The left expression. |
|
219 | + * @param mixed $y The right expression. |
|
220 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
221 | + * required when comparing text fields for oci compatibility |
|
222 | + * |
|
223 | + * @return string |
|
224 | + */ |
|
225 | + public function gt($x, $y, $type = null) { |
|
226 | + $x = $this->helper->quoteColumnName($x); |
|
227 | + $y = $this->helper->quoteColumnName($y); |
|
228 | + return $this->expressionBuilder->gt($x, $y); |
|
229 | + } |
|
230 | 230 | |
231 | - /** |
|
232 | - * Creates a greater-than-equal comparison expression with the given arguments. |
|
233 | - * First argument is considered the left expression and the second is the right expression. |
|
234 | - * When converted to string, it will generated a <left expr> >= <right expr>. Example: |
|
235 | - * |
|
236 | - * [php] |
|
237 | - * // u.id >= ? |
|
238 | - * $q->where($q->expr()->gte('u.id', '?')); |
|
239 | - * |
|
240 | - * @param mixed $x The left expression. |
|
241 | - * @param mixed $y The right expression. |
|
242 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
243 | - * required when comparing text fields for oci compatibility |
|
244 | - * |
|
245 | - * @return string |
|
246 | - */ |
|
247 | - public function gte($x, $y, $type = null) { |
|
248 | - $x = $this->helper->quoteColumnName($x); |
|
249 | - $y = $this->helper->quoteColumnName($y); |
|
250 | - return $this->expressionBuilder->gte($x, $y); |
|
251 | - } |
|
231 | + /** |
|
232 | + * Creates a greater-than-equal comparison expression with the given arguments. |
|
233 | + * First argument is considered the left expression and the second is the right expression. |
|
234 | + * When converted to string, it will generated a <left expr> >= <right expr>. Example: |
|
235 | + * |
|
236 | + * [php] |
|
237 | + * // u.id >= ? |
|
238 | + * $q->where($q->expr()->gte('u.id', '?')); |
|
239 | + * |
|
240 | + * @param mixed $x The left expression. |
|
241 | + * @param mixed $y The right expression. |
|
242 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
243 | + * required when comparing text fields for oci compatibility |
|
244 | + * |
|
245 | + * @return string |
|
246 | + */ |
|
247 | + public function gte($x, $y, $type = null) { |
|
248 | + $x = $this->helper->quoteColumnName($x); |
|
249 | + $y = $this->helper->quoteColumnName($y); |
|
250 | + return $this->expressionBuilder->gte($x, $y); |
|
251 | + } |
|
252 | 252 | |
253 | - /** |
|
254 | - * Creates an IS NULL expression with the given arguments. |
|
255 | - * |
|
256 | - * @param string $x The field in string format to be restricted by IS NULL. |
|
257 | - * |
|
258 | - * @return string |
|
259 | - */ |
|
260 | - public function isNull($x) { |
|
261 | - $x = $this->helper->quoteColumnName($x); |
|
262 | - return $this->expressionBuilder->isNull($x); |
|
263 | - } |
|
253 | + /** |
|
254 | + * Creates an IS NULL expression with the given arguments. |
|
255 | + * |
|
256 | + * @param string $x The field in string format to be restricted by IS NULL. |
|
257 | + * |
|
258 | + * @return string |
|
259 | + */ |
|
260 | + public function isNull($x) { |
|
261 | + $x = $this->helper->quoteColumnName($x); |
|
262 | + return $this->expressionBuilder->isNull($x); |
|
263 | + } |
|
264 | 264 | |
265 | - /** |
|
266 | - * Creates an IS NOT NULL expression with the given arguments. |
|
267 | - * |
|
268 | - * @param string $x The field in string format to be restricted by IS NOT NULL. |
|
269 | - * |
|
270 | - * @return string |
|
271 | - */ |
|
272 | - public function isNotNull($x) { |
|
273 | - $x = $this->helper->quoteColumnName($x); |
|
274 | - return $this->expressionBuilder->isNotNull($x); |
|
275 | - } |
|
265 | + /** |
|
266 | + * Creates an IS NOT NULL expression with the given arguments. |
|
267 | + * |
|
268 | + * @param string $x The field in string format to be restricted by IS NOT NULL. |
|
269 | + * |
|
270 | + * @return string |
|
271 | + */ |
|
272 | + public function isNotNull($x) { |
|
273 | + $x = $this->helper->quoteColumnName($x); |
|
274 | + return $this->expressionBuilder->isNotNull($x); |
|
275 | + } |
|
276 | 276 | |
277 | - /** |
|
278 | - * Creates a LIKE() comparison expression with the given arguments. |
|
279 | - * |
|
280 | - * @param string $x Field in string format to be inspected by LIKE() comparison. |
|
281 | - * @param mixed $y Argument to be used in LIKE() comparison. |
|
282 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
283 | - * required when comparing text fields for oci compatibility |
|
284 | - * |
|
285 | - * @return string |
|
286 | - */ |
|
287 | - public function like($x, $y, $type = null) { |
|
288 | - $x = $this->helper->quoteColumnName($x); |
|
289 | - $y = $this->helper->quoteColumnName($y); |
|
290 | - return $this->expressionBuilder->like($x, $y); |
|
291 | - } |
|
277 | + /** |
|
278 | + * Creates a LIKE() comparison expression with the given arguments. |
|
279 | + * |
|
280 | + * @param string $x Field in string format to be inspected by LIKE() comparison. |
|
281 | + * @param mixed $y Argument to be used in LIKE() comparison. |
|
282 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
283 | + * required when comparing text fields for oci compatibility |
|
284 | + * |
|
285 | + * @return string |
|
286 | + */ |
|
287 | + public function like($x, $y, $type = null) { |
|
288 | + $x = $this->helper->quoteColumnName($x); |
|
289 | + $y = $this->helper->quoteColumnName($y); |
|
290 | + return $this->expressionBuilder->like($x, $y); |
|
291 | + } |
|
292 | 292 | |
293 | - /** |
|
294 | - * Creates a ILIKE() comparison expression with the given arguments. |
|
295 | - * |
|
296 | - * @param string $x Field in string format to be inspected by ILIKE() comparison. |
|
297 | - * @param mixed $y Argument to be used in ILIKE() comparison. |
|
298 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
299 | - * required when comparing text fields for oci compatibility |
|
300 | - * |
|
301 | - * @return string |
|
302 | - * @since 9.0.0 |
|
303 | - */ |
|
304 | - public function iLike($x, $y, $type = null) { |
|
305 | - return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); |
|
306 | - } |
|
293 | + /** |
|
294 | + * Creates a ILIKE() comparison expression with the given arguments. |
|
295 | + * |
|
296 | + * @param string $x Field in string format to be inspected by ILIKE() comparison. |
|
297 | + * @param mixed $y Argument to be used in ILIKE() comparison. |
|
298 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
299 | + * required when comparing text fields for oci compatibility |
|
300 | + * |
|
301 | + * @return string |
|
302 | + * @since 9.0.0 |
|
303 | + */ |
|
304 | + public function iLike($x, $y, $type = null) { |
|
305 | + return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); |
|
306 | + } |
|
307 | 307 | |
308 | - /** |
|
309 | - * Creates a NOT LIKE() comparison expression with the given arguments. |
|
310 | - * |
|
311 | - * @param string $x Field in string format to be inspected by NOT LIKE() comparison. |
|
312 | - * @param mixed $y Argument to be used in NOT LIKE() comparison. |
|
313 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
314 | - * required when comparing text fields for oci compatibility |
|
315 | - * |
|
316 | - * @return string |
|
317 | - */ |
|
318 | - public function notLike($x, $y, $type = null) { |
|
319 | - $x = $this->helper->quoteColumnName($x); |
|
320 | - $y = $this->helper->quoteColumnName($y); |
|
321 | - return $this->expressionBuilder->notLike($x, $y); |
|
322 | - } |
|
308 | + /** |
|
309 | + * Creates a NOT LIKE() comparison expression with the given arguments. |
|
310 | + * |
|
311 | + * @param string $x Field in string format to be inspected by NOT LIKE() comparison. |
|
312 | + * @param mixed $y Argument to be used in NOT LIKE() comparison. |
|
313 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
314 | + * required when comparing text fields for oci compatibility |
|
315 | + * |
|
316 | + * @return string |
|
317 | + */ |
|
318 | + public function notLike($x, $y, $type = null) { |
|
319 | + $x = $this->helper->quoteColumnName($x); |
|
320 | + $y = $this->helper->quoteColumnName($y); |
|
321 | + return $this->expressionBuilder->notLike($x, $y); |
|
322 | + } |
|
323 | 323 | |
324 | - /** |
|
325 | - * Creates a IN () comparison expression with the given arguments. |
|
326 | - * |
|
327 | - * @param string $x The field in string format to be inspected by IN() comparison. |
|
328 | - * @param string|array $y The placeholder or the array of values to be used by IN() comparison. |
|
329 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
330 | - * required when comparing text fields for oci compatibility |
|
331 | - * |
|
332 | - * @return string |
|
333 | - */ |
|
334 | - public function in($x, $y, $type = null) { |
|
335 | - $x = $this->helper->quoteColumnName($x); |
|
336 | - $y = $this->helper->quoteColumnNames($y); |
|
337 | - return $this->expressionBuilder->in($x, $y); |
|
338 | - } |
|
324 | + /** |
|
325 | + * Creates a IN () comparison expression with the given arguments. |
|
326 | + * |
|
327 | + * @param string $x The field in string format to be inspected by IN() comparison. |
|
328 | + * @param string|array $y The placeholder or the array of values to be used by IN() comparison. |
|
329 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
330 | + * required when comparing text fields for oci compatibility |
|
331 | + * |
|
332 | + * @return string |
|
333 | + */ |
|
334 | + public function in($x, $y, $type = null) { |
|
335 | + $x = $this->helper->quoteColumnName($x); |
|
336 | + $y = $this->helper->quoteColumnNames($y); |
|
337 | + return $this->expressionBuilder->in($x, $y); |
|
338 | + } |
|
339 | 339 | |
340 | - /** |
|
341 | - * Creates a NOT IN () comparison expression with the given arguments. |
|
342 | - * |
|
343 | - * @param string $x The field in string format to be inspected by NOT IN() comparison. |
|
344 | - * @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison. |
|
345 | - * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
346 | - * required when comparing text fields for oci compatibility |
|
347 | - * |
|
348 | - * @return string |
|
349 | - */ |
|
350 | - public function notIn($x, $y, $type = null) { |
|
351 | - $x = $this->helper->quoteColumnName($x); |
|
352 | - $y = $this->helper->quoteColumnNames($y); |
|
353 | - return $this->expressionBuilder->notIn($x, $y); |
|
354 | - } |
|
340 | + /** |
|
341 | + * Creates a NOT IN () comparison expression with the given arguments. |
|
342 | + * |
|
343 | + * @param string $x The field in string format to be inspected by NOT IN() comparison. |
|
344 | + * @param string|array $y The placeholder or the array of values to be used by NOT IN() comparison. |
|
345 | + * @param mixed|null $type one of the IQueryBuilder::PARAM_* constants |
|
346 | + * required when comparing text fields for oci compatibility |
|
347 | + * |
|
348 | + * @return string |
|
349 | + */ |
|
350 | + public function notIn($x, $y, $type = null) { |
|
351 | + $x = $this->helper->quoteColumnName($x); |
|
352 | + $y = $this->helper->quoteColumnNames($y); |
|
353 | + return $this->expressionBuilder->notIn($x, $y); |
|
354 | + } |
|
355 | 355 | |
356 | - /** |
|
357 | - * Creates a $x = '' statement, because Oracle needs a different check |
|
358 | - * |
|
359 | - * @param string $x The field in string format to be inspected by the comparison. |
|
360 | - * @return string |
|
361 | - * @since 13.0.0 |
|
362 | - */ |
|
363 | - public function emptyString($x) { |
|
364 | - return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); |
|
365 | - } |
|
356 | + /** |
|
357 | + * Creates a $x = '' statement, because Oracle needs a different check |
|
358 | + * |
|
359 | + * @param string $x The field in string format to be inspected by the comparison. |
|
360 | + * @return string |
|
361 | + * @since 13.0.0 |
|
362 | + */ |
|
363 | + public function emptyString($x) { |
|
364 | + return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); |
|
365 | + } |
|
366 | 366 | |
367 | - /** |
|
368 | - * Creates a `$x <> ''` statement, because Oracle needs a different check |
|
369 | - * |
|
370 | - * @param string $x The field in string format to be inspected by the comparison. |
|
371 | - * @return string |
|
372 | - * @since 13.0.0 |
|
373 | - */ |
|
374 | - public function nonEmptyString($x) { |
|
375 | - return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); |
|
376 | - } |
|
367 | + /** |
|
368 | + * Creates a `$x <> ''` statement, because Oracle needs a different check |
|
369 | + * |
|
370 | + * @param string $x The field in string format to be inspected by the comparison. |
|
371 | + * @return string |
|
372 | + * @since 13.0.0 |
|
373 | + */ |
|
374 | + public function nonEmptyString($x) { |
|
375 | + return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); |
|
376 | + } |
|
377 | 377 | |
378 | - /** |
|
379 | - * Binary AND Operator copies a bit to the result if it exists in both operands. |
|
380 | - * |
|
381 | - * @param string|ILiteral $x The field or value to check |
|
382 | - * @param int $y Bitmap that must be set |
|
383 | - * @return IQueryFunction |
|
384 | - * @since 12.0.0 |
|
385 | - */ |
|
386 | - public function bitwiseAnd($x, $y) { |
|
387 | - return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( |
|
388 | - $this->helper->quoteColumnName($x), |
|
389 | - $y |
|
390 | - )); |
|
391 | - } |
|
378 | + /** |
|
379 | + * Binary AND Operator copies a bit to the result if it exists in both operands. |
|
380 | + * |
|
381 | + * @param string|ILiteral $x The field or value to check |
|
382 | + * @param int $y Bitmap that must be set |
|
383 | + * @return IQueryFunction |
|
384 | + * @since 12.0.0 |
|
385 | + */ |
|
386 | + public function bitwiseAnd($x, $y) { |
|
387 | + return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( |
|
388 | + $this->helper->quoteColumnName($x), |
|
389 | + $y |
|
390 | + )); |
|
391 | + } |
|
392 | 392 | |
393 | - /** |
|
394 | - * Binary OR Operator copies a bit if it exists in either operand. |
|
395 | - * |
|
396 | - * @param string|ILiteral $x The field or value to check |
|
397 | - * @param int $y Bitmap that must be set |
|
398 | - * @return IQueryFunction |
|
399 | - * @since 12.0.0 |
|
400 | - */ |
|
401 | - public function bitwiseOr($x, $y) { |
|
402 | - return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( |
|
403 | - $this->helper->quoteColumnName($x), |
|
404 | - $y |
|
405 | - )); |
|
406 | - } |
|
393 | + /** |
|
394 | + * Binary OR Operator copies a bit if it exists in either operand. |
|
395 | + * |
|
396 | + * @param string|ILiteral $x The field or value to check |
|
397 | + * @param int $y Bitmap that must be set |
|
398 | + * @return IQueryFunction |
|
399 | + * @since 12.0.0 |
|
400 | + */ |
|
401 | + public function bitwiseOr($x, $y) { |
|
402 | + return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( |
|
403 | + $this->helper->quoteColumnName($x), |
|
404 | + $y |
|
405 | + )); |
|
406 | + } |
|
407 | 407 | |
408 | - /** |
|
409 | - * Quotes a given input parameter. |
|
410 | - * |
|
411 | - * @param mixed $input The parameter to be quoted. |
|
412 | - * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants |
|
413 | - * |
|
414 | - * @return ILiteral |
|
415 | - */ |
|
416 | - public function literal($input, $type = null) { |
|
417 | - return new Literal($this->expressionBuilder->literal($input, $type)); |
|
418 | - } |
|
408 | + /** |
|
409 | + * Quotes a given input parameter. |
|
410 | + * |
|
411 | + * @param mixed $input The parameter to be quoted. |
|
412 | + * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants |
|
413 | + * |
|
414 | + * @return ILiteral |
|
415 | + */ |
|
416 | + public function literal($input, $type = null) { |
|
417 | + return new Literal($this->expressionBuilder->literal($input, $type)); |
|
418 | + } |
|
419 | 419 | |
420 | - /** |
|
421 | - * Returns a IQueryFunction that casts the column to the given type |
|
422 | - * |
|
423 | - * @param string $column |
|
424 | - * @param mixed $type One of IQueryBuilder::PARAM_* |
|
425 | - * @return string |
|
426 | - */ |
|
427 | - public function castColumn($column, $type) { |
|
428 | - return new QueryFunction( |
|
429 | - $this->helper->quoteColumnName($column) |
|
430 | - ); |
|
431 | - } |
|
420 | + /** |
|
421 | + * Returns a IQueryFunction that casts the column to the given type |
|
422 | + * |
|
423 | + * @param string $column |
|
424 | + * @param mixed $type One of IQueryBuilder::PARAM_* |
|
425 | + * @return string |
|
426 | + */ |
|
427 | + public function castColumn($column, $type) { |
|
428 | + return new QueryFunction( |
|
429 | + $this->helper->quoteColumnName($column) |
|
430 | + ); |
|
431 | + } |
|
432 | 432 | } |
@@ -32,18 +32,18 @@ |
||
32 | 32 | * @deprecated 14.0.0 |
33 | 33 | */ |
34 | 34 | class BackgroundJob { |
35 | - /** |
|
36 | - * @since 5.0.0 |
|
37 | - * @deprecated 14.0.0 |
|
38 | - */ |
|
39 | - public static function getExecutionType() { |
|
40 | - return ''; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @since 5.0.0 |
|
37 | + * @deprecated 14.0.0 |
|
38 | + */ |
|
39 | + public static function getExecutionType() { |
|
40 | + return ''; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @since 5.0.0 |
|
45 | - * @deprecated 14.0.0 |
|
46 | - */ |
|
47 | - public static function setExecutionType($type) { |
|
48 | - } |
|
43 | + /** |
|
44 | + * @since 5.0.0 |
|
45 | + * @deprecated 14.0.0 |
|
46 | + */ |
|
47 | + public static function setExecutionType($type) { |
|
48 | + } |
|
49 | 49 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function buildPath($path) { |
59 | - $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); |
|
59 | + $fullPath = \OC\Files\Filesystem::normalizePath($this->root.'/'.$path); |
|
60 | 60 | return ltrim($fullPath, '/'); |
61 | 61 | } |
62 | 62 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | } catch (FileNotFoundException $e) { |
164 | 164 | return false; |
165 | 165 | } |
166 | - $names = array_map(function ($object) { |
|
166 | + $names = array_map(function($object) { |
|
167 | 167 | return $object['basename']; |
168 | 168 | }, $content); |
169 | 169 | return IteratorDirectory::wrap($names); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile(); |
210 | 210 | } |
211 | 211 | $source = fopen($tmpFile, $mode); |
212 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { |
|
212 | + return CallbackWrapper::wrap($source, null, null, function() use ($tmpFile, $fullPath) { |
|
213 | 213 | $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); |
214 | 214 | unlink($tmpFile); |
215 | 215 | }); |
@@ -36,224 +36,224 @@ |
||
36 | 36 | * To use: subclass and call $this->buildFlysystem with the flysystem adapter of choice |
37 | 37 | */ |
38 | 38 | abstract class Flysystem extends Common { |
39 | - /** |
|
40 | - * @var Filesystem |
|
41 | - */ |
|
42 | - protected $flysystem; |
|
39 | + /** |
|
40 | + * @var Filesystem |
|
41 | + */ |
|
42 | + protected $flysystem; |
|
43 | 43 | |
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $root = ''; |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $root = ''; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Initialize the storage backend with a flyssytem adapter |
|
51 | - * |
|
52 | - * @param \League\Flysystem\AdapterInterface $adapter |
|
53 | - */ |
|
54 | - protected function buildFlySystem(AdapterInterface $adapter) { |
|
55 | - $this->flysystem = new Filesystem($adapter); |
|
56 | - $this->flysystem->addPlugin(new GetWithMetadata()); |
|
57 | - } |
|
49 | + /** |
|
50 | + * Initialize the storage backend with a flyssytem adapter |
|
51 | + * |
|
52 | + * @param \League\Flysystem\AdapterInterface $adapter |
|
53 | + */ |
|
54 | + protected function buildFlySystem(AdapterInterface $adapter) { |
|
55 | + $this->flysystem = new Filesystem($adapter); |
|
56 | + $this->flysystem->addPlugin(new GetWithMetadata()); |
|
57 | + } |
|
58 | 58 | |
59 | - protected function buildPath($path) { |
|
60 | - $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); |
|
61 | - return ltrim($fullPath, '/'); |
|
62 | - } |
|
59 | + protected function buildPath($path) { |
|
60 | + $fullPath = \OC\Files\Filesystem::normalizePath($this->root . '/' . $path); |
|
61 | + return ltrim($fullPath, '/'); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
65 | - * {@inheritdoc} |
|
66 | - */ |
|
67 | - public function file_get_contents($path) { |
|
68 | - return $this->flysystem->read($this->buildPath($path)); |
|
69 | - } |
|
64 | + /** |
|
65 | + * {@inheritdoc} |
|
66 | + */ |
|
67 | + public function file_get_contents($path) { |
|
68 | + return $this->flysystem->read($this->buildPath($path)); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * {@inheritdoc} |
|
73 | - */ |
|
74 | - public function file_put_contents($path, $data) { |
|
75 | - return $this->flysystem->put($this->buildPath($path), $data); |
|
76 | - } |
|
71 | + /** |
|
72 | + * {@inheritdoc} |
|
73 | + */ |
|
74 | + public function file_put_contents($path, $data) { |
|
75 | + return $this->flysystem->put($this->buildPath($path), $data); |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * {@inheritdoc} |
|
80 | - */ |
|
81 | - public function file_exists($path) { |
|
82 | - return $this->flysystem->has($this->buildPath($path)); |
|
83 | - } |
|
78 | + /** |
|
79 | + * {@inheritdoc} |
|
80 | + */ |
|
81 | + public function file_exists($path) { |
|
82 | + return $this->flysystem->has($this->buildPath($path)); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * {@inheritdoc} |
|
87 | - */ |
|
88 | - public function unlink($path) { |
|
89 | - if ($this->is_dir($path)) { |
|
90 | - return $this->rmdir($path); |
|
91 | - } |
|
92 | - try { |
|
93 | - return $this->flysystem->delete($this->buildPath($path)); |
|
94 | - } catch (FileNotFoundException $e) { |
|
95 | - return false; |
|
96 | - } |
|
97 | - } |
|
85 | + /** |
|
86 | + * {@inheritdoc} |
|
87 | + */ |
|
88 | + public function unlink($path) { |
|
89 | + if ($this->is_dir($path)) { |
|
90 | + return $this->rmdir($path); |
|
91 | + } |
|
92 | + try { |
|
93 | + return $this->flysystem->delete($this->buildPath($path)); |
|
94 | + } catch (FileNotFoundException $e) { |
|
95 | + return false; |
|
96 | + } |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * {@inheritdoc} |
|
101 | - */ |
|
102 | - public function rename($source, $target) { |
|
103 | - if ($this->file_exists($target)) { |
|
104 | - $this->unlink($target); |
|
105 | - } |
|
106 | - return $this->flysystem->rename($this->buildPath($source), $this->buildPath($target)); |
|
107 | - } |
|
99 | + /** |
|
100 | + * {@inheritdoc} |
|
101 | + */ |
|
102 | + public function rename($source, $target) { |
|
103 | + if ($this->file_exists($target)) { |
|
104 | + $this->unlink($target); |
|
105 | + } |
|
106 | + return $this->flysystem->rename($this->buildPath($source), $this->buildPath($target)); |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * {@inheritdoc} |
|
111 | - */ |
|
112 | - public function copy($source, $target) { |
|
113 | - if ($this->file_exists($target)) { |
|
114 | - $this->unlink($target); |
|
115 | - } |
|
116 | - return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target)); |
|
117 | - } |
|
109 | + /** |
|
110 | + * {@inheritdoc} |
|
111 | + */ |
|
112 | + public function copy($source, $target) { |
|
113 | + if ($this->file_exists($target)) { |
|
114 | + $this->unlink($target); |
|
115 | + } |
|
116 | + return $this->flysystem->copy($this->buildPath($source), $this->buildPath($target)); |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * {@inheritdoc} |
|
121 | - */ |
|
122 | - public function filesize($path) { |
|
123 | - if ($this->is_dir($path)) { |
|
124 | - return 0; |
|
125 | - } else { |
|
126 | - return $this->flysystem->getSize($this->buildPath($path)); |
|
127 | - } |
|
128 | - } |
|
119 | + /** |
|
120 | + * {@inheritdoc} |
|
121 | + */ |
|
122 | + public function filesize($path) { |
|
123 | + if ($this->is_dir($path)) { |
|
124 | + return 0; |
|
125 | + } else { |
|
126 | + return $this->flysystem->getSize($this->buildPath($path)); |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - /** |
|
131 | - * {@inheritdoc} |
|
132 | - */ |
|
133 | - public function mkdir($path) { |
|
134 | - if ($this->file_exists($path)) { |
|
135 | - return false; |
|
136 | - } |
|
137 | - return $this->flysystem->createDir($this->buildPath($path)); |
|
138 | - } |
|
130 | + /** |
|
131 | + * {@inheritdoc} |
|
132 | + */ |
|
133 | + public function mkdir($path) { |
|
134 | + if ($this->file_exists($path)) { |
|
135 | + return false; |
|
136 | + } |
|
137 | + return $this->flysystem->createDir($this->buildPath($path)); |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * {@inheritdoc} |
|
142 | - */ |
|
143 | - public function filemtime($path) { |
|
144 | - return $this->flysystem->getTimestamp($this->buildPath($path)); |
|
145 | - } |
|
140 | + /** |
|
141 | + * {@inheritdoc} |
|
142 | + */ |
|
143 | + public function filemtime($path) { |
|
144 | + return $this->flysystem->getTimestamp($this->buildPath($path)); |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * {@inheritdoc} |
|
149 | - */ |
|
150 | - public function rmdir($path) { |
|
151 | - try { |
|
152 | - return @$this->flysystem->deleteDir($this->buildPath($path)); |
|
153 | - } catch (FileNotFoundException $e) { |
|
154 | - return false; |
|
155 | - } |
|
156 | - } |
|
147 | + /** |
|
148 | + * {@inheritdoc} |
|
149 | + */ |
|
150 | + public function rmdir($path) { |
|
151 | + try { |
|
152 | + return @$this->flysystem->deleteDir($this->buildPath($path)); |
|
153 | + } catch (FileNotFoundException $e) { |
|
154 | + return false; |
|
155 | + } |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * {@inheritdoc} |
|
160 | - */ |
|
161 | - public function opendir($path) { |
|
162 | - try { |
|
163 | - $content = $this->flysystem->listContents($this->buildPath($path)); |
|
164 | - } catch (FileNotFoundException $e) { |
|
165 | - return false; |
|
166 | - } |
|
167 | - $names = array_map(function ($object) { |
|
168 | - return $object['basename']; |
|
169 | - }, $content); |
|
170 | - return IteratorDirectory::wrap($names); |
|
171 | - } |
|
158 | + /** |
|
159 | + * {@inheritdoc} |
|
160 | + */ |
|
161 | + public function opendir($path) { |
|
162 | + try { |
|
163 | + $content = $this->flysystem->listContents($this->buildPath($path)); |
|
164 | + } catch (FileNotFoundException $e) { |
|
165 | + return false; |
|
166 | + } |
|
167 | + $names = array_map(function ($object) { |
|
168 | + return $object['basename']; |
|
169 | + }, $content); |
|
170 | + return IteratorDirectory::wrap($names); |
|
171 | + } |
|
172 | 172 | |
173 | - /** |
|
174 | - * {@inheritdoc} |
|
175 | - */ |
|
176 | - public function fopen($path, $mode) { |
|
177 | - $fullPath = $this->buildPath($path); |
|
178 | - $useExisting = true; |
|
179 | - switch ($mode) { |
|
180 | - case 'r': |
|
181 | - case 'rb': |
|
182 | - try { |
|
183 | - return $this->flysystem->readStream($fullPath); |
|
184 | - } catch (FileNotFoundException $e) { |
|
185 | - return false; |
|
186 | - } |
|
187 | - case 'w': |
|
188 | - case 'w+': |
|
189 | - case 'wb': |
|
190 | - case 'wb+': |
|
191 | - $useExisting = false; |
|
192 | - // no break |
|
193 | - case 'a': |
|
194 | - case 'ab': |
|
195 | - case 'r+': |
|
196 | - case 'a+': |
|
197 | - case 'x': |
|
198 | - case 'x+': |
|
199 | - case 'c': |
|
200 | - case 'c+': |
|
201 | - //emulate these |
|
202 | - if ($useExisting and $this->file_exists($path)) { |
|
203 | - if (!$this->isUpdatable($path)) { |
|
204 | - return false; |
|
205 | - } |
|
206 | - $tmpFile = $this->getCachedFile($path); |
|
207 | - } else { |
|
208 | - if (!$this->isCreatable(dirname($path))) { |
|
209 | - return false; |
|
210 | - } |
|
211 | - $tmpFile = \OC::$server->getTempManager()->getTemporaryFile(); |
|
212 | - } |
|
213 | - $source = fopen($tmpFile, $mode); |
|
214 | - return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { |
|
215 | - $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); |
|
216 | - unlink($tmpFile); |
|
217 | - }); |
|
218 | - } |
|
219 | - return false; |
|
220 | - } |
|
173 | + /** |
|
174 | + * {@inheritdoc} |
|
175 | + */ |
|
176 | + public function fopen($path, $mode) { |
|
177 | + $fullPath = $this->buildPath($path); |
|
178 | + $useExisting = true; |
|
179 | + switch ($mode) { |
|
180 | + case 'r': |
|
181 | + case 'rb': |
|
182 | + try { |
|
183 | + return $this->flysystem->readStream($fullPath); |
|
184 | + } catch (FileNotFoundException $e) { |
|
185 | + return false; |
|
186 | + } |
|
187 | + case 'w': |
|
188 | + case 'w+': |
|
189 | + case 'wb': |
|
190 | + case 'wb+': |
|
191 | + $useExisting = false; |
|
192 | + // no break |
|
193 | + case 'a': |
|
194 | + case 'ab': |
|
195 | + case 'r+': |
|
196 | + case 'a+': |
|
197 | + case 'x': |
|
198 | + case 'x+': |
|
199 | + case 'c': |
|
200 | + case 'c+': |
|
201 | + //emulate these |
|
202 | + if ($useExisting and $this->file_exists($path)) { |
|
203 | + if (!$this->isUpdatable($path)) { |
|
204 | + return false; |
|
205 | + } |
|
206 | + $tmpFile = $this->getCachedFile($path); |
|
207 | + } else { |
|
208 | + if (!$this->isCreatable(dirname($path))) { |
|
209 | + return false; |
|
210 | + } |
|
211 | + $tmpFile = \OC::$server->getTempManager()->getTemporaryFile(); |
|
212 | + } |
|
213 | + $source = fopen($tmpFile, $mode); |
|
214 | + return CallbackWrapper::wrap($source, null, null, function () use ($tmpFile, $fullPath) { |
|
215 | + $this->flysystem->putStream($fullPath, fopen($tmpFile, 'r')); |
|
216 | + unlink($tmpFile); |
|
217 | + }); |
|
218 | + } |
|
219 | + return false; |
|
220 | + } |
|
221 | 221 | |
222 | - /** |
|
223 | - * {@inheritdoc} |
|
224 | - */ |
|
225 | - public function touch($path, $mtime = null) { |
|
226 | - if ($this->file_exists($path)) { |
|
227 | - return false; |
|
228 | - } else { |
|
229 | - $this->file_put_contents($path, ''); |
|
230 | - return true; |
|
231 | - } |
|
232 | - } |
|
222 | + /** |
|
223 | + * {@inheritdoc} |
|
224 | + */ |
|
225 | + public function touch($path, $mtime = null) { |
|
226 | + if ($this->file_exists($path)) { |
|
227 | + return false; |
|
228 | + } else { |
|
229 | + $this->file_put_contents($path, ''); |
|
230 | + return true; |
|
231 | + } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * {@inheritdoc} |
|
236 | - */ |
|
237 | - public function stat($path) { |
|
238 | - $info = $this->flysystem->getWithMetadata($this->buildPath($path), ['timestamp', 'size']); |
|
239 | - return [ |
|
240 | - 'mtime' => $info['timestamp'], |
|
241 | - 'size' => $info['size'] |
|
242 | - ]; |
|
243 | - } |
|
234 | + /** |
|
235 | + * {@inheritdoc} |
|
236 | + */ |
|
237 | + public function stat($path) { |
|
238 | + $info = $this->flysystem->getWithMetadata($this->buildPath($path), ['timestamp', 'size']); |
|
239 | + return [ |
|
240 | + 'mtime' => $info['timestamp'], |
|
241 | + 'size' => $info['size'] |
|
242 | + ]; |
|
243 | + } |
|
244 | 244 | |
245 | - /** |
|
246 | - * {@inheritdoc} |
|
247 | - */ |
|
248 | - public function filetype($path) { |
|
249 | - if ($path === '' or $path === '/' or $path === '.') { |
|
250 | - return 'dir'; |
|
251 | - } |
|
252 | - try { |
|
253 | - $info = $this->flysystem->getMetadata($this->buildPath($path)); |
|
254 | - } catch (FileNotFoundException $e) { |
|
255 | - return false; |
|
256 | - } |
|
257 | - return $info['type']; |
|
258 | - } |
|
245 | + /** |
|
246 | + * {@inheritdoc} |
|
247 | + */ |
|
248 | + public function filetype($path) { |
|
249 | + if ($path === '' or $path === '/' or $path === '.') { |
|
250 | + return 'dir'; |
|
251 | + } |
|
252 | + try { |
|
253 | + $info = $this->flysystem->getMetadata($this->buildPath($path)); |
|
254 | + } catch (FileNotFoundException $e) { |
|
255 | + return false; |
|
256 | + } |
|
257 | + return $info['type']; |
|
258 | + } |
|
259 | 259 | } |