|
@@ -48,7 +48,7 @@ discard block |
|
|
block discarded – undo |
|
48
|
48
|
->addOption('admin-user', null, InputOption::VALUE_REQUIRED, 'Login of the admin account', 'admin') |
|
49
|
49
|
->addOption('admin-pass', null, InputOption::VALUE_REQUIRED, 'Password of the admin account') |
|
50
|
50
|
->addOption('admin-email', null, InputOption::VALUE_OPTIONAL, 'E-Mail of the admin account') |
|
51
|
|
- ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT . '/data'); |
|
|
51
|
+ ->addOption('data-dir', null, InputOption::VALUE_REQUIRED, 'Path to data directory', \OC::$SERVERROOT.'/data'); |
|
52
|
52
|
} |
|
53
|
53
|
|
|
54
|
54
|
protected function execute(InputInterface $input, OutputInterface $output): int { |
|
@@ -96,7 +96,7 @@ discard block |
|
|
block discarded – undo |
|
96
|
96
|
$db = strtolower($input->getOption('database')); |
|
97
|
97
|
|
|
98
|
98
|
if (!in_array($db, $supportedDatabases)) { |
|
99
|
|
- throw new InvalidArgumentException("Database <$db> is not supported. " . implode(', ', $supportedDatabases) . ' are supported.'); |
|
|
99
|
+ throw new InvalidArgumentException("Database <$db> is not supported. ".implode(', ', $supportedDatabases).' are supported.'); |
|
100
|
100
|
} |
|
101
|
101
|
|
|
102
|
102
|
$dbUser = $input->getOption('database-user'); |
|
@@ -111,12 +111,12 @@ discard block |
|
|
block discarded – undo |
|
111
|
111
|
} |
|
112
|
112
|
if ($dbPort) { |
|
113
|
113
|
// Append the port to the host so it is the same as in the config (there is no dbport config) |
|
114
|
|
- $dbHost .= ':' . $dbPort; |
|
|
114
|
+ $dbHost .= ':'.$dbPort; |
|
115
|
115
|
} |
|
116
|
116
|
if ($input->hasParameterOption('--database-pass')) { |
|
117
|
|
- $dbPass = (string)$input->getOption('database-pass'); |
|
|
117
|
+ $dbPass = (string) $input->getOption('database-pass'); |
|
118
|
118
|
} |
|
119
|
|
- $disableAdminUser = (bool)$input->getOption('disable-admin-user'); |
|
|
119
|
+ $disableAdminUser = (bool) $input->getOption('disable-admin-user'); |
|
120
|
120
|
$adminLogin = $input->getOption('admin-user'); |
|
121
|
121
|
$adminPassword = $input->getOption('admin-pass'); |
|
122
|
122
|
$adminEmail = $input->getOption('admin-email'); |
|
@@ -132,7 +132,7 @@ discard block |
|
|
block discarded – undo |
|
132
|
132
|
if (is_null($dbPass)) { |
|
133
|
133
|
/** @var QuestionHelper $helper */ |
|
134
|
134
|
$helper = $this->getHelper('question'); |
|
135
|
|
- $question = new Question('What is the password to access the database with user <' . $dbUser . '>?'); |
|
|
135
|
+ $question = new Question('What is the password to access the database with user <'.$dbUser.'>?'); |
|
136
|
136
|
$question->setHidden(true); |
|
137
|
137
|
$question->setHiddenFallback(false); |
|
138
|
138
|
$dbPass = $helper->ask($input, $output, $question); |
|
@@ -142,14 +142,14 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
if (!$disableAdminUser && $adminPassword === null) { |
|
143
|
143
|
/** @var QuestionHelper $helper */ |
|
144
|
144
|
$helper = $this->getHelper('question'); |
|
145
|
|
- $question = new Question('What is the password you like to use for the admin account <' . $adminLogin . '>?'); |
|
|
145
|
+ $question = new Question('What is the password you like to use for the admin account <'.$adminLogin.'>?'); |
|
146
|
146
|
$question->setHidden(true); |
|
147
|
147
|
$question->setHiddenFallback(false); |
|
148
|
148
|
$adminPassword = $helper->ask($input, $output, $question); |
|
149
|
149
|
} |
|
150
|
150
|
|
|
151
|
151
|
if (!$disableAdminUser && $adminEmail !== null && !filter_var($adminEmail, FILTER_VALIDATE_EMAIL)) { |
|
152
|
|
- throw new InvalidArgumentException('Invalid e-mail-address <' . $adminEmail . '> for <' . $adminLogin . '>.'); |
|
|
152
|
+ throw new InvalidArgumentException('Invalid e-mail-address <'.$adminEmail.'> for <'.$adminLogin.'>.'); |
|
153
|
153
|
} |
|
154
|
154
|
|
|
155
|
155
|
$options = [ |
|
@@ -177,25 +177,25 @@ discard block |
|
|
block discarded – undo |
|
177
|
177
|
protected function printErrors(OutputInterface $output, array $errors): void { |
|
178
|
178
|
foreach ($errors as $error) { |
|
179
|
179
|
if (is_array($error)) { |
|
180
|
|
- $output->writeln('<error>' . $error['error'] . '</error>'); |
|
|
180
|
+ $output->writeln('<error>'.$error['error'].'</error>'); |
|
181
|
181
|
if (isset($error['hint']) && !empty($error['hint'])) { |
|
182
|
|
- $output->writeln('<info> -> ' . $error['hint'] . '</info>'); |
|
|
182
|
+ $output->writeln('<info> -> '.$error['hint'].'</info>'); |
|
183
|
183
|
} |
|
184
|
184
|
if (isset($error['exception']) && $error['exception'] instanceof Throwable) { |
|
185
|
185
|
$this->printThrowable($output, $error['exception']); |
|
186
|
186
|
} |
|
187
|
187
|
} else { |
|
188
|
|
- $output->writeln('<error>' . $error . '</error>'); |
|
|
188
|
+ $output->writeln('<error>'.$error.'</error>'); |
|
189
|
189
|
} |
|
190
|
190
|
} |
|
191
|
191
|
} |
|
192
|
192
|
|
|
193
|
193
|
private function printThrowable(OutputInterface $output, Throwable $t): void { |
|
194
|
|
- $output->write('<info>Trace: ' . $t->getTraceAsString() . '</info>'); |
|
|
194
|
+ $output->write('<info>Trace: '.$t->getTraceAsString().'</info>'); |
|
195
|
195
|
$output->writeln(''); |
|
196
|
196
|
if ($t->getPrevious() !== null) { |
|
197
|
197
|
$output->writeln(''); |
|
198
|
|
- $output->writeln('<info>Previous: ' . get_class($t->getPrevious()) . ': ' . $t->getPrevious()->getMessage() . '</info>'); |
|
|
198
|
+ $output->writeln('<info>Previous: '.get_class($t->getPrevious()).': '.$t->getPrevious()->getMessage().'</info>'); |
|
199
|
199
|
$this->printThrowable($output, $t->getPrevious()); |
|
200
|
200
|
} |
|
201
|
201
|
} |