moved check:version to dev enviroment, for regular check use -v
This commit is contained in:
parent
b147cda096
commit
ac0d8c776e
5
TODO
5
TODO
@ -1,8 +1,3 @@
|
||||
check:bootstrap
|
||||
check:version remove option update, we have -v as option
|
||||
move stuff to dev:xxx which is not needed for endusers
|
||||
make use of environment, somehow, dev, prod, test
|
||||
check log file location
|
||||
check:config *validate if all required fields are set, sanity checks.
|
||||
API Endpoint cleanup
|
||||
check keytype of panel/bindApi
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "tracer/bindapi",
|
||||
"description": "manage Bind9 client zones for KeyHelp",
|
||||
"version": "1.0.9",
|
||||
"build_number": "377",
|
||||
"version": "1.1.0",
|
||||
"build_number": "378",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Micha Espey",
|
||||
|
@ -61,6 +61,9 @@ class CLIController
|
||||
private readonly bool $quiet
|
||||
)
|
||||
{
|
||||
$env = $this->configController->getConfig(configKey: 'env');
|
||||
$devEnvs = ['dev', 'test'];
|
||||
|
||||
$this->baseDir = dirname(path: __DIR__, levels: 2) . '/';
|
||||
|
||||
$apikeyGroup = (new CommandGroup(name: 'apikeys', description: 'API keys to access this bindAPI'))
|
||||
@ -273,14 +276,18 @@ class CLIController
|
||||
$this->checkSetup();
|
||||
},
|
||||
mandatoryParameters: ['username'],
|
||||
description: 'Adapt filesystem permissions (requires elaborated permissions)'))
|
||||
->addCommand(command: new Command(
|
||||
description: 'Adapt filesystem permissions (requires elaborated permissions)'));
|
||||
|
||||
if (in_array(needle: $env, haystack: $devEnvs)) {
|
||||
$checkVersionCommand = new Command(
|
||||
name: 'version',
|
||||
callback: function () {
|
||||
$this->checkVersion();
|
||||
},
|
||||
optionalParameters: ['update'],
|
||||
description: 'Read or set the bindApi version in the database'));
|
||||
description: 'Sync the versions from composer to the database');
|
||||
$checkGroup->addCommand(command: $checkVersionCommand);
|
||||
}
|
||||
|
||||
$migrationsGroup = (new CommandGroup(name: 'migrations', description: 'maintain database migrations'))
|
||||
->addCommand(command: new Command(
|
||||
name: 'status',
|
||||
@ -297,10 +304,8 @@ class CLIController
|
||||
description: 'Apply a new migration file'
|
||||
));
|
||||
|
||||
$env = $this->configController->getConfig(configKey: 'env');
|
||||
$makeEnvs = ['dev', 'test'];
|
||||
|
||||
if (in_array(needle: $env, haystack: $makeEnvs)) {
|
||||
if (in_array(needle: $env, haystack: $devEnvs)) {
|
||||
$makeMigrationsCommand = new Command(
|
||||
name: 'make',
|
||||
callback: function () {
|
||||
@ -2236,16 +2241,6 @@ const VERSION = '{$versionSting}';
|
||||
private function checkVersion(): void
|
||||
{
|
||||
$update = false;
|
||||
if (isset($this->arguments[1])) {
|
||||
$action = $this->arguments[1];
|
||||
if ($action !== 'update') {
|
||||
if (!$this->quiet) {
|
||||
echo 'The only allowed argument is "' . Colors::YELLOW . 'update' . Colors::DEFAULT . '.' . PHP_EOL;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
$update = true;
|
||||
}
|
||||
|
||||
$composerFile = $this->baseDir . DIRECTORY_SEPARATOR . 'composer.json';
|
||||
$composerJson = json_decode(json: file_get_contents(filename: $composerFile), associative: false);
|
||||
@ -2263,14 +2258,13 @@ const VERSION = '{$versionSting}';
|
||||
echo "File version:\t\t$fileVersion" . PHP_EOL;
|
||||
echo "File build number:\t$fileBuildNumber" . PHP_EOL;
|
||||
|
||||
if ($update) {
|
||||
$this->settingsRepository->set(name: 'version', value: $json);
|
||||
$this->settingsRepository->set(name: 'buildnumber', value: $fileBuildNumber);
|
||||
}
|
||||
$this->settingsRepository->set(name: 'version', value: $json);
|
||||
$this->settingsRepository->set(name: 'buildnumber', value: $fileBuildNumber);
|
||||
|
||||
$currentDBVersion = $this->settingsRepository->findByName(name: 'version');
|
||||
$dbVersion = json_decode(json: $currentDBVersion);
|
||||
|
||||
$currentDBBuildnumber = $this->settingsRepository->findByName(name: 'buildnumber');
|
||||
|
||||
echo "DB version:\t\t";
|
||||
echo $dbVersion->version->major . '.';
|
||||
echo $dbVersion->version->minor . '.';
|
||||
|
Loading…
Reference in New Issue
Block a user