@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public function castColumn($column, $type) { |
148 | 148 | if ($type === IQueryBuilder::PARAM_STR) { |
149 | 149 | $column = $this->helper->quoteColumnName($column); |
150 | - return new QueryFunction('to_char(' . $column . ')'); |
|
150 | + return new QueryFunction('to_char('.$column.')'); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return parent::castColumn($column, $type); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @inheritdoc |
158 | 158 | */ |
159 | 159 | public function like($x, $y, $type = null) { |
160 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
160 | + return parent::like($x, $y, $type)." ESCAPE '\\'"; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -166,6 +166,6 @@ discard block |
||
166 | 166 | public function iLike($x, $y, $type = null) { |
167 | 167 | $x = $this->helper->quoteColumnName($x); |
168 | 168 | $y = $this->helper->quoteColumnName($y); |
169 | - return new QueryFunction('REGEXP_LIKE(' . $x . ', \'^\' || REPLACE(REPLACE(' . $y . ', \'%\', \'.*\'), \'_\', \'.\') || \'$\', \'i\')'); |
|
169 | + return new QueryFunction('REGEXP_LIKE('.$x.', \'^\' || REPLACE(REPLACE('.$y.', \'%\', \'.*\'), \'_\', \'.\') || \'$\', \'i\')'); |
|
170 | 170 | } |
171 | 171 | } |
@@ -33,161 +33,161 @@ |
||
33 | 33 | |
34 | 34 | class OCIExpressionBuilder extends ExpressionBuilder { |
35 | 35 | |
36 | - /** |
|
37 | - * @param mixed $column |
|
38 | - * @param mixed|null $type |
|
39 | - * @return array|IQueryFunction|string |
|
40 | - */ |
|
41 | - protected function prepareColumn($column, $type) { |
|
42 | - if ($type === IQueryBuilder::PARAM_STR && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) { |
|
43 | - $column = $this->castColumn($column, $type); |
|
44 | - } else { |
|
45 | - $column = $this->helper->quoteColumnNames($column); |
|
46 | - } |
|
47 | - return $column; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * @inheritdoc |
|
52 | - */ |
|
53 | - public function comparison($x, $operator, $y, $type = null) { |
|
54 | - $x = $this->prepareColumn($x, $type); |
|
55 | - $y = $this->prepareColumn($y, $type); |
|
56 | - |
|
57 | - return $this->expressionBuilder->comparison($x, $operator, $y); |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * @inheritdoc |
|
62 | - */ |
|
63 | - public function eq($x, $y, $type = null) { |
|
64 | - $x = $this->prepareColumn($x, $type); |
|
65 | - $y = $this->prepareColumn($y, $type); |
|
66 | - |
|
67 | - return $this->expressionBuilder->eq($x, $y); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @inheritdoc |
|
72 | - */ |
|
73 | - public function neq($x, $y, $type = null) { |
|
74 | - $x = $this->prepareColumn($x, $type); |
|
75 | - $y = $this->prepareColumn($y, $type); |
|
76 | - |
|
77 | - return $this->expressionBuilder->neq($x, $y); |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @inheritdoc |
|
82 | - */ |
|
83 | - public function lt($x, $y, $type = null) { |
|
84 | - $x = $this->prepareColumn($x, $type); |
|
85 | - $y = $this->prepareColumn($y, $type); |
|
86 | - |
|
87 | - return $this->expressionBuilder->lt($x, $y); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @inheritdoc |
|
92 | - */ |
|
93 | - public function lte($x, $y, $type = null) { |
|
94 | - $x = $this->prepareColumn($x, $type); |
|
95 | - $y = $this->prepareColumn($y, $type); |
|
96 | - |
|
97 | - return $this->expressionBuilder->lte($x, $y); |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * @inheritdoc |
|
102 | - */ |
|
103 | - public function gt($x, $y, $type = null) { |
|
104 | - $x = $this->prepareColumn($x, $type); |
|
105 | - $y = $this->prepareColumn($y, $type); |
|
106 | - |
|
107 | - return $this->expressionBuilder->gt($x, $y); |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * @inheritdoc |
|
112 | - */ |
|
113 | - public function gte($x, $y, $type = null) { |
|
114 | - $x = $this->prepareColumn($x, $type); |
|
115 | - $y = $this->prepareColumn($y, $type); |
|
116 | - |
|
117 | - return $this->expressionBuilder->gte($x, $y); |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * @inheritdoc |
|
122 | - */ |
|
123 | - public function in($x, $y, $type = null) { |
|
124 | - $x = $this->prepareColumn($x, $type); |
|
125 | - $y = $this->prepareColumn($y, $type); |
|
126 | - |
|
127 | - return $this->expressionBuilder->in($x, $y); |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * @inheritdoc |
|
132 | - */ |
|
133 | - public function notIn($x, $y, $type = null) { |
|
134 | - $x = $this->prepareColumn($x, $type); |
|
135 | - $y = $this->prepareColumn($y, $type); |
|
136 | - |
|
137 | - return $this->expressionBuilder->notIn($x, $y); |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
141 | - * Creates a $x = '' statement, because Oracle needs a different check |
|
142 | - * |
|
143 | - * @param string $x The field in string format to be inspected by the comparison. |
|
144 | - * @return string |
|
145 | - * @since 13.0.0 |
|
146 | - */ |
|
147 | - public function emptyString($x) { |
|
148 | - return $this->isNull($x); |
|
149 | - } |
|
150 | - |
|
151 | - /** |
|
152 | - * Creates a `$x <> ''` statement, because Oracle needs a different check |
|
153 | - * |
|
154 | - * @param string $x The field in string format to be inspected by the comparison. |
|
155 | - * @return string |
|
156 | - * @since 13.0.0 |
|
157 | - */ |
|
158 | - public function nonEmptyString($x) { |
|
159 | - return $this->isNotNull($x); |
|
160 | - } |
|
161 | - |
|
162 | - /** |
|
163 | - * Returns a IQueryFunction that casts the column to the given type |
|
164 | - * |
|
165 | - * @param string $column |
|
166 | - * @param mixed $type One of IQueryBuilder::PARAM_* |
|
167 | - * @return IQueryFunction |
|
168 | - */ |
|
169 | - public function castColumn($column, $type) { |
|
170 | - if ($type === IQueryBuilder::PARAM_STR) { |
|
171 | - $column = $this->helper->quoteColumnName($column); |
|
172 | - return new QueryFunction('to_char(' . $column . ')'); |
|
173 | - } |
|
174 | - |
|
175 | - return parent::castColumn($column, $type); |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @inheritdoc |
|
180 | - */ |
|
181 | - public function like($x, $y, $type = null) { |
|
182 | - return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * @inheritdoc |
|
187 | - */ |
|
188 | - public function iLike($x, $y, $type = null) { |
|
189 | - $x = $this->helper->quoteColumnName($x); |
|
190 | - $y = $this->helper->quoteColumnName($y); |
|
191 | - return new QueryFunction('REGEXP_LIKE(' . $x . ', \'^\' || REPLACE(REPLACE(' . $y . ', \'%\', \'.*\'), \'_\', \'.\') || \'$\', \'i\')'); |
|
192 | - } |
|
36 | + /** |
|
37 | + * @param mixed $column |
|
38 | + * @param mixed|null $type |
|
39 | + * @return array|IQueryFunction|string |
|
40 | + */ |
|
41 | + protected function prepareColumn($column, $type) { |
|
42 | + if ($type === IQueryBuilder::PARAM_STR && !is_array($column) && !($column instanceof IParameter) && !($column instanceof ILiteral)) { |
|
43 | + $column = $this->castColumn($column, $type); |
|
44 | + } else { |
|
45 | + $column = $this->helper->quoteColumnNames($column); |
|
46 | + } |
|
47 | + return $column; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * @inheritdoc |
|
52 | + */ |
|
53 | + public function comparison($x, $operator, $y, $type = null) { |
|
54 | + $x = $this->prepareColumn($x, $type); |
|
55 | + $y = $this->prepareColumn($y, $type); |
|
56 | + |
|
57 | + return $this->expressionBuilder->comparison($x, $operator, $y); |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * @inheritdoc |
|
62 | + */ |
|
63 | + public function eq($x, $y, $type = null) { |
|
64 | + $x = $this->prepareColumn($x, $type); |
|
65 | + $y = $this->prepareColumn($y, $type); |
|
66 | + |
|
67 | + return $this->expressionBuilder->eq($x, $y); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @inheritdoc |
|
72 | + */ |
|
73 | + public function neq($x, $y, $type = null) { |
|
74 | + $x = $this->prepareColumn($x, $type); |
|
75 | + $y = $this->prepareColumn($y, $type); |
|
76 | + |
|
77 | + return $this->expressionBuilder->neq($x, $y); |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @inheritdoc |
|
82 | + */ |
|
83 | + public function lt($x, $y, $type = null) { |
|
84 | + $x = $this->prepareColumn($x, $type); |
|
85 | + $y = $this->prepareColumn($y, $type); |
|
86 | + |
|
87 | + return $this->expressionBuilder->lt($x, $y); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @inheritdoc |
|
92 | + */ |
|
93 | + public function lte($x, $y, $type = null) { |
|
94 | + $x = $this->prepareColumn($x, $type); |
|
95 | + $y = $this->prepareColumn($y, $type); |
|
96 | + |
|
97 | + return $this->expressionBuilder->lte($x, $y); |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * @inheritdoc |
|
102 | + */ |
|
103 | + public function gt($x, $y, $type = null) { |
|
104 | + $x = $this->prepareColumn($x, $type); |
|
105 | + $y = $this->prepareColumn($y, $type); |
|
106 | + |
|
107 | + return $this->expressionBuilder->gt($x, $y); |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * @inheritdoc |
|
112 | + */ |
|
113 | + public function gte($x, $y, $type = null) { |
|
114 | + $x = $this->prepareColumn($x, $type); |
|
115 | + $y = $this->prepareColumn($y, $type); |
|
116 | + |
|
117 | + return $this->expressionBuilder->gte($x, $y); |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * @inheritdoc |
|
122 | + */ |
|
123 | + public function in($x, $y, $type = null) { |
|
124 | + $x = $this->prepareColumn($x, $type); |
|
125 | + $y = $this->prepareColumn($y, $type); |
|
126 | + |
|
127 | + return $this->expressionBuilder->in($x, $y); |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * @inheritdoc |
|
132 | + */ |
|
133 | + public function notIn($x, $y, $type = null) { |
|
134 | + $x = $this->prepareColumn($x, $type); |
|
135 | + $y = $this->prepareColumn($y, $type); |
|
136 | + |
|
137 | + return $this->expressionBuilder->notIn($x, $y); |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | + * Creates a $x = '' statement, because Oracle needs a different check |
|
142 | + * |
|
143 | + * @param string $x The field in string format to be inspected by the comparison. |
|
144 | + * @return string |
|
145 | + * @since 13.0.0 |
|
146 | + */ |
|
147 | + public function emptyString($x) { |
|
148 | + return $this->isNull($x); |
|
149 | + } |
|
150 | + |
|
151 | + /** |
|
152 | + * Creates a `$x <> ''` statement, because Oracle needs a different check |
|
153 | + * |
|
154 | + * @param string $x The field in string format to be inspected by the comparison. |
|
155 | + * @return string |
|
156 | + * @since 13.0.0 |
|
157 | + */ |
|
158 | + public function nonEmptyString($x) { |
|
159 | + return $this->isNotNull($x); |
|
160 | + } |
|
161 | + |
|
162 | + /** |
|
163 | + * Returns a IQueryFunction that casts the column to the given type |
|
164 | + * |
|
165 | + * @param string $column |
|
166 | + * @param mixed $type One of IQueryBuilder::PARAM_* |
|
167 | + * @return IQueryFunction |
|
168 | + */ |
|
169 | + public function castColumn($column, $type) { |
|
170 | + if ($type === IQueryBuilder::PARAM_STR) { |
|
171 | + $column = $this->helper->quoteColumnName($column); |
|
172 | + return new QueryFunction('to_char(' . $column . ')'); |
|
173 | + } |
|
174 | + |
|
175 | + return parent::castColumn($column, $type); |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @inheritdoc |
|
180 | + */ |
|
181 | + public function like($x, $y, $type = null) { |
|
182 | + return parent::like($x, $y, $type) . " ESCAPE '\\'"; |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * @inheritdoc |
|
187 | + */ |
|
188 | + public function iLike($x, $y, $type = null) { |
|
189 | + $x = $this->helper->quoteColumnName($x); |
|
190 | + $y = $this->helper->quoteColumnName($y); |
|
191 | + return new QueryFunction('REGEXP_LIKE(' . $x . ', \'^\' || REPLACE(REPLACE(' . $y . ', \'%\', \'.*\'), \'_\', \'.\') || \'$\', \'i\')'); |
|
192 | + } |
|
193 | 193 | } |
@@ -197,7 +197,7 @@ |
||
197 | 197 | } catch (NotFoundException $e) { |
198 | 198 | return new DataResponse( |
199 | 199 | [ |
200 | - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) |
|
200 | + 'message' => (string) $this->l10n->t('Storage with ID "%d" not found', [$id]) |
|
201 | 201 | ], |
202 | 202 | Http::STATUS_NOT_FOUND |
203 | 203 | ); |
@@ -40,148 +40,148 @@ |
||
40 | 40 | * Global storages controller |
41 | 41 | */ |
42 | 42 | class GlobalStoragesController extends StoragesController { |
43 | - /** |
|
44 | - * Creates a new global storages controller. |
|
45 | - * |
|
46 | - * @param string $AppName application name |
|
47 | - * @param IRequest $request request object |
|
48 | - * @param IL10N $l10n l10n service |
|
49 | - * @param GlobalStoragesService $globalStoragesService storage service |
|
50 | - * @param ILogger $logger |
|
51 | - */ |
|
52 | - public function __construct( |
|
53 | - $AppName, |
|
54 | - IRequest $request, |
|
55 | - IL10N $l10n, |
|
56 | - GlobalStoragesService $globalStoragesService, |
|
57 | - ILogger $logger |
|
58 | - ) { |
|
59 | - parent::__construct( |
|
60 | - $AppName, |
|
61 | - $request, |
|
62 | - $l10n, |
|
63 | - $globalStoragesService, |
|
64 | - $logger |
|
65 | - ); |
|
66 | - } |
|
43 | + /** |
|
44 | + * Creates a new global storages controller. |
|
45 | + * |
|
46 | + * @param string $AppName application name |
|
47 | + * @param IRequest $request request object |
|
48 | + * @param IL10N $l10n l10n service |
|
49 | + * @param GlobalStoragesService $globalStoragesService storage service |
|
50 | + * @param ILogger $logger |
|
51 | + */ |
|
52 | + public function __construct( |
|
53 | + $AppName, |
|
54 | + IRequest $request, |
|
55 | + IL10N $l10n, |
|
56 | + GlobalStoragesService $globalStoragesService, |
|
57 | + ILogger $logger |
|
58 | + ) { |
|
59 | + parent::__construct( |
|
60 | + $AppName, |
|
61 | + $request, |
|
62 | + $l10n, |
|
63 | + $globalStoragesService, |
|
64 | + $logger |
|
65 | + ); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Create an external storage entry. |
|
70 | - * |
|
71 | - * @param string $mountPoint storage mount point |
|
72 | - * @param string $backend backend identifier |
|
73 | - * @param string $authMechanism authentication mechanism identifier |
|
74 | - * @param array $backendOptions backend-specific options |
|
75 | - * @param array $mountOptions mount-specific options |
|
76 | - * @param array $applicableUsers users for which to mount the storage |
|
77 | - * @param array $applicableGroups groups for which to mount the storage |
|
78 | - * @param int $priority priority |
|
79 | - * |
|
80 | - * @return DataResponse |
|
81 | - */ |
|
82 | - public function create( |
|
83 | - $mountPoint, |
|
84 | - $backend, |
|
85 | - $authMechanism, |
|
86 | - $backendOptions, |
|
87 | - $mountOptions, |
|
88 | - $applicableUsers, |
|
89 | - $applicableGroups, |
|
90 | - $priority |
|
91 | - ) { |
|
92 | - $newStorage = $this->createStorage( |
|
93 | - $mountPoint, |
|
94 | - $backend, |
|
95 | - $authMechanism, |
|
96 | - $backendOptions, |
|
97 | - $mountOptions, |
|
98 | - $applicableUsers, |
|
99 | - $applicableGroups, |
|
100 | - $priority |
|
101 | - ); |
|
102 | - if ($newStorage instanceof DataResponse) { |
|
103 | - return $newStorage; |
|
104 | - } |
|
68 | + /** |
|
69 | + * Create an external storage entry. |
|
70 | + * |
|
71 | + * @param string $mountPoint storage mount point |
|
72 | + * @param string $backend backend identifier |
|
73 | + * @param string $authMechanism authentication mechanism identifier |
|
74 | + * @param array $backendOptions backend-specific options |
|
75 | + * @param array $mountOptions mount-specific options |
|
76 | + * @param array $applicableUsers users for which to mount the storage |
|
77 | + * @param array $applicableGroups groups for which to mount the storage |
|
78 | + * @param int $priority priority |
|
79 | + * |
|
80 | + * @return DataResponse |
|
81 | + */ |
|
82 | + public function create( |
|
83 | + $mountPoint, |
|
84 | + $backend, |
|
85 | + $authMechanism, |
|
86 | + $backendOptions, |
|
87 | + $mountOptions, |
|
88 | + $applicableUsers, |
|
89 | + $applicableGroups, |
|
90 | + $priority |
|
91 | + ) { |
|
92 | + $newStorage = $this->createStorage( |
|
93 | + $mountPoint, |
|
94 | + $backend, |
|
95 | + $authMechanism, |
|
96 | + $backendOptions, |
|
97 | + $mountOptions, |
|
98 | + $applicableUsers, |
|
99 | + $applicableGroups, |
|
100 | + $priority |
|
101 | + ); |
|
102 | + if ($newStorage instanceof DataResponse) { |
|
103 | + return $newStorage; |
|
104 | + } |
|
105 | 105 | |
106 | - $response = $this->validate($newStorage); |
|
107 | - if (!empty($response)) { |
|
108 | - return $response; |
|
109 | - } |
|
106 | + $response = $this->validate($newStorage); |
|
107 | + if (!empty($response)) { |
|
108 | + return $response; |
|
109 | + } |
|
110 | 110 | |
111 | - $newStorage = $this->service->addStorage($newStorage); |
|
111 | + $newStorage = $this->service->addStorage($newStorage); |
|
112 | 112 | |
113 | - $this->updateStorageStatus($newStorage); |
|
113 | + $this->updateStorageStatus($newStorage); |
|
114 | 114 | |
115 | - return new DataResponse( |
|
116 | - $this->formatStorageForUI($newStorage), |
|
117 | - Http::STATUS_CREATED |
|
118 | - ); |
|
119 | - } |
|
115 | + return new DataResponse( |
|
116 | + $this->formatStorageForUI($newStorage), |
|
117 | + Http::STATUS_CREATED |
|
118 | + ); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Update an external storage entry. |
|
123 | - * |
|
124 | - * @param int $id storage id |
|
125 | - * @param string $mountPoint storage mount point |
|
126 | - * @param string $backend backend identifier |
|
127 | - * @param string $authMechanism authentication mechansim identifier |
|
128 | - * @param array $backendOptions backend-specific options |
|
129 | - * @param array $mountOptions mount-specific options |
|
130 | - * @param array $applicableUsers users for which to mount the storage |
|
131 | - * @param array $applicableGroups groups for which to mount the storage |
|
132 | - * @param int $priority priority |
|
133 | - * @param bool $testOnly whether to storage should only test the connection or do more things |
|
134 | - * |
|
135 | - * @return DataResponse |
|
136 | - */ |
|
137 | - public function update( |
|
138 | - $id, |
|
139 | - $mountPoint, |
|
140 | - $backend, |
|
141 | - $authMechanism, |
|
142 | - $backendOptions, |
|
143 | - $mountOptions, |
|
144 | - $applicableUsers, |
|
145 | - $applicableGroups, |
|
146 | - $priority, |
|
147 | - $testOnly = true |
|
148 | - ) { |
|
149 | - $storage = $this->createStorage( |
|
150 | - $mountPoint, |
|
151 | - $backend, |
|
152 | - $authMechanism, |
|
153 | - $backendOptions, |
|
154 | - $mountOptions, |
|
155 | - $applicableUsers, |
|
156 | - $applicableGroups, |
|
157 | - $priority |
|
158 | - ); |
|
159 | - if ($storage instanceof DataResponse) { |
|
160 | - return $storage; |
|
161 | - } |
|
162 | - $storage->setId($id); |
|
121 | + /** |
|
122 | + * Update an external storage entry. |
|
123 | + * |
|
124 | + * @param int $id storage id |
|
125 | + * @param string $mountPoint storage mount point |
|
126 | + * @param string $backend backend identifier |
|
127 | + * @param string $authMechanism authentication mechansim identifier |
|
128 | + * @param array $backendOptions backend-specific options |
|
129 | + * @param array $mountOptions mount-specific options |
|
130 | + * @param array $applicableUsers users for which to mount the storage |
|
131 | + * @param array $applicableGroups groups for which to mount the storage |
|
132 | + * @param int $priority priority |
|
133 | + * @param bool $testOnly whether to storage should only test the connection or do more things |
|
134 | + * |
|
135 | + * @return DataResponse |
|
136 | + */ |
|
137 | + public function update( |
|
138 | + $id, |
|
139 | + $mountPoint, |
|
140 | + $backend, |
|
141 | + $authMechanism, |
|
142 | + $backendOptions, |
|
143 | + $mountOptions, |
|
144 | + $applicableUsers, |
|
145 | + $applicableGroups, |
|
146 | + $priority, |
|
147 | + $testOnly = true |
|
148 | + ) { |
|
149 | + $storage = $this->createStorage( |
|
150 | + $mountPoint, |
|
151 | + $backend, |
|
152 | + $authMechanism, |
|
153 | + $backendOptions, |
|
154 | + $mountOptions, |
|
155 | + $applicableUsers, |
|
156 | + $applicableGroups, |
|
157 | + $priority |
|
158 | + ); |
|
159 | + if ($storage instanceof DataResponse) { |
|
160 | + return $storage; |
|
161 | + } |
|
162 | + $storage->setId($id); |
|
163 | 163 | |
164 | - $response = $this->validate($storage); |
|
165 | - if (!empty($response)) { |
|
166 | - return $response; |
|
167 | - } |
|
164 | + $response = $this->validate($storage); |
|
165 | + if (!empty($response)) { |
|
166 | + return $response; |
|
167 | + } |
|
168 | 168 | |
169 | - try { |
|
170 | - $storage = $this->service->updateStorage($storage); |
|
171 | - } catch (NotFoundException $e) { |
|
172 | - return new DataResponse( |
|
173 | - [ |
|
174 | - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) |
|
175 | - ], |
|
176 | - Http::STATUS_NOT_FOUND |
|
177 | - ); |
|
178 | - } |
|
169 | + try { |
|
170 | + $storage = $this->service->updateStorage($storage); |
|
171 | + } catch (NotFoundException $e) { |
|
172 | + return new DataResponse( |
|
173 | + [ |
|
174 | + 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) |
|
175 | + ], |
|
176 | + Http::STATUS_NOT_FOUND |
|
177 | + ); |
|
178 | + } |
|
179 | 179 | |
180 | - $this->updateStorageStatus($storage, $testOnly); |
|
180 | + $this->updateStorageStatus($storage, $testOnly); |
|
181 | 181 | |
182 | - return new DataResponse( |
|
183 | - $this->formatStorageForUI($storage), |
|
184 | - Http::STATUS_OK |
|
185 | - ); |
|
186 | - } |
|
182 | + return new DataResponse( |
|
183 | + $this->formatStorageForUI($storage), |
|
184 | + Http::STATUS_OK |
|
185 | + ); |
|
186 | + } |
|
187 | 187 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * {@inheritDoc} |
28 | 28 | */ |
29 | 29 | public function getName() { |
30 | - return (string)$this->l10n->t('Education Edition'); |
|
30 | + return (string) $this->l10n->t('Education Edition'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -25,24 +25,24 @@ |
||
25 | 25 | |
26 | 26 | class EducationBundle extends Bundle { |
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritDoc} |
|
30 | - */ |
|
31 | - public function getName() { |
|
32 | - return (string)$this->l10n->t('Education Edition'); |
|
33 | - } |
|
28 | + /** |
|
29 | + * {@inheritDoc} |
|
30 | + */ |
|
31 | + public function getName() { |
|
32 | + return (string)$this->l10n->t('Education Edition'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - */ |
|
38 | - public function getAppIdentifiers() { |
|
39 | - return [ |
|
40 | - 'dashboard', |
|
41 | - 'circles', |
|
42 | - 'groupfolders', |
|
43 | - 'announcementcenter', |
|
44 | - 'quota_warning', |
|
45 | - 'user_saml', |
|
46 | - ]; |
|
47 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + */ |
|
38 | + public function getAppIdentifiers() { |
|
39 | + return [ |
|
40 | + 'dashboard', |
|
41 | + 'circles', |
|
42 | + 'groupfolders', |
|
43 | + 'announcementcenter', |
|
44 | + 'quota_warning', |
|
45 | + 'user_saml', |
|
46 | + ]; |
|
47 | + } |
|
48 | 48 | } |
@@ -35,118 +35,118 @@ |
||
35 | 35 | |
36 | 36 | abstract class AbstractDatabase { |
37 | 37 | |
38 | - /** @var IL10N */ |
|
39 | - protected $trans; |
|
40 | - /** @var string */ |
|
41 | - protected $dbUser; |
|
42 | - /** @var string */ |
|
43 | - protected $dbPassword; |
|
44 | - /** @var string */ |
|
45 | - protected $dbName; |
|
46 | - /** @var string */ |
|
47 | - protected $dbHost; |
|
48 | - /** @var string */ |
|
49 | - protected $dbPort; |
|
50 | - /** @var string */ |
|
51 | - protected $tablePrefix; |
|
52 | - /** @var SystemConfig */ |
|
53 | - protected $config; |
|
54 | - /** @var ILogger */ |
|
55 | - protected $logger; |
|
56 | - /** @var ISecureRandom */ |
|
57 | - protected $random; |
|
38 | + /** @var IL10N */ |
|
39 | + protected $trans; |
|
40 | + /** @var string */ |
|
41 | + protected $dbUser; |
|
42 | + /** @var string */ |
|
43 | + protected $dbPassword; |
|
44 | + /** @var string */ |
|
45 | + protected $dbName; |
|
46 | + /** @var string */ |
|
47 | + protected $dbHost; |
|
48 | + /** @var string */ |
|
49 | + protected $dbPort; |
|
50 | + /** @var string */ |
|
51 | + protected $tablePrefix; |
|
52 | + /** @var SystemConfig */ |
|
53 | + protected $config; |
|
54 | + /** @var ILogger */ |
|
55 | + protected $logger; |
|
56 | + /** @var ISecureRandom */ |
|
57 | + protected $random; |
|
58 | 58 | |
59 | - public function __construct(IL10N $trans, SystemConfig $config, ILogger $logger, ISecureRandom $random) { |
|
60 | - $this->trans = $trans; |
|
61 | - $this->config = $config; |
|
62 | - $this->logger = $logger; |
|
63 | - $this->random = $random; |
|
64 | - } |
|
59 | + public function __construct(IL10N $trans, SystemConfig $config, ILogger $logger, ISecureRandom $random) { |
|
60 | + $this->trans = $trans; |
|
61 | + $this->config = $config; |
|
62 | + $this->logger = $logger; |
|
63 | + $this->random = $random; |
|
64 | + } |
|
65 | 65 | |
66 | - public function validate($config) { |
|
67 | - $errors = []; |
|
68 | - if (empty($config['dbuser']) && empty($config['dbname'])) { |
|
69 | - $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); |
|
70 | - } elseif (empty($config['dbuser'])) { |
|
71 | - $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); |
|
72 | - } elseif (empty($config['dbname'])) { |
|
73 | - $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); |
|
74 | - } |
|
75 | - if (substr_count($config['dbname'], '.') >= 1) { |
|
76 | - $errors[] = $this->trans->t("%s you may not use dots in the database name", [$this->dbprettyname]); |
|
77 | - } |
|
78 | - return $errors; |
|
79 | - } |
|
66 | + public function validate($config) { |
|
67 | + $errors = []; |
|
68 | + if (empty($config['dbuser']) && empty($config['dbname'])) { |
|
69 | + $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); |
|
70 | + } elseif (empty($config['dbuser'])) { |
|
71 | + $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); |
|
72 | + } elseif (empty($config['dbname'])) { |
|
73 | + $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); |
|
74 | + } |
|
75 | + if (substr_count($config['dbname'], '.') >= 1) { |
|
76 | + $errors[] = $this->trans->t("%s you may not use dots in the database name", [$this->dbprettyname]); |
|
77 | + } |
|
78 | + return $errors; |
|
79 | + } |
|
80 | 80 | |
81 | - public function initialize($config) { |
|
82 | - $dbUser = $config['dbuser']; |
|
83 | - $dbPass = $config['dbpass']; |
|
84 | - $dbName = $config['dbname']; |
|
85 | - $dbHost = !empty($config['dbhost']) ? $config['dbhost'] : 'localhost'; |
|
86 | - $dbPort = !empty($config['dbport']) ? $config['dbport'] : ''; |
|
87 | - $dbTablePrefix = isset($config['dbtableprefix']) ? $config['dbtableprefix'] : 'oc_'; |
|
81 | + public function initialize($config) { |
|
82 | + $dbUser = $config['dbuser']; |
|
83 | + $dbPass = $config['dbpass']; |
|
84 | + $dbName = $config['dbname']; |
|
85 | + $dbHost = !empty($config['dbhost']) ? $config['dbhost'] : 'localhost'; |
|
86 | + $dbPort = !empty($config['dbport']) ? $config['dbport'] : ''; |
|
87 | + $dbTablePrefix = isset($config['dbtableprefix']) ? $config['dbtableprefix'] : 'oc_'; |
|
88 | 88 | |
89 | - $this->config->setValues([ |
|
90 | - 'dbname' => $dbName, |
|
91 | - 'dbhost' => $dbHost, |
|
92 | - 'dbport' => $dbPort, |
|
93 | - 'dbtableprefix' => $dbTablePrefix, |
|
94 | - ]); |
|
89 | + $this->config->setValues([ |
|
90 | + 'dbname' => $dbName, |
|
91 | + 'dbhost' => $dbHost, |
|
92 | + 'dbport' => $dbPort, |
|
93 | + 'dbtableprefix' => $dbTablePrefix, |
|
94 | + ]); |
|
95 | 95 | |
96 | - $this->dbUser = $dbUser; |
|
97 | - $this->dbPassword = $dbPass; |
|
98 | - $this->dbName = $dbName; |
|
99 | - $this->dbHost = $dbHost; |
|
100 | - $this->dbPort = $dbPort; |
|
101 | - $this->tablePrefix = $dbTablePrefix; |
|
102 | - } |
|
96 | + $this->dbUser = $dbUser; |
|
97 | + $this->dbPassword = $dbPass; |
|
98 | + $this->dbName = $dbName; |
|
99 | + $this->dbHost = $dbHost; |
|
100 | + $this->dbPort = $dbPort; |
|
101 | + $this->tablePrefix = $dbTablePrefix; |
|
102 | + } |
|
103 | 103 | |
104 | - /** |
|
105 | - * @param array $configOverwrite |
|
106 | - * @return \OC\DB\Connection |
|
107 | - */ |
|
108 | - protected function connect(array $configOverwrite = []) { |
|
109 | - $connectionParams = [ |
|
110 | - 'host' => $this->dbHost, |
|
111 | - 'user' => $this->dbUser, |
|
112 | - 'password' => $this->dbPassword, |
|
113 | - 'tablePrefix' => $this->tablePrefix, |
|
114 | - 'dbname' => $this->dbName |
|
115 | - ]; |
|
104 | + /** |
|
105 | + * @param array $configOverwrite |
|
106 | + * @return \OC\DB\Connection |
|
107 | + */ |
|
108 | + protected function connect(array $configOverwrite = []) { |
|
109 | + $connectionParams = [ |
|
110 | + 'host' => $this->dbHost, |
|
111 | + 'user' => $this->dbUser, |
|
112 | + 'password' => $this->dbPassword, |
|
113 | + 'tablePrefix' => $this->tablePrefix, |
|
114 | + 'dbname' => $this->dbName |
|
115 | + ]; |
|
116 | 116 | |
117 | - // adding port support through installer |
|
118 | - if (!empty($this->dbPort)) { |
|
119 | - if (ctype_digit($this->dbPort)) { |
|
120 | - $connectionParams['port'] = $this->dbPort; |
|
121 | - } else { |
|
122 | - $connectionParams['unix_socket'] = $this->dbPort; |
|
123 | - } |
|
124 | - } elseif (strpos($this->dbHost, ':')) { |
|
125 | - // Host variable may carry a port or socket. |
|
126 | - list($host, $portOrSocket) = explode(':', $this->dbHost, 2); |
|
127 | - if (ctype_digit($portOrSocket)) { |
|
128 | - $connectionParams['port'] = $portOrSocket; |
|
129 | - } else { |
|
130 | - $connectionParams['unix_socket'] = $portOrSocket; |
|
131 | - } |
|
132 | - $connectionParams['host'] = $host; |
|
133 | - } |
|
117 | + // adding port support through installer |
|
118 | + if (!empty($this->dbPort)) { |
|
119 | + if (ctype_digit($this->dbPort)) { |
|
120 | + $connectionParams['port'] = $this->dbPort; |
|
121 | + } else { |
|
122 | + $connectionParams['unix_socket'] = $this->dbPort; |
|
123 | + } |
|
124 | + } elseif (strpos($this->dbHost, ':')) { |
|
125 | + // Host variable may carry a port or socket. |
|
126 | + list($host, $portOrSocket) = explode(':', $this->dbHost, 2); |
|
127 | + if (ctype_digit($portOrSocket)) { |
|
128 | + $connectionParams['port'] = $portOrSocket; |
|
129 | + } else { |
|
130 | + $connectionParams['unix_socket'] = $portOrSocket; |
|
131 | + } |
|
132 | + $connectionParams['host'] = $host; |
|
133 | + } |
|
134 | 134 | |
135 | - $connectionParams = array_merge($connectionParams, $configOverwrite); |
|
136 | - $cf = new ConnectionFactory($this->config); |
|
137 | - return $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams); |
|
138 | - } |
|
135 | + $connectionParams = array_merge($connectionParams, $configOverwrite); |
|
136 | + $cf = new ConnectionFactory($this->config); |
|
137 | + return $cf->getConnection($this->config->getValue('dbtype', 'sqlite'), $connectionParams); |
|
138 | + } |
|
139 | 139 | |
140 | - /** |
|
141 | - * @param string $userName |
|
142 | - */ |
|
143 | - abstract public function setupDatabase($userName); |
|
140 | + /** |
|
141 | + * @param string $userName |
|
142 | + */ |
|
143 | + abstract public function setupDatabase($userName); |
|
144 | 144 | |
145 | - public function runMigrations() { |
|
146 | - if (!is_dir(\OC::$SERVERROOT."/core/Migrations")) { |
|
147 | - return; |
|
148 | - } |
|
149 | - $ms = new MigrationService('core', \OC::$server->getDatabaseConnection()); |
|
150 | - $ms->migrate(); |
|
151 | - } |
|
145 | + public function runMigrations() { |
|
146 | + if (!is_dir(\OC::$SERVERROOT."/core/Migrations")) { |
|
147 | + return; |
|
148 | + } |
|
149 | + $ms = new MigrationService('core', \OC::$server->getDatabaseConnection()); |
|
150 | + $ms->migrate(); |
|
151 | + } |
|
152 | 152 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\DB\QueryBuilder\QueryFunction; |
25 | 25 | |
26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
27 | - public function concat($x, $y) { |
|
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | - } |
|
27 | + public function concat($x, $y) { |
|
28 | + return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
29 | + } |
|
30 | 30 | } |
@@ -25,6 +25,6 @@ |
||
25 | 25 | |
26 | 26 | class PgSqlFunctionBuilder extends FunctionBuilder { |
27 | 27 | public function concat($x, $y) { |
28 | - return new QueryFunction('(' . $this->helper->quoteColumnName($x) . ' || ' . $this->helper->quoteColumnName($y) . ')'); |
|
28 | + return new QueryFunction('('.$this->helper->quoteColumnName($x).' || '.$this->helper->quoteColumnName($y).')'); |
|
29 | 29 | } |
30 | 30 | } |
@@ -24,18 +24,18 @@ |
||
24 | 24 | use OCP\Files\ObjectStore\IObjectStore; |
25 | 25 | |
26 | 26 | class S3 implements IObjectStore { |
27 | - use S3ConnectionTrait; |
|
28 | - use S3ObjectTrait; |
|
27 | + use S3ConnectionTrait; |
|
28 | + use S3ObjectTrait; |
|
29 | 29 | |
30 | - public function __construct($parameters) { |
|
31 | - $this->parseParams($parameters); |
|
32 | - } |
|
30 | + public function __construct($parameters) { |
|
31 | + $this->parseParams($parameters); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * @return string the container or bucket name where objects are stored |
|
36 | - * @since 7.0.0 |
|
37 | - */ |
|
38 | - public function getStorageId() { |
|
39 | - return $this->id; |
|
40 | - } |
|
34 | + /** |
|
35 | + * @return string the container or bucket name where objects are stored |
|
36 | + * @since 7.0.0 |
|
37 | + */ |
|
38 | + public function getStorageId() { |
|
39 | + return $this->id; |
|
40 | + } |
|
41 | 41 | } |
@@ -11,43 +11,43 @@ |
||
11 | 11 | use OCP\Share\IManager; |
12 | 12 | |
13 | 13 | class OCSShareAPIMiddleware extends Middleware { |
14 | - /** @var IManager */ |
|
15 | - private $shareManager; |
|
16 | - /** @var IL10N */ |
|
17 | - private $l; |
|
14 | + /** @var IManager */ |
|
15 | + private $shareManager; |
|
16 | + /** @var IL10N */ |
|
17 | + private $l; |
|
18 | 18 | |
19 | - public function __construct(IManager $shareManager, |
|
20 | - IL10N $l) { |
|
21 | - $this->shareManager = $shareManager; |
|
22 | - $this->l = $l; |
|
23 | - } |
|
19 | + public function __construct(IManager $shareManager, |
|
20 | + IL10N $l) { |
|
21 | + $this->shareManager = $shareManager; |
|
22 | + $this->l = $l; |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * @param Controller $controller |
|
27 | - * @param string $methodName |
|
28 | - * |
|
29 | - * @throws OCSNotFoundException |
|
30 | - */ |
|
31 | - public function beforeController($controller, $methodName) { |
|
32 | - if ($controller instanceof ShareAPIController) { |
|
33 | - if (!$this->shareManager->shareApiEnabled()) { |
|
34 | - throw new OCSNotFoundException($this->l->t('Share API is disabled')); |
|
35 | - } |
|
36 | - } |
|
37 | - } |
|
25 | + /** |
|
26 | + * @param Controller $controller |
|
27 | + * @param string $methodName |
|
28 | + * |
|
29 | + * @throws OCSNotFoundException |
|
30 | + */ |
|
31 | + public function beforeController($controller, $methodName) { |
|
32 | + if ($controller instanceof ShareAPIController) { |
|
33 | + if (!$this->shareManager->shareApiEnabled()) { |
|
34 | + throw new OCSNotFoundException($this->l->t('Share API is disabled')); |
|
35 | + } |
|
36 | + } |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param Controller $controller |
|
41 | - * @param string $methodName |
|
42 | - * @param Response $response |
|
43 | - * @return Response |
|
44 | - */ |
|
45 | - public function afterController($controller, $methodName, Response $response) { |
|
46 | - if ($controller instanceof ShareAPIController) { |
|
47 | - /** @var ShareAPIController $controller */ |
|
48 | - $controller->cleanup(); |
|
49 | - } |
|
39 | + /** |
|
40 | + * @param Controller $controller |
|
41 | + * @param string $methodName |
|
42 | + * @param Response $response |
|
43 | + * @return Response |
|
44 | + */ |
|
45 | + public function afterController($controller, $methodName, Response $response) { |
|
46 | + if ($controller instanceof ShareAPIController) { |
|
47 | + /** @var ShareAPIController $controller */ |
|
48 | + $controller->cleanup(); |
|
49 | + } |
|
50 | 50 | |
51 | - return $response; |
|
52 | - } |
|
51 | + return $response; |
|
52 | + } |
|
53 | 53 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $result = $query->execute(); |
88 | 88 | |
89 | 89 | if ($result) { |
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
90 | + return (int) $this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | 91 | } |
92 | 92 | |
93 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
93 | + $message = 'Internal failure, Could not add trusted server: '.$url; |
|
94 | 94 | $message_t = $this->IL10N->t('Could not add server'); |
95 | 95 | throw new HintException($message, $message_t); |
96 | 96 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $result = $query->execute()->fetchAll(); |
125 | 125 | |
126 | 126 | if (empty($result)) { |
127 | - throw new \Exception('No Server found with ID: ' . $id); |
|
127 | + throw new \Exception('No Server found with ID: '.$id); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | return $result[0]; |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $statement->closeCursor(); |
202 | 202 | |
203 | 203 | if (!isset($result['token'])) { |
204 | - throw new \Exception('No token found for: ' . $url); |
|
204 | + throw new \Exception('No token found for: '.$url); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $result['token']; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $statement = $query->execute(); |
279 | 279 | $result = $statement->fetch(); |
280 | 280 | $statement->closeCursor(); |
281 | - return (int)$result['status']; |
|
281 | + return (int) $result['status']; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -42,293 +42,293 @@ |
||
42 | 42 | */ |
43 | 43 | class DbHandler { |
44 | 44 | |
45 | - /** @var IDBConnection */ |
|
46 | - private $connection; |
|
47 | - |
|
48 | - /** @var IL10N */ |
|
49 | - private $IL10N; |
|
50 | - |
|
51 | - /** @var string */ |
|
52 | - private $dbTable = 'trusted_servers'; |
|
53 | - |
|
54 | - /** |
|
55 | - * @param IDBConnection $connection |
|
56 | - * @param IL10N $il10n |
|
57 | - */ |
|
58 | - public function __construct( |
|
59 | - IDBConnection $connection, |
|
60 | - IL10N $il10n |
|
61 | - ) { |
|
62 | - $this->connection = $connection; |
|
63 | - $this->IL10N = $il10n; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * add server to the list of trusted servers |
|
68 | - * |
|
69 | - * @param string $url |
|
70 | - * @return int |
|
71 | - * @throws HintException |
|
72 | - */ |
|
73 | - public function addServer($url) { |
|
74 | - $hash = $this->hash($url); |
|
75 | - $url = rtrim($url, '/'); |
|
76 | - $query = $this->connection->getQueryBuilder(); |
|
77 | - $query->insert($this->dbTable) |
|
78 | - ->values( |
|
79 | - [ |
|
80 | - 'url' => $query->createParameter('url'), |
|
81 | - 'url_hash' => $query->createParameter('url_hash'), |
|
82 | - ] |
|
83 | - ) |
|
84 | - ->setParameter('url', $url) |
|
85 | - ->setParameter('url_hash', $hash); |
|
86 | - |
|
87 | - $result = $query->execute(); |
|
88 | - |
|
89 | - if ($result) { |
|
90 | - return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | - } |
|
92 | - |
|
93 | - $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
94 | - $message_t = $this->IL10N->t('Could not add server'); |
|
95 | - throw new HintException($message, $message_t); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * remove server from the list of trusted servers |
|
100 | - * |
|
101 | - * @param int $id |
|
102 | - */ |
|
103 | - public function removeServer($id) { |
|
104 | - $query = $this->connection->getQueryBuilder(); |
|
105 | - $query->delete($this->dbTable) |
|
106 | - ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
107 | - ->setParameter('id', $id); |
|
108 | - $query->execute(); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * get trusted server with given ID |
|
113 | - * |
|
114 | - * @param int $id |
|
115 | - * @return array |
|
116 | - * @throws \Exception |
|
117 | - */ |
|
118 | - public function getServerById($id) { |
|
119 | - $query = $this->connection->getQueryBuilder(); |
|
120 | - $query->select('*')->from($this->dbTable) |
|
121 | - ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
122 | - ->setParameter('id', $id); |
|
123 | - $query->execute(); |
|
124 | - $result = $query->execute()->fetchAll(); |
|
125 | - |
|
126 | - if (empty($result)) { |
|
127 | - throw new \Exception('No Server found with ID: ' . $id); |
|
128 | - } |
|
129 | - |
|
130 | - return $result[0]; |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * get all trusted servers |
|
135 | - * |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function getAllServer() { |
|
139 | - $query = $this->connection->getQueryBuilder(); |
|
140 | - $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token']) |
|
141 | - ->from($this->dbTable); |
|
142 | - $statement = $query->execute(); |
|
143 | - $result = $statement->fetchAll(); |
|
144 | - $statement->closeCursor(); |
|
145 | - return $result; |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * check if server already exists in the database table |
|
150 | - * |
|
151 | - * @param string $url |
|
152 | - * @return bool |
|
153 | - */ |
|
154 | - public function serverExists($url) { |
|
155 | - $hash = $this->hash($url); |
|
156 | - $query = $this->connection->getQueryBuilder(); |
|
157 | - $query->select('url') |
|
158 | - ->from($this->dbTable) |
|
159 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
160 | - ->setParameter('url_hash', $hash); |
|
161 | - $statement = $query->execute(); |
|
162 | - $result = $statement->fetchAll(); |
|
163 | - $statement->closeCursor(); |
|
164 | - |
|
165 | - return !empty($result); |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * write token to database. Token is used to exchange the secret |
|
170 | - * |
|
171 | - * @param string $url |
|
172 | - * @param string $token |
|
173 | - */ |
|
174 | - public function addToken($url, $token) { |
|
175 | - $hash = $this->hash($url); |
|
176 | - $query = $this->connection->getQueryBuilder(); |
|
177 | - $query->update($this->dbTable) |
|
178 | - ->set('token', $query->createParameter('token')) |
|
179 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
180 | - ->setParameter('url_hash', $hash) |
|
181 | - ->setParameter('token', $token); |
|
182 | - $query->execute(); |
|
183 | - } |
|
184 | - |
|
185 | - /** |
|
186 | - * get token stored in database |
|
187 | - * |
|
188 | - * @param string $url |
|
189 | - * @return string |
|
190 | - * @throws \Exception |
|
191 | - */ |
|
192 | - public function getToken($url) { |
|
193 | - $hash = $this->hash($url); |
|
194 | - $query = $this->connection->getQueryBuilder(); |
|
195 | - $query->select('token')->from($this->dbTable) |
|
196 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
197 | - ->setParameter('url_hash', $hash); |
|
198 | - |
|
199 | - $statement = $query->execute(); |
|
200 | - $result = $statement->fetch(); |
|
201 | - $statement->closeCursor(); |
|
202 | - |
|
203 | - if (!isset($result['token'])) { |
|
204 | - throw new \Exception('No token found for: ' . $url); |
|
205 | - } |
|
206 | - |
|
207 | - return $result['token']; |
|
208 | - } |
|
209 | - |
|
210 | - /** |
|
211 | - * add shared Secret to database |
|
212 | - * |
|
213 | - * @param string $url |
|
214 | - * @param string $sharedSecret |
|
215 | - */ |
|
216 | - public function addSharedSecret($url, $sharedSecret) { |
|
217 | - $hash = $this->hash($url); |
|
218 | - $query = $this->connection->getQueryBuilder(); |
|
219 | - $query->update($this->dbTable) |
|
220 | - ->set('shared_secret', $query->createParameter('sharedSecret')) |
|
221 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
222 | - ->setParameter('url_hash', $hash) |
|
223 | - ->setParameter('sharedSecret', $sharedSecret); |
|
224 | - $query->execute(); |
|
225 | - } |
|
226 | - |
|
227 | - /** |
|
228 | - * get shared secret from database |
|
229 | - * |
|
230 | - * @param string $url |
|
231 | - * @return string |
|
232 | - */ |
|
233 | - public function getSharedSecret($url) { |
|
234 | - $hash = $this->hash($url); |
|
235 | - $query = $this->connection->getQueryBuilder(); |
|
236 | - $query->select('shared_secret')->from($this->dbTable) |
|
237 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
238 | - ->setParameter('url_hash', $hash); |
|
239 | - |
|
240 | - $statement = $query->execute(); |
|
241 | - $result = $statement->fetch(); |
|
242 | - $statement->closeCursor(); |
|
243 | - return $result['shared_secret']; |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * set server status |
|
248 | - * |
|
249 | - * @param string $url |
|
250 | - * @param int $status |
|
251 | - * @param string|null $token |
|
252 | - */ |
|
253 | - public function setServerStatus($url, $status, $token = null) { |
|
254 | - $hash = $this->hash($url); |
|
255 | - $query = $this->connection->getQueryBuilder(); |
|
256 | - $query->update($this->dbTable) |
|
257 | - ->set('status', $query->createNamedParameter($status)) |
|
258 | - ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); |
|
259 | - if (!is_null($token)) { |
|
260 | - $query->set('sync_token', $query->createNamedParameter($token)); |
|
261 | - } |
|
262 | - $query->execute(); |
|
263 | - } |
|
264 | - |
|
265 | - /** |
|
266 | - * get server status |
|
267 | - * |
|
268 | - * @param string $url |
|
269 | - * @return int |
|
270 | - */ |
|
271 | - public function getServerStatus($url) { |
|
272 | - $hash = $this->hash($url); |
|
273 | - $query = $this->connection->getQueryBuilder(); |
|
274 | - $query->select('status')->from($this->dbTable) |
|
275 | - ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
276 | - ->setParameter('url_hash', $hash); |
|
277 | - |
|
278 | - $statement = $query->execute(); |
|
279 | - $result = $statement->fetch(); |
|
280 | - $statement->closeCursor(); |
|
281 | - return (int)$result['status']; |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * create hash from URL |
|
286 | - * |
|
287 | - * @param string $url |
|
288 | - * @return string |
|
289 | - */ |
|
290 | - protected function hash($url) { |
|
291 | - $normalized = $this->normalizeUrl($url); |
|
292 | - return sha1($normalized); |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * normalize URL, used to create the sha1 hash |
|
297 | - * |
|
298 | - * @param string $url |
|
299 | - * @return string |
|
300 | - */ |
|
301 | - protected function normalizeUrl($url) { |
|
302 | - $normalized = $url; |
|
303 | - |
|
304 | - if (strpos($url, 'https://') === 0) { |
|
305 | - $normalized = substr($url, strlen('https://')); |
|
306 | - } elseif (strpos($url, 'http://') === 0) { |
|
307 | - $normalized = substr($url, strlen('http://')); |
|
308 | - } |
|
309 | - |
|
310 | - $normalized = Filesystem::normalizePath($normalized); |
|
311 | - $normalized = trim($normalized, '/'); |
|
312 | - |
|
313 | - return $normalized; |
|
314 | - } |
|
315 | - |
|
316 | - /** |
|
317 | - * @param $username |
|
318 | - * @param $password |
|
319 | - * @return bool |
|
320 | - */ |
|
321 | - public function auth($username, $password) { |
|
322 | - if ($username !== 'system') { |
|
323 | - return false; |
|
324 | - } |
|
325 | - $query = $this->connection->getQueryBuilder(); |
|
326 | - $query->select('url')->from($this->dbTable) |
|
327 | - ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); |
|
328 | - |
|
329 | - $statement = $query->execute(); |
|
330 | - $result = $statement->fetch(); |
|
331 | - $statement->closeCursor(); |
|
332 | - return !empty($result); |
|
333 | - } |
|
45 | + /** @var IDBConnection */ |
|
46 | + private $connection; |
|
47 | + |
|
48 | + /** @var IL10N */ |
|
49 | + private $IL10N; |
|
50 | + |
|
51 | + /** @var string */ |
|
52 | + private $dbTable = 'trusted_servers'; |
|
53 | + |
|
54 | + /** |
|
55 | + * @param IDBConnection $connection |
|
56 | + * @param IL10N $il10n |
|
57 | + */ |
|
58 | + public function __construct( |
|
59 | + IDBConnection $connection, |
|
60 | + IL10N $il10n |
|
61 | + ) { |
|
62 | + $this->connection = $connection; |
|
63 | + $this->IL10N = $il10n; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * add server to the list of trusted servers |
|
68 | + * |
|
69 | + * @param string $url |
|
70 | + * @return int |
|
71 | + * @throws HintException |
|
72 | + */ |
|
73 | + public function addServer($url) { |
|
74 | + $hash = $this->hash($url); |
|
75 | + $url = rtrim($url, '/'); |
|
76 | + $query = $this->connection->getQueryBuilder(); |
|
77 | + $query->insert($this->dbTable) |
|
78 | + ->values( |
|
79 | + [ |
|
80 | + 'url' => $query->createParameter('url'), |
|
81 | + 'url_hash' => $query->createParameter('url_hash'), |
|
82 | + ] |
|
83 | + ) |
|
84 | + ->setParameter('url', $url) |
|
85 | + ->setParameter('url_hash', $hash); |
|
86 | + |
|
87 | + $result = $query->execute(); |
|
88 | + |
|
89 | + if ($result) { |
|
90 | + return (int)$this->connection->lastInsertId('*PREFIX*'.$this->dbTable); |
|
91 | + } |
|
92 | + |
|
93 | + $message = 'Internal failure, Could not add trusted server: ' . $url; |
|
94 | + $message_t = $this->IL10N->t('Could not add server'); |
|
95 | + throw new HintException($message, $message_t); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * remove server from the list of trusted servers |
|
100 | + * |
|
101 | + * @param int $id |
|
102 | + */ |
|
103 | + public function removeServer($id) { |
|
104 | + $query = $this->connection->getQueryBuilder(); |
|
105 | + $query->delete($this->dbTable) |
|
106 | + ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
107 | + ->setParameter('id', $id); |
|
108 | + $query->execute(); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * get trusted server with given ID |
|
113 | + * |
|
114 | + * @param int $id |
|
115 | + * @return array |
|
116 | + * @throws \Exception |
|
117 | + */ |
|
118 | + public function getServerById($id) { |
|
119 | + $query = $this->connection->getQueryBuilder(); |
|
120 | + $query->select('*')->from($this->dbTable) |
|
121 | + ->where($query->expr()->eq('id', $query->createParameter('id'))) |
|
122 | + ->setParameter('id', $id); |
|
123 | + $query->execute(); |
|
124 | + $result = $query->execute()->fetchAll(); |
|
125 | + |
|
126 | + if (empty($result)) { |
|
127 | + throw new \Exception('No Server found with ID: ' . $id); |
|
128 | + } |
|
129 | + |
|
130 | + return $result[0]; |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * get all trusted servers |
|
135 | + * |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function getAllServer() { |
|
139 | + $query = $this->connection->getQueryBuilder(); |
|
140 | + $query->select(['url', 'url_hash', 'id', 'status', 'shared_secret', 'sync_token']) |
|
141 | + ->from($this->dbTable); |
|
142 | + $statement = $query->execute(); |
|
143 | + $result = $statement->fetchAll(); |
|
144 | + $statement->closeCursor(); |
|
145 | + return $result; |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * check if server already exists in the database table |
|
150 | + * |
|
151 | + * @param string $url |
|
152 | + * @return bool |
|
153 | + */ |
|
154 | + public function serverExists($url) { |
|
155 | + $hash = $this->hash($url); |
|
156 | + $query = $this->connection->getQueryBuilder(); |
|
157 | + $query->select('url') |
|
158 | + ->from($this->dbTable) |
|
159 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
160 | + ->setParameter('url_hash', $hash); |
|
161 | + $statement = $query->execute(); |
|
162 | + $result = $statement->fetchAll(); |
|
163 | + $statement->closeCursor(); |
|
164 | + |
|
165 | + return !empty($result); |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * write token to database. Token is used to exchange the secret |
|
170 | + * |
|
171 | + * @param string $url |
|
172 | + * @param string $token |
|
173 | + */ |
|
174 | + public function addToken($url, $token) { |
|
175 | + $hash = $this->hash($url); |
|
176 | + $query = $this->connection->getQueryBuilder(); |
|
177 | + $query->update($this->dbTable) |
|
178 | + ->set('token', $query->createParameter('token')) |
|
179 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
180 | + ->setParameter('url_hash', $hash) |
|
181 | + ->setParameter('token', $token); |
|
182 | + $query->execute(); |
|
183 | + } |
|
184 | + |
|
185 | + /** |
|
186 | + * get token stored in database |
|
187 | + * |
|
188 | + * @param string $url |
|
189 | + * @return string |
|
190 | + * @throws \Exception |
|
191 | + */ |
|
192 | + public function getToken($url) { |
|
193 | + $hash = $this->hash($url); |
|
194 | + $query = $this->connection->getQueryBuilder(); |
|
195 | + $query->select('token')->from($this->dbTable) |
|
196 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
197 | + ->setParameter('url_hash', $hash); |
|
198 | + |
|
199 | + $statement = $query->execute(); |
|
200 | + $result = $statement->fetch(); |
|
201 | + $statement->closeCursor(); |
|
202 | + |
|
203 | + if (!isset($result['token'])) { |
|
204 | + throw new \Exception('No token found for: ' . $url); |
|
205 | + } |
|
206 | + |
|
207 | + return $result['token']; |
|
208 | + } |
|
209 | + |
|
210 | + /** |
|
211 | + * add shared Secret to database |
|
212 | + * |
|
213 | + * @param string $url |
|
214 | + * @param string $sharedSecret |
|
215 | + */ |
|
216 | + public function addSharedSecret($url, $sharedSecret) { |
|
217 | + $hash = $this->hash($url); |
|
218 | + $query = $this->connection->getQueryBuilder(); |
|
219 | + $query->update($this->dbTable) |
|
220 | + ->set('shared_secret', $query->createParameter('sharedSecret')) |
|
221 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
222 | + ->setParameter('url_hash', $hash) |
|
223 | + ->setParameter('sharedSecret', $sharedSecret); |
|
224 | + $query->execute(); |
|
225 | + } |
|
226 | + |
|
227 | + /** |
|
228 | + * get shared secret from database |
|
229 | + * |
|
230 | + * @param string $url |
|
231 | + * @return string |
|
232 | + */ |
|
233 | + public function getSharedSecret($url) { |
|
234 | + $hash = $this->hash($url); |
|
235 | + $query = $this->connection->getQueryBuilder(); |
|
236 | + $query->select('shared_secret')->from($this->dbTable) |
|
237 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
238 | + ->setParameter('url_hash', $hash); |
|
239 | + |
|
240 | + $statement = $query->execute(); |
|
241 | + $result = $statement->fetch(); |
|
242 | + $statement->closeCursor(); |
|
243 | + return $result['shared_secret']; |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * set server status |
|
248 | + * |
|
249 | + * @param string $url |
|
250 | + * @param int $status |
|
251 | + * @param string|null $token |
|
252 | + */ |
|
253 | + public function setServerStatus($url, $status, $token = null) { |
|
254 | + $hash = $this->hash($url); |
|
255 | + $query = $this->connection->getQueryBuilder(); |
|
256 | + $query->update($this->dbTable) |
|
257 | + ->set('status', $query->createNamedParameter($status)) |
|
258 | + ->where($query->expr()->eq('url_hash', $query->createNamedParameter($hash))); |
|
259 | + if (!is_null($token)) { |
|
260 | + $query->set('sync_token', $query->createNamedParameter($token)); |
|
261 | + } |
|
262 | + $query->execute(); |
|
263 | + } |
|
264 | + |
|
265 | + /** |
|
266 | + * get server status |
|
267 | + * |
|
268 | + * @param string $url |
|
269 | + * @return int |
|
270 | + */ |
|
271 | + public function getServerStatus($url) { |
|
272 | + $hash = $this->hash($url); |
|
273 | + $query = $this->connection->getQueryBuilder(); |
|
274 | + $query->select('status')->from($this->dbTable) |
|
275 | + ->where($query->expr()->eq('url_hash', $query->createParameter('url_hash'))) |
|
276 | + ->setParameter('url_hash', $hash); |
|
277 | + |
|
278 | + $statement = $query->execute(); |
|
279 | + $result = $statement->fetch(); |
|
280 | + $statement->closeCursor(); |
|
281 | + return (int)$result['status']; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * create hash from URL |
|
286 | + * |
|
287 | + * @param string $url |
|
288 | + * @return string |
|
289 | + */ |
|
290 | + protected function hash($url) { |
|
291 | + $normalized = $this->normalizeUrl($url); |
|
292 | + return sha1($normalized); |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * normalize URL, used to create the sha1 hash |
|
297 | + * |
|
298 | + * @param string $url |
|
299 | + * @return string |
|
300 | + */ |
|
301 | + protected function normalizeUrl($url) { |
|
302 | + $normalized = $url; |
|
303 | + |
|
304 | + if (strpos($url, 'https://') === 0) { |
|
305 | + $normalized = substr($url, strlen('https://')); |
|
306 | + } elseif (strpos($url, 'http://') === 0) { |
|
307 | + $normalized = substr($url, strlen('http://')); |
|
308 | + } |
|
309 | + |
|
310 | + $normalized = Filesystem::normalizePath($normalized); |
|
311 | + $normalized = trim($normalized, '/'); |
|
312 | + |
|
313 | + return $normalized; |
|
314 | + } |
|
315 | + |
|
316 | + /** |
|
317 | + * @param $username |
|
318 | + * @param $password |
|
319 | + * @return bool |
|
320 | + */ |
|
321 | + public function auth($username, $password) { |
|
322 | + if ($username !== 'system') { |
|
323 | + return false; |
|
324 | + } |
|
325 | + $query = $this->connection->getQueryBuilder(); |
|
326 | + $query->select('url')->from($this->dbTable) |
|
327 | + ->where($query->expr()->eq('shared_secret', $query->createNamedParameter($password))); |
|
328 | + |
|
329 | + $statement = $query->execute(); |
|
330 | + $result = $statement->fetch(); |
|
331 | + $statement->closeCursor(); |
|
332 | + return !empty($result); |
|
333 | + } |
|
334 | 334 | } |
@@ -25,155 +25,155 @@ |
||
25 | 25 | use OCP\Files\Storage\IStorage; |
26 | 26 | |
27 | 27 | class NullStorage extends Common { |
28 | - public function __construct($parameters) { |
|
29 | - parent::__construct($parameters); |
|
30 | - } |
|
28 | + public function __construct($parameters) { |
|
29 | + parent::__construct($parameters); |
|
30 | + } |
|
31 | 31 | |
32 | - public function getId() { |
|
33 | - return 'null'; |
|
34 | - } |
|
32 | + public function getId() { |
|
33 | + return 'null'; |
|
34 | + } |
|
35 | 35 | |
36 | - public function mkdir($path) { |
|
37 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
38 | - } |
|
36 | + public function mkdir($path) { |
|
37 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
38 | + } |
|
39 | 39 | |
40 | - public function rmdir($path) { |
|
41 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
42 | - } |
|
40 | + public function rmdir($path) { |
|
41 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
42 | + } |
|
43 | 43 | |
44 | - public function opendir($path) { |
|
45 | - return new IteratorDirectory([]); |
|
46 | - } |
|
44 | + public function opendir($path) { |
|
45 | + return new IteratorDirectory([]); |
|
46 | + } |
|
47 | 47 | |
48 | - public function is_dir($path) { |
|
49 | - return $path === ''; |
|
50 | - } |
|
48 | + public function is_dir($path) { |
|
49 | + return $path === ''; |
|
50 | + } |
|
51 | 51 | |
52 | - public function is_file($path) { |
|
53 | - return false; |
|
54 | - } |
|
52 | + public function is_file($path) { |
|
53 | + return false; |
|
54 | + } |
|
55 | 55 | |
56 | - public function stat($path) { |
|
57 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
58 | - } |
|
56 | + public function stat($path) { |
|
57 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
58 | + } |
|
59 | 59 | |
60 | - public function filetype($path) { |
|
61 | - return ($path === '') ? 'dir' : false; |
|
62 | - } |
|
60 | + public function filetype($path) { |
|
61 | + return ($path === '') ? 'dir' : false; |
|
62 | + } |
|
63 | 63 | |
64 | - public function filesize($path) { |
|
65 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
66 | - } |
|
64 | + public function filesize($path) { |
|
65 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
66 | + } |
|
67 | 67 | |
68 | - public function isCreatable($path) { |
|
69 | - return false; |
|
70 | - } |
|
68 | + public function isCreatable($path) { |
|
69 | + return false; |
|
70 | + } |
|
71 | 71 | |
72 | - public function isReadable($path) { |
|
73 | - return $path === ''; |
|
74 | - } |
|
72 | + public function isReadable($path) { |
|
73 | + return $path === ''; |
|
74 | + } |
|
75 | 75 | |
76 | - public function isUpdatable($path) { |
|
77 | - return false; |
|
78 | - } |
|
76 | + public function isUpdatable($path) { |
|
77 | + return false; |
|
78 | + } |
|
79 | 79 | |
80 | - public function isDeletable($path) { |
|
81 | - return false; |
|
82 | - } |
|
80 | + public function isDeletable($path) { |
|
81 | + return false; |
|
82 | + } |
|
83 | 83 | |
84 | - public function isSharable($path) { |
|
85 | - return false; |
|
86 | - } |
|
84 | + public function isSharable($path) { |
|
85 | + return false; |
|
86 | + } |
|
87 | 87 | |
88 | - public function getPermissions($path) { |
|
89 | - return null; |
|
90 | - } |
|
88 | + public function getPermissions($path) { |
|
89 | + return null; |
|
90 | + } |
|
91 | 91 | |
92 | - public function file_exists($path) { |
|
93 | - return $path === ''; |
|
94 | - } |
|
92 | + public function file_exists($path) { |
|
93 | + return $path === ''; |
|
94 | + } |
|
95 | 95 | |
96 | - public function filemtime($path) { |
|
97 | - return ($path === '') ? time() : false; |
|
98 | - } |
|
96 | + public function filemtime($path) { |
|
97 | + return ($path === '') ? time() : false; |
|
98 | + } |
|
99 | 99 | |
100 | - public function file_get_contents($path) { |
|
101 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
102 | - } |
|
100 | + public function file_get_contents($path) { |
|
101 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
102 | + } |
|
103 | 103 | |
104 | - public function file_put_contents($path, $data) { |
|
105 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
106 | - } |
|
104 | + public function file_put_contents($path, $data) { |
|
105 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
106 | + } |
|
107 | 107 | |
108 | - public function unlink($path) { |
|
109 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
110 | - } |
|
108 | + public function unlink($path) { |
|
109 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
110 | + } |
|
111 | 111 | |
112 | - public function rename($path1, $path2) { |
|
113 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
114 | - } |
|
112 | + public function rename($path1, $path2) { |
|
113 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
114 | + } |
|
115 | 115 | |
116 | - public function copy($path1, $path2) { |
|
117 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
118 | - } |
|
116 | + public function copy($path1, $path2) { |
|
117 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
118 | + } |
|
119 | 119 | |
120 | - public function fopen($path, $mode) { |
|
121 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
122 | - } |
|
120 | + public function fopen($path, $mode) { |
|
121 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
122 | + } |
|
123 | 123 | |
124 | - public function getMimeType($path) { |
|
125 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
126 | - } |
|
124 | + public function getMimeType($path) { |
|
125 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
126 | + } |
|
127 | 127 | |
128 | - public function hash($type, $path, $raw = false) { |
|
129 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
130 | - } |
|
128 | + public function hash($type, $path, $raw = false) { |
|
129 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
130 | + } |
|
131 | 131 | |
132 | - public function free_space($path) { |
|
133 | - return FileInfo::SPACE_UNKNOWN; |
|
134 | - } |
|
132 | + public function free_space($path) { |
|
133 | + return FileInfo::SPACE_UNKNOWN; |
|
134 | + } |
|
135 | 135 | |
136 | - public function touch($path, $mtime = null) { |
|
137 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
138 | - } |
|
136 | + public function touch($path, $mtime = null) { |
|
137 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
138 | + } |
|
139 | 139 | |
140 | - public function getLocalFile($path) { |
|
141 | - return false; |
|
142 | - } |
|
140 | + public function getLocalFile($path) { |
|
141 | + return false; |
|
142 | + } |
|
143 | 143 | |
144 | - public function hasUpdated($path, $time) { |
|
145 | - return false; |
|
146 | - } |
|
144 | + public function hasUpdated($path, $time) { |
|
145 | + return false; |
|
146 | + } |
|
147 | 147 | |
148 | - public function getETag($path) { |
|
149 | - return ''; |
|
150 | - } |
|
148 | + public function getETag($path) { |
|
149 | + return ''; |
|
150 | + } |
|
151 | 151 | |
152 | - public function isLocal() { |
|
153 | - return false; |
|
154 | - } |
|
152 | + public function isLocal() { |
|
153 | + return false; |
|
154 | + } |
|
155 | 155 | |
156 | - public function getDirectDownload($path) { |
|
157 | - return false; |
|
158 | - } |
|
156 | + public function getDirectDownload($path) { |
|
157 | + return false; |
|
158 | + } |
|
159 | 159 | |
160 | - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { |
|
161 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
162 | - } |
|
160 | + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) { |
|
161 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
162 | + } |
|
163 | 163 | |
164 | - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { |
|
165 | - throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
166 | - } |
|
164 | + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { |
|
165 | + throw new \OC\ForbiddenException('This request is not allowed to access the filesystem'); |
|
166 | + } |
|
167 | 167 | |
168 | - public function test() { |
|
169 | - return true; |
|
170 | - } |
|
168 | + public function test() { |
|
169 | + return true; |
|
170 | + } |
|
171 | 171 | |
172 | - public function getOwner($path) { |
|
173 | - return null; |
|
174 | - } |
|
172 | + public function getOwner($path) { |
|
173 | + return null; |
|
174 | + } |
|
175 | 175 | |
176 | - public function getCache($path = '', $storage = null) { |
|
177 | - return new NullCache(); |
|
178 | - } |
|
176 | + public function getCache($path = '', $storage = null) { |
|
177 | + return new NullCache(); |
|
178 | + } |
|
179 | 179 | } |