From 39da838ebddd6de50e605260e84d0590dd78da65 Mon Sep 17 00:00:00 2001 From: "Marcel Kapfer (mmk2410)" Date: Thu, 21 Apr 2016 09:56:53 +0200 Subject: [PATCH] RCC init script --- bin/init_rcc.php | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 bin/init_rcc.php diff --git a/bin/init_rcc.php b/bin/init_rcc.php new file mode 100644 index 0000000..1f7481c --- /dev/null +++ b/bin/init_rcc.php @@ -0,0 +1,71 @@ +getConfig(); + +$rccOn = ""; + +while (!(in_array($rccOn, array("y", "Y", "n", "N")))) { + $rccOn = readline("Enable RCC: (y/n) "); +} + +if (in_array($rccOn, array("y", "Y"))) { + $yaml["rcc"]["rcc"] = "on"; +} else { + $yaml["rcc"]["rcc"] = "off"; +} + +$apiOn = ""; + +while (!(in_array($apiOn, array("Y", "y", "n", "N")))) { + $apiOn = readline("Enable RCC API: (y/n) "); +} + +if (in_array($apiOn, array("y", "Y"))) { + $yaml["rcc"]["api"] = "on"; +} else { + $yaml["rcc"]["api"] = "off"; +} + +$config = new Config('config.yaml', 'vendor/autoload.php'); + +if ($config->writeConfig($yaml)) { + echo "Changes saved.\n"; +} else { + echo "Failed to save changes.\n"; +}