aboutsummaryrefslogtreecommitdiff
path: root/cli/reconfigure.php
diff options
context:
space:
mode:
authorGravatar Kasimir Cash <kasimir.cash@outlook.com> 2024-01-17 07:42:43 +0000
committerGravatar GitHub <noreply@github.com> 2024-01-17 08:42:43 +0100
commit6d14813840d163c76f6dc25395b0007a88b42e9d (patch)
treed01fccbd7e31f4fdccfc6649621ba1d8d75a9eef /cli/reconfigure.php
parent314077a457f04cc2f0472e036af029e2676fbf02 (diff)
Standardise command line option parsing (#6036)
* Separates long & short options for parsing * Adds parsing for short options + doc rewrites * Fixes undefined constant in check.translation * Standardises CL option parsing * Refactors option parsing * Renames getLongOptions -> getOptions * Removes unused code * Converges on string typing for options * Updates docs & help files * Updates array syntax array( ) -> [ ]
Diffstat (limited to 'cli/reconfigure.php')
-rwxr-xr-xcli/reconfigure.php21
1 files changed, 11 insertions, 10 deletions
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index da433c1a0..fde16c921 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -3,8 +3,8 @@
declare(strict_types=1);
require(__DIR__ . '/_cli.php');
-$parameters = array(
- 'valid' => array(
+$parameters = [
+ 'long' => [
'environment' => ':',
'base-url' => ':',
'language' => ':',
@@ -22,8 +22,9 @@ $parameters = array(
'db-password' => ':',
'db-base' => ':',
'db-prefix' => '::',
- ),
- 'deprecated' => array(
+ ],
+ 'short' => [],
+ 'deprecated' => [
'base-url' => 'base_url',
'default-user' => 'default_user',
'allow-anonymous' => 'allow_anonymous',
@@ -32,10 +33,10 @@ $parameters = array(
'api-enabled' => 'api_enabled',
'allow-robots' => 'allow_robots',
'disable-update' => 'disable_update',
- ),
-);
+ ],
+];
-$configParams = array(
+$configParams = [
'environment',
'base-url',
'language',
@@ -47,16 +48,16 @@ $configParams = array(
'api-enabled',
'allow-robots',
'disable-update',
-);
+];
-$dBconfigParams = array(
+$dBconfigParams = [
'db-type' => 'type',
'db-host' => 'host',
'db-user' => 'user',
'db-password' => 'password',
'db-base' => 'base',
'db-prefix' => 'prefix',
-);
+];
$options = parseCliParams($parameters);