@@ -21,40 +21,6 @@ class DatabaseDownloadSource extends AbstractHandler {
2121
2222 const NONE = 'none ' ;
2323
24- /**
25- * {@inheritdoc}
26- */
27- public function discover (): null |string |bool |array {
28- return Env::getFromDotenv ('VORTEX_DB_DOWNLOAD_SOURCE ' , $ this ->dstDir );
29- }
30-
31- /**
32- * {@inheritdoc}
33- */
34- public function process (): void {
35- $ type = $ this ->getResponseAsString ();
36-
37- File::replaceContentInFile ($ this ->tmpDir . '/.env ' , '/VORTEX_DB_DOWNLOAD_SOURCE=.*/ ' , 'VORTEX_DB_DOWNLOAD_SOURCE= ' . $ type );
38-
39- $ types = [
40- DatabaseDownloadSource::URL ,
41- DatabaseDownloadSource::FTP ,
42- DatabaseDownloadSource::ACQUIA ,
43- DatabaseDownloadSource::LAGOON ,
44- DatabaseDownloadSource::CONTAINER_REGISTRY ,
45- ];
46-
47- foreach ($ types as $ t ) {
48- $ token = 'DB_DOWNLOAD_SOURCE_ ' . strtoupper ($ t );
49- if ($ t === $ type ) {
50- File::removeTokenAsync ('! ' . $ token );
51- }
52- else {
53- File::removeTokenAsync ($ token );
54- }
55- }
56- }
57-
5824 /**
5925 * {@inheritdoc}
6026 */
@@ -79,7 +45,7 @@ public function options(array $responses): ?array {
7945 self ::ACQUIA => '💧 Acquia backup ' ,
8046 self ::LAGOON => '🌊 Lagoon environment ' ,
8147 self ::CONTAINER_REGISTRY => '🐳 Container registry ' ,
82- self ::NONE => '🚫 None ' ,
48+ self ::NONE => '🙅 None ' ,
8349 ];
8450
8551 if (isset ($ responses [HostingProvider::id ()])) {
@@ -95,6 +61,13 @@ public function options(array $responses): ?array {
9561 return $ options ;
9662 }
9763
64+ /**
65+ * {@inheritdoc}
66+ */
67+ public function shouldRun (array $ responses ): bool {
68+ return isset ($ responses [ProvisionType::id ()]) && $ responses [ProvisionType::id ()] !== ProvisionType::PROFILE ;
69+ }
70+
9871 /**
9972 * {@inheritdoc}
10073 */
@@ -113,8 +86,35 @@ public function default(array $responses): null|string|bool|array {
11386 /**
11487 * {@inheritdoc}
11588 */
116- public function shouldRun (array $ responses ): bool {
117- return isset ($ responses [ProvisionType::id ()]) && $ responses [ProvisionType::id ()] !== ProvisionType::PROFILE ;
89+ public function discover (): null |string |bool |array {
90+ return Env::getFromDotenv ('VORTEX_DB_DOWNLOAD_SOURCE ' , $ this ->dstDir );
91+ }
92+
93+ /**
94+ * {@inheritdoc}
95+ */
96+ public function process (): void {
97+ $ type = $ this ->getResponseAsString ();
98+
99+ File::replaceContentInFile ($ this ->tmpDir . '/.env ' , '/VORTEX_DB_DOWNLOAD_SOURCE=.*/ ' , 'VORTEX_DB_DOWNLOAD_SOURCE= ' . $ type );
100+
101+ $ types = [
102+ DatabaseDownloadSource::URL ,
103+ DatabaseDownloadSource::FTP ,
104+ DatabaseDownloadSource::ACQUIA ,
105+ DatabaseDownloadSource::LAGOON ,
106+ DatabaseDownloadSource::CONTAINER_REGISTRY ,
107+ ];
108+
109+ foreach ($ types as $ t ) {
110+ $ token = 'DB_DOWNLOAD_SOURCE_ ' . strtoupper ($ t );
111+ if ($ t === $ type ) {
112+ File::removeTokenAsync ('! ' . $ token );
113+ }
114+ else {
115+ File::removeTokenAsync ($ token );
116+ }
117+ }
118118 }
119119
120120}
0 commit comments