prepare release 1.8 (#1505)

This commit is contained in:
Kevin Papst
2020-03-01 14:25:59 +01:00
committed by GitHub
parent 8d3a305ec3
commit b8273c4441
8 changed files with 149 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
unreleased=true
future-release=1.7
future-release=1.8
exclude-labels=duplicate,question,invalid,wontfix,release
enhancement_labels=>enhancement,Enhancement,feature request,translation i18n,technical debt
issues-wo-labels=false

View File

@@ -1,5 +1,10 @@
# Change Log
## [1.8](https://github.com/kevinpapst/kimai2/tree/1.8)
[Full Changelog](https://github.com/kevinpapst/kimai2/compare/1.7...1.8)
Release notes including the changelog can be found [here](https://github.com/kevinpapst/kimai2/releases/tag/1.8)
## [1.7](https://github.com/kevinpapst/kimai2/tree/1.7)
[Full Changelog](https://github.com/kevinpapst/kimai2/compare/1.6.2...1.7)

View File

@@ -4,7 +4,7 @@ App\Entity\User:
- App\Validator\Constraints\Role: ~
username:
- NotBlank: ~
- Length: { min: 3, max: 60 }
- Length: { min: 2, max: 60 }
email:
- NotBlank: ~
- Email: ~

View File

@@ -0,0 +1,138 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
/**
* Command used to update a Kimai installation.
*
* @codeCoverageIgnore
*/
final class ReloadCommand extends Command
{
public const ERROR_CACHE_CLEAN = 2;
public const ERROR_CACHE_WARMUP = 4;
public const ERROR_LINT_CONFIG = 8;
public const ERROR_LINT_TRANSLATIONS = 16;
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('kimai:reload')
->setDescription('Reload Kimai caches')
->setHelp('This command will validate the configurations and translations and then clear and rebuild the application cache.')
;
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Reloading configurations ...');
try {
$command = $this->getApplication()->find('lint:yaml');
$cmdInput = new StringInput('lint:yaml --parse-tags config');
$cmdInput->setInteractive(false);
if (0 !== $command->run($cmdInput, $output)) {
throw new \RuntimeException('Config file seems to be invalid');
}
$io->writeln('');
} catch (\Exception $ex) {
$io->error($ex->getMessage());
return self::ERROR_LINT_CONFIG;
}
try {
$command = $this->getApplication()->find('lint:xliff');
$cmdInput = new StringInput('lint:xliff translations');
$cmdInput->setInteractive(false);
if (0 !== $command->run($cmdInput, $output)) {
throw new \RuntimeException('Translation files seem to be invalid');
}
$io->writeln('');
} catch (\Exception $ex) {
$io->error($ex->getMessage());
return self::ERROR_LINT_TRANSLATIONS;
}
$environment = getenv('APP_ENV');
if ($input->hasArgument('env')) {
$environment = $input->getArgument('env');
}
// flush the cache, in case values from the database are cached
$cacheResult = $this->rebuildCaches($environment, $io, $input, $output);
if ($cacheResult !== 0) {
$io->warning(
[
'Cache could not be rebuilt.',
'Please run the cache commands manually:',
'bin/console cache:clear --env=' . $environment . PHP_EOL .
'bin/console cache:warmup --env=' . $environment
]
);
} else {
$io->success(
sprintf('Kimai config was reloaded')
);
}
return 0;
}
protected function rebuildCaches(string $environment, SymfonyStyle $io, InputInterface $input, OutputInterface $output)
{
$io->text('Rebuilding your cache, please be patient ...');
$command = $this->getApplication()->find('cache:clear');
try {
if (0 !== $command->run(new ArrayInput(['--env' => $environment]), $output)) {
throw new \RuntimeException('Could not clear cache, missing permissions?');
}
} catch (\Exception $ex) {
$io->error($ex->getMessage());
return self::ERROR_CACHE_CLEAN;
}
$command = $this->getApplication()->find('cache:warmup');
try {
if (0 !== $command->run(new ArrayInput(['--env' => $environment]), $output)) {
throw new \RuntimeException('Could not warmup cache, missing permissions?');
}
} catch (\Exception $ex) {
$io->error($ex->getMessage());
return self::ERROR_CACHE_WARMUP;
}
return 0;
}
}

View File

@@ -21,7 +21,7 @@ class Constants
/**
* The current release status, either "stable" or "dev"
*/
public const STATUS = 'dev';
public const STATUS = 'stable';
/**
* The software name
*/

View File

@@ -62,7 +62,7 @@ class SecurityControllerTest extends ControllerBaseTest
$this->assertStringContainsString('<input type="email"', $content);
$this->assertStringContainsString('id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required"', $content);
$this->assertStringContainsString('<input type="text"', $content);
$this->assertStringContainsString('id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="60" pattern=".{3,}"', $content);
$this->assertStringContainsString('id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" maxlength="60" pattern=".{2,}"', $content);
$this->assertStringContainsString('<input type="password"', $content);
$this->assertStringContainsString('id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required"', $content);
$this->assertStringContainsString('id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required"', $content);

View File

@@ -211,7 +211,7 @@ class UserControllerTest extends ControllerBaseTest
[
[
'user_create' => [
'username' => 'xx',
'username' => 'x',
'plainPassword' => ['first' => 'sdfsdf', 'second' => 'sdfxxx'],
'alias' => 'ycvyxcb',
'title' => '34rtwrtewrt',

View File

@@ -25,7 +25,7 @@ class UserValidationTest extends KernelTestCase
return [
['', ''],
[null, null],
['xx', 'test@'], // too short username
['x', 'test@'], // too short username
[str_pad('#', 61, '-'), 'test@x.'], // too long username
[str_pad('#', 61, '-'), 'test@x.', ['xxxxx']], // too short password and invalid role
];