-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstaller.php
792 lines (712 loc) · 23.5 KB
/
Installer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
<?php
namespace Xanweb\Module;
use Concrete\Core\Application\Application;
use Concrete\Core\Attribute\Category\CategoryInterface as AttributeCategoryInterface;
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\SetFactory;
use Concrete\Core\Attribute\TypeFactory;
use Concrete\Core\Block\BlockType\BlockType;
use Concrete\Core\Block\BlockType\Set as BlockTypeSet;
use Concrete\Core\Entity\Attribute\Category as AttributeCategoryEntity;
use Concrete\Core\Entity\Attribute\Key\Key as AttributeKeyEntity;
use Concrete\Core\Entity\Attribute\Set as AttributeSetEntity;
use Concrete\Core\Entity\Attribute\Type as AttributeTypeEntity;
use Concrete\Core\Entity\Automation\Task;
use Concrete\Core\Entity\Package as PackageEntity;
use Concrete\Core\Entity\Page\Template;
use Concrete\Core\Error\ErrorList\ErrorList;
use Concrete\Core\Job\Job;
use Concrete\Core\Package\Package;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\Single as SinglePage;
use Concrete\Core\Page\Template as PageTemplate;
use Concrete\Core\Page\Type\Type as PageType;
use Concrete\Core\Support\Facade\Application as FacadeApp;
use Doctrine\ORM\EntityManager;
class Installer
{
protected Application $app;
protected PackageEntity $pkg;
/**
* Installer constructor.
*
* @param Package|PackageEntity $pkg
*/
public function __construct($pkg)
{
$this->pkg = ($pkg instanceof Package) ? $pkg->getPackageEntity() : $pkg;
$this->app = FacadeApp::getFacadeApplication();
}
/**
* Install page templates.
*
* @param array ...$templates list of page templates
* Example:
* <pre>
* ['templateHandle', 'templateName', 'templateIcon', isInternal],
* </pre>
*/
public function installPageTemplates(array ...$templates): void
{
foreach ($templates as $template) {
$this->installPageTemplate(
$template[0],
$template[1],
$template[2] ?? FILENAME_PAGE_TEMPLATE_DEFAULT_ICON,
$template[3] ?? false,
);
}
}
/**
* install Page Template if not Exist.
*
* @param string $pTemplateHandle
* @param string $pTemplateName
* @param string $pTemplateIcon
* @param bool $pTemplateIsInternal
* @return Template|null
*/
public function installPageTemplate(string $pTemplateHandle, string $pTemplateName, string $pTemplateIcon = FILENAME_PAGE_TEMPLATE_DEFAULT_ICON, bool $pTemplateIsInternal = false): ?Template
{
if (!is_object($template = PageTemplate::getByHandle($pTemplateHandle))) {
$template = PageTemplate::add($pTemplateHandle, $pTemplateName, $pTemplateIcon, $this->pkg, $pTemplateIsInternal);
}
return $template;
}
/**
* Install page types.
*
* @param array ...$pageTypes list of page templates
* Example:
* <pre>
* ['pTemplateHandle', 'pTypeHandle', 'pTypeName'],
* </pre>
*/
public function installPageTypes(array ...$pageTypes): void
{
foreach ($pageTypes as $pageType) {
$this->installPageType(...$pageType);
}
}
/**
* Install Page Type if not Exist.
*
* @param string $pTemplateHandle
* @param string $pTypeHandle
* @param string $pTypeName
* @return PageType|null
*/
public function installPageType(string $pTemplateHandle, string $pTypeHandle, string $pTypeName): ?PageType
{
if (!is_object($type = PageType::getByHandle($pTypeHandle))) {
$pTPL = PageTemplate::getByHandle($pTemplateHandle);
if (!is_object($pTPL)) {
throw new \RuntimeException(t('Page Template with handle `%s` not found.', $pTemplateHandle));
}
$type = PageType::add([
'handle' => $pTypeHandle,
'name' => $pTypeName,
'defaultTemplate' => $pTPL,
'ptIsFrequentlyAdded' => 1,
'ptLaunchInComposer' => 1,
], $this->pkg);
}
return $type;
}
/**
* Install single pages.
*
* @param array<string, string, array> ...$paths list of paths and names
* Example:
* <pre>
* ['pagePath', 'pageName', optionalArrayOfAttributeKeysAndValues],
* </pre>
*/
public function installSinglePages(array ...$paths): void
{
foreach ($paths as $path) {
$this->installSinglePage(...$path);
}
}
/**
* Install Single Page if not exists.
*
* @param string $path
* @param string $name
* @param array $options
*
* @return Page return installed single page
*/
public function installSinglePage(string $path, string $name, array $options = []): Page
{
$sp = Page::getByPath($path);
if (!is_object($sp) || COLLECTION_NOT_FOUND === $sp->getError()) {
$sp = SinglePage::add($path, $this->pkg);
$sp->update(['cName' => $name]);
foreach ($options as $key => $value) {
$sp->setAttribute($key, $value);
}
}
return $sp;
}
/**
* Install BlockType Sets.
*
* @param array<string, string> ...$sets array of handles and names
* Example:
* <pre>
* ['btSetHandle', 'btSetName'], ['btSetHandle', 'btSetName'],
* </pre>
*/
public function installBlockTypeSets(array ...$sets): void
{
foreach ($sets as $set) {
$this->installBlockTypeSet($set[0], $set[1]);
}
}
/**
* Install BlockTypeSet if Exists.
*
* @param string $handle
* @param string $name
*
* @return BlockTypeSet return installed BlockTypeSet
*/
public function installBlockTypeSet(string $handle, string $name): BlockTypeSet
{
if (!is_object($bts = BlockTypeSet::getByHandle($handle))) {
$bts = BlockTypeSet::add($handle, $name, $this->pkg);
}
return $bts;
}
/**
* Install Jobs
*
* @param string ...$handles
*
* @return Job[] return installed Jobs
*/
public function installJobs(string ...$handles): array
{
$jobs = [];
foreach ($handles as $handle) {
$jobs[] = $this->installJob($handle);
}
return $jobs;
}
/**
* Install Job if it doesn't exist.
*
* @param string $handle
*
* @return Job return installed Job
*/
public function installJob(string $handle): Job
{
if (!is_object($job = Job::getByHandle($handle))) {
$job = Job::installByPackage($handle, $this->pkg);
}
return $job;
}
/**
* Install BlockTypes.
*
* @param mixed ...$handles list of handles.
* Example:
* <code>
* 'btHandle1', ['btHandle2', 'btSetObj'], 'btHandle3',
* </code>
*/
public function installBlockTypes(...$handles): void
{
foreach ($handles as $handle) {
$blockTypeSet = null;
$btHandle = $handle;
if (is_array($handle)) {
$btHandle = $handle[0];
$blockTypeSet = $handle[1] ?? null;
}
$this->installBlockType($btHandle, $blockTypeSet);
}
}
/**
* Install BlockType if Exists.
*
* @param string $handle
* @param BlockTypeSet|string $bts Block Type Set object or handle
*
* @return \Concrete\Core\Entity\Block\BlockType\BlockType return installed BlockType
*/
public function installBlockType(string $handle, $bts = null): \Concrete\Core\Entity\Block\BlockType\BlockType
{
if (!is_object($bt = BlockType::getByHandle($handle))) {
$bt = BlockType::installBlockType($handle, $this->pkg);
if (is_string($bts)) {
$bts = BlockTypeSet::getByHandle($bts);
}
if ($bts instanceof BlockTypeSet) {
$bts->addBlockType($bt);
}
}
return $bt;
}
/**
* Install AttributeKeyCategory.
*
* @param string $handle The handle string for the category
* @param int $allowSets This should be an attribute AttributeKeyCategory::ASET_ALLOW_* constant
* @param array $associatedAttrTypes array of attribute type handles to be associated with
*
* @return AttributeCategoryInterface
*/
public function installAttributeKeyCategory(string $handle, int $allowSets = 0, array $associatedAttrTypes = []): AttributeCategoryInterface
{
$akCategSvc = $this->app->make(CategoryService::class);
$akCateg = $akCategSvc->getByHandle($handle);
if (!is_object($akCateg)) {
$akCateg = $akCategSvc->add($handle, $allowSets, $this->pkg);
} else {
$akCateg = $akCateg->getController();
}
$atFactory = $this->app->make(TypeFactory::class);
foreach ($associatedAttrTypes as $atHandle) {
$akCateg->associateAttributeKeyType($atFactory->getByHandle($atHandle));
}
return $akCateg;
}
/**
* Install AttributeTypes.
*
* @param array<string, string, AttributeCategoryEntity> ...$handles list of handles and names
*/
public function installAttributeTypes(array ...$handles): void
{
foreach ($handles as $handle) {
$this->installAttributeType($handle[0], $handle[1], $handle[2] ?? null);
}
}
/**
* Install AttributeType if Exists.
*
* @param string $handle
* @param string $name
* @param AttributeCategoryEntity|null $akc
*
* @return AttributeTypeEntity return installed attribute type
*/
public function installAttributeType(string $handle, string $name, ?AttributeCategoryEntity $akc = null): AttributeTypeEntity
{
$atFactory = $this->app->make(TypeFactory::class);
$at = $atFactory->getByHandle($handle);
if (!is_object($at)) {
$at = $atFactory->add($handle, $name, $this->pkg);
if ($akc !== null) {
$akc->getController()->associateAttributeKeyType($at);
}
}
return $at;
}
/**
* Install SiteAttributeKeys.
* Example of $data:
* <pre>
* [
* 'at_type_handle' => [
* ['akHandle' => 'ak_handle', 'akName' => 'AttributeKey Name']
* ]
* ]
* </pre>.
*
* @param array $data array of handles and names
*
* @return AttributeKeyEntity[] return installed AttrKeys
*/
public function installSiteAttributeKeys(array $data): array
{
return $this->installAttributeKeys('site', $data);
}
/**
* Install PageAttributeKeys.
* Example of $data:
* <pre>
* [
* 'at_type_handle' => [
* ['akHandle' => 'ak_handle', 'akName' => 'AttributeKey Name']
* ]
* ]
* </pre>.
*
* @param array $data array of handles and names
*
* @return AttributeKeyEntity[] return installed AttrKeys
*/
public function installPageAttributeKeys(array $data): array
{
return $this->installAttributeKeys('collection', $data);
}
/**
* Install UserAttributeKeys.
* Example of $data:
* <pre>
* [
* 'at_type_handle' => [
* ['akHandle' => 'ak_handle', 'akName' => 'AttributeKey Name']
* ]
* ]
* </pre>.
*
* @param array $data array of handles and names
*
* @return AttributeKeyEntity[] return installed AttrKeys
*/
public function installUserAttributeKeys(array $data): array
{
return $this->installAttributeKeys('user', $data);
}
/**
* Install FileAttributeKeys.
* Example of $data:
* <pre>
* [
* 'at_type_handle' => [
* ['akHandle' => 'ak_handle', 'akName' => 'AttributeKey Name']
* ]
* ]
* </pre>.
*
* @param array $data array of handles and names
*
* @return AttributeKeyEntity[] return installed AttrKeys
*/
public function installFileAttributeKeys(array $data): array
{
return $this->installAttributeKeys('file', $data);
}
/**
* Install AttributeKeys.
*
* @param AttributeCategoryEntity|string $akCateg AttributeKeyCategory object or handle
* @param array $data array of handles and names
*
* @return AttributeKeyEntity[] return installed AttrKeys
*/
public function installAttributeKeys($akCateg, array $data): array
{
if (is_string($akCateg)) {
$akCateg = $this->app->make(CategoryService::class)->getByHandle($akCateg);
}
$installedAks = [];
$atFactory = $this->app->make(TypeFactory::class);
foreach ($data as $atHandle => $attrs) {
$at = $atFactory->getByHandle($atHandle);
foreach ($attrs as $params) {
$ak = $this->installAttributeKey($akCateg, $at, $params);
if (is_object($ak)) {
$installedAks[$ak->getAttributeKeyHandle()] = $ak;
}
}
}
return $installedAks;
}
/**
* Install AttributeKey if not Exists.
*
* @param AttributeCategoryEntity|string $akCateg AttributeKeyCategory object or handle
* @param AttributeTypeEntity|string $type
* @param array{akHandle: string, akName: string, settings: array} $data
*
* @return AttributeKeyEntity return installed attribute key
*/
public function installAttributeKey($akCateg, $type, array $data): AttributeKeyEntity
{
if (is_string($akCateg)) {
$akCateg = $this->app->make(CategoryService::class)->getByHandle($akCateg);
}
if (is_string($type)) {
$type = $this->app->make(TypeFactory::class)->getByHandle($type);
}
$akCategController = $akCateg->getController();
$cak = $akCategController->getAttributeKeyByHandle($data['akHandle']);
if (!is_object($cak)) {
$key = $akCategController->createAttributeKey();
$key->setAttributeKeyHandle($data['akHandle']);
$key->setAttributeKeyName($data['akName']);
$akSettings = null;
if (isset($data['settings'])) {
if (isset($data['settings']['akIsSearchableIndexed'])) {
$key->setIsAttributeKeyContentIndexed((bool) $data['settings']['akIsSearchableIndexed']);
}
if (isset($data['settings']['akIsSearchable'])) {
$key->setIsAttributeKeySearchable((bool) $data['settings']['akIsSearchable']);
}
$akSettings = $type->getController()->saveKey($data['settings']);
}
return $akCategController->add($type, $key, $akSettings, $this->pkg);
}
return $cak;
}
/**
* Install SiteAttributeSets.
*
* @param array $data array of handles and names
*
* @return AttributeSetEntity[]
*/
public function installSiteAttributeSets(array $data): array
{
return $this->installAttributeSets('site', $data);
}
/**
* Install PageAttributeSets.
*
* @param array $data array of handles and names
*
* @return AttributeSetEntity[]
*/
public function installPageAttributeSets(array $data): array
{
return $this->installAttributeSets('collection', $data);
}
/**
* Install UserAttributeSets.
*
* @param array $data array of handles and names
*
* @return AttributeSetEntity[]
*/
public function installUserAttributeSets(array $data): array
{
return $this->installAttributeSets('user', $data);
}
/**
* Install FileAttributeSets.
*
* @param array $data array of handles and names
*
* @return AttributeSetEntity[]
*/
public function installFileAttributeSets(array $data): array
{
return $this->installAttributeSets('file', $data);
}
/**
* Install AttributeSets.
*
* @param AttributeCategoryEntity|string $akCateg AttributeKeyCategory object or handle
* @param array $data array of handles and names
*
* @return AttributeSetEntity[]
*/
public function installAttributeSets($akCateg, array $data): array
{
if (is_string($akCateg)) {
$akCateg = $this->app->make(CategoryService::class)->getByHandle($akCateg);
}
$installedAttrSets = [];
foreach ($data as $params) {
$atSet = $this->installAttributeSet($akCateg, $params[0], $params[1], $params[2] ?? []);
if (is_object($atSet)) {
$installedAttrSets[$atSet->getAttributeSetHandle()] = $atSet;
}
}
return $installedAttrSets;
}
/**
* @param string $handle
* @param string $name
* @param array $associatedAttrs
*
* @return AttributeSetEntity
*/
public function installPageAttributeSet(string $handle, string $name, array $associatedAttrs = []): AttributeSetEntity
{
return $this->installAttributeSet('collection', $handle, $name, $associatedAttrs);
}
/**
* @param AttributeCategoryEntity|string $akCateg
* @param string $handle
* @param string $name
* @param array $associatedAttrs
*
* @return AttributeSetEntity
*/
public function installAttributeSet($akCateg, string $handle, string $name, array $associatedAttrs = []): AttributeSetEntity
{
if (is_string($akCateg)) {
$akCateg = $this->app->make(CategoryService::class)->getByHandle($akCateg);
}
$akCategController = $akCateg->getController();
$manager = $akCategController->getSetManager();
$set = $this->app->make(SetFactory::class)->getByHandle($handle);
if (!is_object($set)) {
$set = $manager->addSet($handle, $name, $this->pkg);
foreach ($associatedAttrs as $ak) {
if (is_string($ak)) {
$ak = $akCategController->getAttributeKeyByHandle($ak);
}
if ($ak !== null) {
$manager->addKey($set, $ak);
}
}
}
return $set;
}
/**
* Associate Attribute Keys To Set.
*
* @param AttributeKeyEntity[] $aks Array of attribute keys
* @param AttributeSetEntity|string $akSetHandleOrObj AttributeSet handle or object
*
* @throws \RuntimeException
*/
public function associateAttributeKeysToSet(array $aks, $akSetHandleOrObj): void
{
if (is_string($akSetHandleOrObj)) {
$akSetObj = $this->app->make(SetFactory::class)->getByHandle($akSetHandleOrObj);
if (!is_object($akSetObj)) {
throw new \RuntimeException(__METHOD__ . ': ' . t('The Attribute Set "%s" is not installed.', $akSetHandleOrObj));
}
} else {
$akSetObj = $akSetHandleOrObj;
}
$aSetAttrKeys = $akSetObj->getAttributeKeys();
foreach ($aks as $ak) {
if (!in_array($ak, $aSetAttrKeys)) {
$akSetObj->addKey($ak);
}
}
}
/**
* Override Single Page By Package.
*
* @param string $pagePath
* @param PackageEntity|int|null $pkgObjOrId if null then the actual related package will be used.
* @return ErrorList
*/
public function overrideSinglePage(string $pagePath, $pkgObjOrId = null): ErrorList
{
$pkgID = $this->pkg->getPackageID();
if ($pkgObjOrId) {
if (is_object($pkgObjOrId)) {
$pkgID = $pkgObjOrId->getPackageID();
} elseif (is_int($pkgObjOrId) && $pkgObjOrId > 0) {
$pkgID = (int) $pkgObjOrId;
} else {
throw new \RuntimeException(__METHOD__ . ': ' . t('Invalid given package or package id.'));
}
}
$e = new ErrorList();
$db = $this->app->make('database/connection');
$page = Page::getByPath($pagePath);
if (is_object($page) && !$page->isError()) {
$db->update('Pages', ['pkgID' => $pkgID], ['cID' => $page->getCollectionID()]);
} else {
$e->add(__METHOD__ . ': ' . t('Single Page with path `%s` not found.', $pagePath));
}
return $e;
}
/**
* Assign Blocks to Core.
*
* @param string $pagePath
*
* @return ErrorList
*/
public function assignSinglePageToCore(string $pagePath): ErrorList
{
$e = new ErrorList();
$db = $this->app->make('database/connection');
$page = Page::getByPath($pagePath);
if (is_object($page) && !$page->isError()) {
$db->update('Pages', ['pkgID' => 0], ['cID' => $page->getCollectionID()]);
} else {
$e->add(__METHOD__ . ': ' . t('Single Page with path `%s` not found.', $pagePath));
}
return $e;
}
/**
* Override Blocks By Package.
*
* @param array $blocks
* @param PackageEntity|int|null $pkgObjOrId
*
* @return ErrorList
*/
public function overrideBlocks(array $blocks, $pkgObjOrId = null): ErrorList
{
$pkgID = $this->pkg->getPackageID();
if ($pkgObjOrId) {
if (is_object($pkgObjOrId)) {
$pkgID = $pkgObjOrId->getPackageID();
} elseif (is_int($pkgObjOrId) && $pkgObjOrId > 0) {
$pkgID = (int) $pkgObjOrId;
} else {
throw new \RuntimeException(__METHOD__ . ': ' . t('Invalid given package or package id.'));
}
}
$e = new ErrorList();
foreach ($blocks as $btHandle) {
$block = BlockType::getByHandle($btHandle);
if ($block !== null) {
$block->setPackageID($pkgID);
$block->refresh();
} else {
$e->add(__METHOD__ . ': ' . t('Block Type with handle `%s` not found.', $btHandle));
}
}
return $e;
}
/**
* Assign Blocks to Core.
*
* @param array $blocks
*
* @return ErrorList
*/
public function assignBlocksToCore(array $blocks): ErrorList
{
$e = new ErrorList();
foreach ($blocks as $btHandle) {
$block = BlockType::getByHandle($btHandle);
if ($block !== null) {
$block->setPackageID(0);
$block->refresh();
} else {
$e->add(__METHOD__ . ': ' . t('Block Type with handle `%s` not found.', $btHandle));
}
}
return $e;
}
/**
* Install task
*
* @param string $handle
* @return Task
*/
public function installTask(string $handle): Task
{
$entityManager = $this->app->make(EntityManager::class);
$task = $entityManager->getRepository(Task::class)
->findOneByHandle($handle);
if ($task === null) {
$task = new Task();
$task->setHandle($handle);
$task->setPackage($this->pkg);
$entityManager->persist($task);
$entityManager->flush();
}
return $task;
}
/**
* @param string ...$tasks
* @return array|Task[]
*/
public function installTasks(string ...$tasks): array
{
$res = [];
foreach ($tasks as $task) {
$res[] = $this->installTask($task);
}
return $res;
}
}