|
@@ -26,10 +26,10 @@ discard block |
|
|
block discarded – undo |
|
26
|
26
|
|
|
27
|
27
|
/************************ Service name **********************/ |
|
28
|
28
|
$question = new Question('Please enter the name of the service [app]: ', 'app'); |
|
29
|
|
- $question->setValidator(function (string $value) { |
|
|
29
|
+ $question->setValidator(function(string $value) { |
|
30
|
30
|
$value = trim($value); |
|
31
|
31
|
if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) { |
|
32
|
|
- throw new \InvalidArgumentException('Invalid service name "'.$value.'". Service names can contain alphanumeric characters, and "_", ".", "-".'); |
|
|
32
|
+ throw new \InvalidArgumentException('Invalid service name "' . $value . '". Service names can contain alphanumeric characters, and "_", ".", "-".'); |
|
33
|
33
|
} |
|
34
|
34
|
|
|
35
|
35
|
return $value; |
|
@@ -85,7 +85,7 @@ discard block |
|
|
block discarded – undo |
|
85
|
85
|
if ($node === 'No') { |
|
86
|
86
|
$node = ''; |
|
87
|
87
|
} else { |
|
88
|
|
- $node = '-'.$node; |
|
|
88
|
+ $node = '-' . $node; |
|
89
|
89
|
} |
|
90
|
90
|
|
|
91
|
91
|
$service->setImage("thecodingmachine/php:$phpVersion-v1-$variant$node"); |
|
@@ -101,13 +101,13 @@ discard block |
|
|
block discarded – undo |
|
101
|
101
|
$appDirectory = trim($appDirectory, '/') ?: '.'; |
|
102
|
102
|
$rootDir = Pheromone::getContainerProjectDirectory(); |
|
103
|
103
|
|
|
104
|
|
- $fullDir = $rootDir.'/'.$appDirectory; |
|
|
104
|
+ $fullDir = $rootDir . '/' . $appDirectory; |
|
105
|
105
|
if (!is_dir($fullDir)) { |
|
106
|
|
- $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</error>'); |
|
|
106
|
+ $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</error>'); |
|
107
|
107
|
$appDirectory = null; |
|
108
|
108
|
} |
|
109
|
109
|
} while ($appDirectory === null); |
|
110
|
|
- $this->output->writeln('<info>Your root PHP application directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'</info>'); |
|
|
110
|
+ $this->output->writeln('<info>Your root PHP application directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '</info>'); |
|
111
|
111
|
$this->output->writeln(''); |
|
112
|
112
|
$this->output->writeln(''); |
|
113
|
113
|
|
|
@@ -130,15 +130,15 @@ discard block |
|
|
block discarded – undo |
|
130
|
130
|
$webDirectory = trim($webDirectory, '/') ?: '.'; |
|
131
|
131
|
$rootDir = Pheromone::getContainerProjectDirectory(); |
|
132
|
132
|
|
|
133
|
|
- $fullDir = $rootDir.'/'.$appDirectory.'/'.$webDirectory; |
|
|
133
|
+ $fullDir = $rootDir . '/' . $appDirectory . '/' . $webDirectory; |
|
134
|
134
|
if (!is_dir($fullDir)) { |
|
135
|
|
- $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</error>'); |
|
|
135
|
+ $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</error>'); |
|
136
|
136
|
$webDirectory = null; |
|
137
|
137
|
} |
|
138
|
138
|
} while ($webDirectory === null); |
|
139
|
139
|
|
|
140
|
140
|
$service->addImageEnvVariable('APACHE_DOCUMENT_ROOT', $webDirectory); |
|
141
|
|
- $this->output->writeln('<info>Your web directory is '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$webDirectory.'</info>'); |
|
|
141
|
+ $this->output->writeln('<info>Your web directory is ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $webDirectory . '</info>'); |
|
142
|
142
|
$this->output->writeln(''); |
|
143
|
143
|
$this->output->writeln(''); |
|
144
|
144
|
} |
|
@@ -159,26 +159,26 @@ discard block |
|
|
block discarded – undo |
|
159
|
159
|
$rootDir = Pheromone::getContainerProjectDirectory(); |
|
160
|
160
|
|
|
161
|
161
|
if ($uploadDirectory !== '') { |
|
162
|
|
- $fullDir = $rootDir.'/'.$appDirectory.'/'.$uploadDirectory; |
|
|
162
|
+ $fullDir = $rootDir . '/' . $appDirectory . '/' . $uploadDirectory; |
|
163
|
163
|
if (!is_dir($fullDir)) { |
|
164
|
|
- $this->output->writeln('<error>Could not find directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.'</error>'); |
|
|
164
|
+ $this->output->writeln('<error>Could not find directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . '</error>'); |
|
165
|
165
|
$uploadDirectory = null; |
|
166
|
166
|
} else { |
|
167
|
167
|
$uploadDirs[] = $uploadDirectory; |
|
168
|
|
- $this->output->writeln('<info>Directory '.Pheromone::getHostProjectDirectory().'/'.$appDirectory.'/'.$uploadDirectory.' will be stored out of the container</info>'); |
|
|
168
|
+ $this->output->writeln('<info>Directory ' . Pheromone::getHostProjectDirectory() . '/' . $appDirectory . '/' . $uploadDirectory . ' will be stored out of the container</info>'); |
|
169
|
169
|
|
|
170
|
170
|
$question = new Question('What name should we use for this volume? ', ''); |
|
171
|
|
- $question->setValidator(function (string $value) { |
|
|
171
|
+ $question->setValidator(function(string $value) { |
|
172
|
172
|
$value = trim($value); |
|
173
|
173
|
if (!\preg_match('/^[a-zA-Z0-9_.-]+$/', $value)) { |
|
174
|
|
- throw new \InvalidArgumentException('Invalid volume name "'.$value.'". Volume names can contain alphanumeric characters, and "_", ".", "-".'); |
|
|
174
|
+ throw new \InvalidArgumentException('Invalid volume name "' . $value . '". Volume names can contain alphanumeric characters, and "_", ".", "-".'); |
|
175
|
175
|
} |
|
176
|
176
|
|
|
177
|
177
|
return $value; |
|
178
|
178
|
}); |
|
179
|
179
|
$volumeName = $helper->ask($this->input, $this->output, $question); |
|
180
|
180
|
|
|
181
|
|
- $service->addNamedVolume($appDirectory.'/'.$uploadDirectory, $volumeName); |
|
|
181
|
+ $service->addNamedVolume($appDirectory . '/' . $uploadDirectory, $volumeName); |
|
182
|
182
|
} |
|
183
|
183
|
} |
|
184
|
184
|
} while ($uploadDirectory !== ''); |
|
@@ -193,16 +193,16 @@ discard block |
|
|
block discarded – undo |
|
193
|
193
|
$this->output->writeln('By default, the following extensions are enabled:'); |
|
194
|
194
|
$this->output->writeln('<info>apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd</info>'); |
|
195
|
195
|
$this->output->writeln('You can select more extensions below:'); |
|
196
|
|
- $this->output->writeln('<info>'.\implode(' ', $availableExtensions).'</info>'); |
|
|
196
|
+ $this->output->writeln('<info>' . \implode(' ', $availableExtensions) . '</info>'); |
|
197
|
197
|
|
|
198
|
198
|
/************************ Extensions **********************/ |
|
199
|
199
|
$extensions = []; |
|
200
|
200
|
do { |
|
201
|
201
|
$question = new Question('Please enter the name of an additional extension you want to install (keep empty to skip): ', ''); |
|
202
|
202
|
$question->setAutocompleterValues($availableExtensions); |
|
203
|
|
- $question->setValidator(function (string $value) use ($availableExtensions) { |
|
|
203
|
+ $question->setValidator(function(string $value) use ($availableExtensions) { |
|
204
|
204
|
if (trim($value) !== '' && !\in_array($value, $availableExtensions)) { |
|
205
|
|
- throw new \InvalidArgumentException('Unknown extension '.$value); |
|
|
205
|
+ throw new \InvalidArgumentException('Unknown extension ' . $value); |
|
206
|
206
|
} |
|
207
|
207
|
|
|
208
|
208
|
return trim($value); |
|
@@ -211,11 +211,11 @@ discard block |
|
|
block discarded – undo |
|
211
|
211
|
$extension = $helper->ask($this->input, $this->output, $question); |
|
212
|
212
|
|
|
213
|
213
|
if ($extension !== '') { |
|
214
|
|
- $service->addImageEnvVariable('PHP_EXTENSION_'.\strtoupper($extension), '1'); |
|
|
214
|
+ $service->addImageEnvVariable('PHP_EXTENSION_' . \strtoupper($extension), '1'); |
|
215
|
215
|
$extensions[] = $extension; |
|
216
|
216
|
} |
|
217
|
217
|
} while ($extension !== ''); |
|
218
|
|
- $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd '.\implode(' ', $extensions).'</info>'); |
|
|
218
|
+ $this->output->writeln('<info>Enabled extensions: apcu mysqli opcache pdo pdo_mysql redis zip soap mbstring ftp mysqlnd ' . \implode(' ', $extensions) . '</info>'); |
|
219
|
219
|
$this->output->writeln(''); |
|
220
|
220
|
$this->output->writeln(''); |
|
221
|
221
|
|
|
@@ -223,9 +223,9 @@ discard block |
|
|
block discarded – undo |
|
223
|
223
|
/************************ php.ini settings **********************/ |
|
224
|
224
|
$this->output->writeln("Now, let's customize some settings of <info>php.ini</info>."); |
|
225
|
225
|
$question = new Question('Please specify the PHP <info>memory limit</info> (keep empty to stay with the default 128M): ', ''); |
|
226
|
|
- $question->setValidator(function (string $value) { |
|
|
226
|
+ $question->setValidator(function(string $value) { |
|
227
|
227
|
if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) { |
|
228
|
|
- throw new \InvalidArgumentException('Invalid value: '.$value); |
|
|
228
|
+ throw new \InvalidArgumentException('Invalid value: ' . $value); |
|
229
|
229
|
} |
|
230
|
230
|
|
|
231
|
231
|
return trim($value); |
|
@@ -237,9 +237,9 @@ discard block |
|
|
block discarded – undo |
|
237
|
237
|
$service->addImageEnvVariable('PHP_INI_MEMORY_LIMIT', $memoryLimit); |
|
238
|
238
|
|
|
239
|
239
|
$question = new Question('Please specify the <info>maximum file size for uploaded files</info> (keep empty to stay with the default 2M): ', ''); |
|
240
|
|
- $question->setValidator(function (string $value) { |
|
|
240
|
+ $question->setValidator(function(string $value) { |
|
241
|
241
|
if (trim($value) !== '' && !\preg_match('/^[0-9]+([MGK])?$/i', $value)) { |
|
242
|
|
- throw new \InvalidArgumentException('Invalid value: '.$value); |
|
|
242
|
+ throw new \InvalidArgumentException('Invalid value: ' . $value); |
|
243
|
243
|
} |
|
244
|
244
|
|
|
245
|
245
|
return $value; |
|
@@ -262,7 +262,7 @@ discard block |
|
|
block discarded – undo |
|
262
|
262
|
|
|
263
|
263
|
if ($depend !== '') { |
|
264
|
264
|
$service->addDependsOn($depend); |
|
265
|
|
- $this->output->writeln('<info>Added dependency: '.$depend.'</info>'); |
|
|
265
|
+ $this->output->writeln('<info>Added dependency: ' . $depend . '</info>'); |
|
266
|
266
|
} |
|
267
|
267
|
} while ($depend !== ''); |
|
268
|
268
|
$this->output->writeln(''); |