diff --git a/buildzip.php b/buildzip.php index ba84917..bdf1ce6 100755 --- a/buildzip.php +++ b/buildzip.php @@ -51,6 +51,8 @@ fclose($fh); unlink('./docker-config.php'); unlink('./content/lang/en-rtl.json'); +unlink('./mtt-edit-settings.php'); + /* # save only 2 languages $dh = opendir('./content/lang/') or die("Cant opendir lang\n"); diff --git a/src/mtt-edit-settings.php b/src/mtt-edit-settings.php new file mode 100644 index 0000000..556c61c --- /dev/null +++ b/src/mtt-edit-settings.php @@ -0,0 +1,47 @@ + \n". + " mtt-edit-settings.php write \n". + " mtt-edit-settings.php password \n" + ); +} + +$dontStartSession = true; +require_once(__DIR__ . '/init.php'); + +$cmd = $argv[1]; +$param = $argv[2]; +$value = $argc > 3 ? $argv[3] : null; + + +switch ($cmd) { + case 'read': cmd_read($param, $value); break; + case 'write': cmd_write($param, $value); break; + case 'password': cmd_password($param); break; + default: die("Unknown command: $cmd\n"); +} + + +function cmd_read($param) { + print Config::get($param) . "\n"; +} + +function cmd_write($param, $value) { + if ($value === null) { + die("Can not write '$param': value is not specified\n"); + } + print ("Set '$param' to '$value'\n"); + Config::set($param, $value); + Config::save(); + print ("Done!\n"); +} + +function cmd_password($value) { + $value = passwordHash($value); + cmd_write('password', $value); +}