1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AnyCloud\Form; |
4
|
|
|
|
5
|
|
|
use Zend\Form\Form; |
|
|
|
|
6
|
|
|
use Zend\Form\Element; |
|
|
|
|
7
|
|
|
use Zend\Form\Fieldset; |
|
|
|
|
8
|
|
|
|
9
|
|
|
class ConfigForm extends Form |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* Initialize the configuration form |
13
|
|
|
*/ |
14
|
|
|
public function init() |
15
|
|
|
{ |
16
|
|
|
$this->addAdapter(); |
17
|
|
|
$this->addAws(); |
18
|
|
|
$this->addAzure(); |
19
|
|
|
$this->addGoogle(); |
20
|
|
|
$this->addDigitalOcean(); |
21
|
|
|
$this->addScaleway(); |
22
|
|
|
$this->addRackspace(); |
23
|
|
|
$this->addDropbox(); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Add adapter drop-down options to configuration form |
28
|
|
|
*/ |
29
|
|
|
private function addAdapter() |
30
|
|
|
{ |
31
|
|
|
$this->add([ |
32
|
|
|
'name' => 'anycloud_adapter', |
33
|
|
|
'type' => Fieldset::class, |
34
|
|
|
'options' => [ |
35
|
|
|
'label' => 'Any Cloud Adapter', |
36
|
|
|
], |
37
|
|
|
'attributes' => [ |
38
|
|
|
'id' => 'adapter-fieldset', |
39
|
|
|
], |
40
|
|
|
]); |
41
|
|
|
$adapterFieldset = $this->get('anycloud_adapter'); |
42
|
|
|
$adapterFieldset->add([ |
43
|
|
|
'name' => 'adapter', |
44
|
|
|
'type' => Element\Select::class, |
|
|
|
|
45
|
|
|
'options' => [ |
46
|
|
|
'label' => 'Cloud Service Adapter: ', |
47
|
|
|
'value_options' => [ |
48
|
|
|
'default' => 'Omeka Default (local server)', |
49
|
|
|
'aws' => 'Amazon S3 Storage', |
50
|
|
|
'azure' => 'Microsoft Azure Storage', |
51
|
|
|
'google' => 'Google Cloud Storage', |
52
|
|
|
'digital_ocean' => 'DigitalOcean Spaces', |
53
|
|
|
'scaleway' => 'Scaleway Object Storage', |
54
|
|
|
'rackspace' => 'Rackspace Files', |
55
|
|
|
'dropbox' => 'Dropbox', |
56
|
|
|
], |
57
|
|
|
], |
58
|
|
|
'attributes' => [ |
59
|
|
|
'id' => 'adapter', |
60
|
|
|
], |
61
|
|
|
]); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Add Amazon S3 Storage options to configuration form |
66
|
|
|
*/ |
67
|
|
|
private function addAws() |
68
|
|
|
{ |
69
|
|
|
$this->add([ |
70
|
|
|
'name' => 'anycloud_aws', |
71
|
|
|
'type' => Fieldset::class, |
72
|
|
|
'options' => [ |
73
|
|
|
'label' => 'AmazonS3 Storage', |
74
|
|
|
], |
75
|
|
|
'attributes' => [ |
76
|
|
|
'class' => 'aws fieldset', |
77
|
|
|
], |
78
|
|
|
]); |
79
|
|
|
$awsFieldset = $this->get('anycloud_aws'); |
80
|
|
|
$awsFieldset->add([ |
81
|
|
|
'name' => 'aws_key', |
82
|
|
|
'type' => Element\Text::class, |
|
|
|
|
83
|
|
|
'options' => [ |
84
|
|
|
'label' => 'AWS Key', |
85
|
|
|
], |
86
|
|
|
'attributes' => [ |
87
|
|
|
'id' => 'aws_key', |
88
|
|
|
], |
89
|
|
|
]); |
90
|
|
|
$awsFieldset->add([ |
91
|
|
|
'name' => 'aws_secret_key', |
92
|
|
|
'type' => Element\Text::class, |
93
|
|
|
'options' => [ |
94
|
|
|
'label' => 'AWS Secret Key', |
95
|
|
|
], |
96
|
|
|
'attributes' => [ |
97
|
|
|
'id' => 'aws_secret_key', |
98
|
|
|
'cols' => '100', |
99
|
|
|
], |
100
|
|
|
]); |
101
|
|
|
$awsFieldset->add([ |
102
|
|
|
'name' => 'aws_bucket', |
103
|
|
|
'type' => Element\Text::class, |
104
|
|
|
'options' => [ |
105
|
|
|
'label' => 'AWS Bucket', |
106
|
|
|
], |
107
|
|
|
'attributes' => [ |
108
|
|
|
'id' => 'aws_bucket', |
109
|
|
|
], |
110
|
|
|
]); |
111
|
|
|
$awsFieldset->add([ |
112
|
|
|
'name' => 'aws_region', |
113
|
|
|
'type' => Element\Text::class, |
114
|
|
|
'options' => [ |
115
|
|
|
'label' => 'AWS Region', |
116
|
|
|
], |
117
|
|
|
'attributes' => [ |
118
|
|
|
'id' => 'aws_region', |
119
|
|
|
], |
120
|
|
|
]); |
121
|
|
|
$awsFieldset->add([ |
122
|
|
|
'name' => 'aws_endpoint', |
123
|
|
|
'type' => Element\Text::class, |
124
|
|
|
'options' => [ |
125
|
|
|
'label' => 'AWS Endpoint', |
126
|
|
|
'info' => 'Can usually leave blank unless you have a custom endpoint set up. See https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region', |
127
|
|
|
], |
128
|
|
|
'attributes' => [ |
129
|
|
|
'id' => 'aws_endpoint', |
130
|
|
|
], |
131
|
|
|
]); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Add Microsoft Azure Storage options to configuration form |
136
|
|
|
*/ |
137
|
|
|
private function addAzure() |
138
|
|
|
{ |
139
|
|
|
$this->add([ |
140
|
|
|
'name' => 'anycloud_azure', |
141
|
|
|
'type' => Fieldset::class, |
142
|
|
|
'options' => [ |
143
|
|
|
'label' => 'Microsoft Azure Storage', |
144
|
|
|
], |
145
|
|
|
'attributes' => [ |
146
|
|
|
'class' => 'azure fieldset', |
147
|
|
|
], |
148
|
|
|
]); |
149
|
|
|
$azureFieldset = $this->get('anycloud_azure'); |
150
|
|
|
$azureFieldset->add([ |
151
|
|
|
'name' => 'azure_account_name', |
152
|
|
|
'type' => Element\Text::class, |
153
|
|
|
'options' => [ |
154
|
|
|
'label' => 'Azure Account Name', |
155
|
|
|
], |
156
|
|
|
'attributes' => [ |
157
|
|
|
'id' => 'azure_account_name', |
158
|
|
|
], |
159
|
|
|
]); |
160
|
|
|
$azureFieldset->add([ |
161
|
|
|
'name' => 'azure_account_key', |
162
|
|
|
'type' => Element\Text::class, |
163
|
|
|
'options' => [ |
164
|
|
|
'label' => 'Azure Account Key', |
165
|
|
|
], |
166
|
|
|
'attributes' => [ |
167
|
|
|
'id' => 'azure_account_key', |
168
|
|
|
], |
169
|
|
|
]); |
170
|
|
|
$azureFieldset->add([ |
171
|
|
|
'name' => 'azure_container_name', |
172
|
|
|
'type' => Element\Text::class, |
173
|
|
|
'options' => [ |
174
|
|
|
'label' => 'Azure Container Name', |
175
|
|
|
], |
176
|
|
|
'attributes' => [ |
177
|
|
|
'id' => 'azure_container_name', |
178
|
|
|
], |
179
|
|
|
]); |
180
|
|
|
$azureFieldset->add([ |
181
|
|
|
'name' => 'azure_endpoint', |
182
|
|
|
'type' => Element\Text::class, |
183
|
|
|
'options' => [ |
184
|
|
|
'label' => 'Azure Endpoint', |
185
|
|
|
'info' => 'Can usually leave blank unless you have a custom endpoint set up', |
186
|
|
|
], |
187
|
|
|
'attributes' => [ |
188
|
|
|
'id' => 'azure_endpoint', |
189
|
|
|
], |
190
|
|
|
]); |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* Add Google Cloud Storage options to configuration form |
195
|
|
|
*/ |
196
|
|
|
private function addGoogle() |
197
|
|
|
{ |
198
|
|
|
$this->add([ |
199
|
|
|
'name' => 'anycloud_google', |
200
|
|
|
'type' => Fieldset::class, |
201
|
|
|
'options' => [ |
202
|
|
|
'label' => 'Google Cloud Storage', |
203
|
|
|
], |
204
|
|
|
'attributes' => [ |
205
|
|
|
'class' => 'google fieldset', |
206
|
|
|
], |
207
|
|
|
]); |
208
|
|
|
$googleFieldset = $this->get('anycloud_google'); |
209
|
|
|
$googleFieldset->add([ |
210
|
|
|
'name' => 'google_project_id', |
211
|
|
|
'type' => Element\Text::class, |
212
|
|
|
'options' => [ |
213
|
|
|
'label' => 'Google Project ID', |
214
|
|
|
], |
215
|
|
|
'attributes' => [ |
216
|
|
|
'id' => 'google_project_id', |
217
|
|
|
], |
218
|
|
|
]); |
219
|
|
|
$googleFieldset->add([ |
220
|
|
|
'name' => 'google_bucket_name', |
221
|
|
|
'type' => Element\Text::class, |
222
|
|
|
'options' => [ |
223
|
|
|
'label' => 'Google Bucket Name', |
224
|
|
|
], |
225
|
|
|
'attributes' => [ |
226
|
|
|
'id' => 'google_bucket_name', |
227
|
|
|
], |
228
|
|
|
]); |
229
|
|
|
$googleFieldset->add([ |
230
|
|
|
'name' => 'google_credentials_path', |
231
|
|
|
'type' => Element\Text::class, |
232
|
|
|
'options' => [ |
233
|
|
|
'label' => 'Google Credentials Path', |
234
|
|
|
'info' => 'Replace {CONFIG} with the name of your Google credentials file stored at the listed path', |
235
|
|
|
'value' => '/src/Service/File/Adapter/Google/{CONFIG}.json', |
236
|
|
|
], |
237
|
|
|
'attributes' => [ |
238
|
|
|
'id' => 'google_credentials_path', |
239
|
|
|
], |
240
|
|
|
]); |
241
|
|
|
$googleFieldset->add([ |
242
|
|
|
'name' => 'google_storage_uri', |
243
|
|
|
'type' => Element\Text::class, |
244
|
|
|
'options' => [ |
245
|
|
|
'label' => 'Google Storage URI', |
246
|
|
|
'info' => 'You can usually leave this as the default unless you have tweaked other settings', |
247
|
|
|
'value' => 'https://storage.googleapis.com', |
248
|
|
|
], |
249
|
|
|
'attributes' => [ |
250
|
|
|
'id' => 'google_storage_uri', |
251
|
|
|
], |
252
|
|
|
]); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* Add DigitalOcean Spaces options to configuration form |
257
|
|
|
*/ |
258
|
|
|
private function addDigitalOcean() |
259
|
|
|
{ |
260
|
|
|
$this->add([ |
261
|
|
|
'name' => 'anycloud_digital_ocean', |
262
|
|
|
'type' => Fieldset::class, |
263
|
|
|
'options' => [ |
264
|
|
|
'label' => 'DigitalOcean Spaces', |
265
|
|
|
], |
266
|
|
|
'attributes' => [ |
267
|
|
|
'class' => 'digital_ocean fieldset', |
268
|
|
|
], |
269
|
|
|
]); |
270
|
|
|
$digitaloceanFieldset = $this->get('anycloud_digital_ocean'); |
271
|
|
|
$digitaloceanFieldset->add([ |
272
|
|
|
'name' => 'digital_ocean_key', |
273
|
|
|
'type' => Element\Text::class, |
274
|
|
|
'options' => [ |
275
|
|
|
'label' => 'DigitalOcean AWS Key', |
276
|
|
|
], |
277
|
|
|
'attributes' => [ |
278
|
|
|
'id' => 'digital_ocean_key', |
279
|
|
|
], |
280
|
|
|
]); |
281
|
|
|
$digitaloceanFieldset->add([ |
282
|
|
|
'name' => 'digital_ocean_secret_key', |
283
|
|
|
'type' => Element\Text::class, |
284
|
|
|
'options' => [ |
285
|
|
|
'label' => 'DigitalOcean AWS Secret Key', |
286
|
|
|
], |
287
|
|
|
'attributes' => [ |
288
|
|
|
'id' => 'digital_ocean_secret_key', |
289
|
|
|
], |
290
|
|
|
]); |
291
|
|
|
$digitaloceanFieldset->add([ |
292
|
|
|
'name' => 'digital_ocean_bucket', |
293
|
|
|
'type' => Element\Text::class, |
294
|
|
|
'options' => [ |
295
|
|
|
'label' => 'DigitalOcean AWS Bucket', |
296
|
|
|
], |
297
|
|
|
'attributes' => [ |
298
|
|
|
'id' => 'digital_ocean_bucket', |
299
|
|
|
], |
300
|
|
|
]); |
301
|
|
|
$digitaloceanFieldset->add([ |
302
|
|
|
'name' => 'digital_ocean_region', |
303
|
|
|
'type' => Element\Text::class, |
304
|
|
|
'options' => [ |
305
|
|
|
'label' => 'DigitalOcean AWS Region', |
306
|
|
|
], |
307
|
|
|
'attributes' => [ |
308
|
|
|
'id' => 'digital_ocean_region', |
309
|
|
|
], |
310
|
|
|
]); |
311
|
|
|
$digitaloceanFieldset->add([ |
312
|
|
|
'name' => 'digital_ocean_endpoint', |
313
|
|
|
'type' => Element\Text::class, |
314
|
|
|
'options' => [ |
315
|
|
|
'label' => 'DigitalOcean AWS Endpoint', |
316
|
|
|
], |
317
|
|
|
'attributes' => [ |
318
|
|
|
'id' => 'digital_ocean_endpoint', |
319
|
|
|
], |
320
|
|
|
]); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Add Scaleway Object Storage options to configuration form |
325
|
|
|
*/ |
326
|
|
|
private function addScaleway() |
327
|
|
|
{ |
328
|
|
|
$this->add([ |
329
|
|
|
'name' => 'anycloud_scaleway', |
330
|
|
|
'type' => Fieldset::class, |
331
|
|
|
'options' => [ |
332
|
|
|
'label' => 'Scaleway Object Storage', |
333
|
|
|
], |
334
|
|
|
'attributes' => [ |
335
|
|
|
'class' => 'scaleway fieldset', |
336
|
|
|
], |
337
|
|
|
]); |
338
|
|
|
$scalewayFieldset = $this->get('anycloud_scaleway'); |
339
|
|
|
$scalewayFieldset->add([ |
340
|
|
|
'name' => 'scaleway_key', |
341
|
|
|
'type' => Element\Text::class, |
342
|
|
|
'options' => [ |
343
|
|
|
'label' => 'Scaleway AWS Key', |
344
|
|
|
], |
345
|
|
|
'attributes' => [ |
346
|
|
|
'id' => 'scaleway_key', |
347
|
|
|
], |
348
|
|
|
]); |
349
|
|
|
$scalewayFieldset->add([ |
350
|
|
|
'name' => 'scaleway_secret_key', |
351
|
|
|
'type' => Element\Text::class, |
352
|
|
|
'options' => [ |
353
|
|
|
'label' => 'Scaleway AWS Secret Key', |
354
|
|
|
], |
355
|
|
|
'attributes' => [ |
356
|
|
|
'id' => 'scaleway_secret_key', |
357
|
|
|
], |
358
|
|
|
]); |
359
|
|
|
$scalewayFieldset->add([ |
360
|
|
|
'name' => 'scaleway_bucket', |
361
|
|
|
'type' => Element\Text::class, |
362
|
|
|
'options' => [ |
363
|
|
|
'label' => 'Scaleway AWS Bucket', |
364
|
|
|
], |
365
|
|
|
'attributes' => [ |
366
|
|
|
'id' => 'scaleway_bucket', |
367
|
|
|
], |
368
|
|
|
]); |
369
|
|
|
$scalewayFieldset->add([ |
370
|
|
|
'name' => 'scaleway_region', |
371
|
|
|
'type' => Element\Text::class, |
372
|
|
|
'options' => [ |
373
|
|
|
'label' => 'Scaleway AWS Region', |
374
|
|
|
], |
375
|
|
|
'attributes' => [ |
376
|
|
|
'id' => 'scaleway_region', |
377
|
|
|
], |
378
|
|
|
]); |
379
|
|
|
$scalewayFieldset->add([ |
380
|
|
|
'name' => 'scaleway_endpoint', |
381
|
|
|
'type' => Element\Text::class, |
382
|
|
|
'options' => [ |
383
|
|
|
'label' => 'Scaleway AWS Endpoint', |
384
|
|
|
], |
385
|
|
|
'attributes' => [ |
386
|
|
|
'id' => 'scaleway_endpoint', |
387
|
|
|
], |
388
|
|
|
]); |
389
|
|
|
} |
390
|
|
|
|
391
|
|
|
/** |
392
|
|
|
* Add Rackspace Files options to configuration form |
393
|
|
|
*/ |
394
|
|
|
private function addRackspace() |
395
|
|
|
{ |
396
|
|
|
$this->add([ |
397
|
|
|
'name' => 'anycloud_rackspace', |
398
|
|
|
'type' => Fieldset::class, |
399
|
|
|
'options' => [ |
400
|
|
|
'label' => 'Rackspace Files', |
401
|
|
|
], |
402
|
|
|
'attributes' => [ |
403
|
|
|
'class' => 'rackspace fieldset', |
404
|
|
|
], |
405
|
|
|
]); |
406
|
|
|
$rackspaceFieldset = $this->get('anycloud_rackspace'); |
407
|
|
|
$rackspaceFieldset->add([ |
408
|
|
|
'name' => 'rackspace_identity_endpoint', |
409
|
|
|
'type' => Element\Text::class, |
410
|
|
|
'options' => [ |
411
|
|
|
'label' => 'Rackspace Identity Endpoint', |
412
|
|
|
'info' => 'Valid options include “US_IDENTITY_ENDPOINT” and “UK_IDENTITY_ENDPOINT”', |
413
|
|
|
], |
414
|
|
|
'attributes' => [ |
415
|
|
|
'id' => 'rackspace_identity_endpoint', |
416
|
|
|
], |
417
|
|
|
]); |
418
|
|
|
$rackspaceFieldset->add([ |
419
|
|
|
'name' => 'rackspace_username', |
420
|
|
|
'type' => Element\Text::class, |
421
|
|
|
'options' => [ |
422
|
|
|
'label' => 'Rackspace Username', |
423
|
|
|
], |
424
|
|
|
'attributes' => [ |
425
|
|
|
'id' => 'rackspace_username', |
426
|
|
|
], |
427
|
|
|
]); |
428
|
|
|
$rackspaceFieldset->add([ |
429
|
|
|
'name' => 'rackspace_password', |
430
|
|
|
'type' => Element\Text::class, |
431
|
|
|
'options' => [ |
432
|
|
|
'label' => 'Rackspace Password', |
433
|
|
|
], |
434
|
|
|
'attributes' => [ |
435
|
|
|
'id' => 'rackspace_password', |
436
|
|
|
], |
437
|
|
|
]); |
438
|
|
|
$rackspaceFieldset->add([ |
439
|
|
|
'name' => 'rackspace_container', |
440
|
|
|
'type' => Element\Text::class, |
441
|
|
|
'options' => [ |
442
|
|
|
'label' => 'Rackspace Container Name', |
443
|
|
|
], |
444
|
|
|
'attributes' => [ |
445
|
|
|
'id' => 'rackspace_container', |
446
|
|
|
], |
447
|
|
|
]); |
448
|
|
|
$rackspaceFieldset->add([ |
449
|
|
|
'name' => 'rackspace_region', |
450
|
|
|
'type' => Element\Text::class, |
451
|
|
|
'options' => [ |
452
|
|
|
'label' => 'Rackspace Region', |
453
|
|
|
], |
454
|
|
|
'attributes' => [ |
455
|
|
|
'id' => 'rackspace_region', |
456
|
|
|
], |
457
|
|
|
]); |
458
|
|
|
} |
459
|
|
|
|
460
|
|
|
/** |
461
|
|
|
* Add Dropbox options to configuration form |
462
|
|
|
*/ |
463
|
|
|
private function addDropbox() |
464
|
|
|
{ |
465
|
|
|
$this->add([ |
466
|
|
|
'name' => 'anycloud_dropbox', |
467
|
|
|
'type' => Fieldset::class, |
468
|
|
|
'options' => [ |
469
|
|
|
'label' => 'Dropbox', |
470
|
|
|
], |
471
|
|
|
'attributes' => [ |
472
|
|
|
'class' => 'dropbox fieldset', |
473
|
|
|
], |
474
|
|
|
]); |
475
|
|
|
$dropboxFieldset = $this->get('anycloud_dropbox'); |
476
|
|
|
$dropboxFieldset->add([ |
477
|
|
|
'name' => 'dropbox_access_token', |
478
|
|
|
'type' => Element\Text::class, |
479
|
|
|
'options' => [ |
480
|
|
|
'label' => 'Dropbox Access Token', |
481
|
|
|
], |
482
|
|
|
'attributes' => [ |
483
|
|
|
'id' => 'dropbox_access_token', |
484
|
|
|
], |
485
|
|
|
]); |
486
|
|
|
} |
487
|
|
|
} |
488
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths