added cwd in kimai:reload command (#1951)

This commit is contained in:
Toby Batch
2020-09-18 10:53:53 +01:00
committed by GitHub
parent 38249e6b5e
commit aa1ea98579

View File

@@ -30,6 +30,19 @@ final class ReloadCommand extends Command
public const ERROR_LINT_CONFIG = 8;
public const ERROR_LINT_TRANSLATIONS = 16;
/**
* Returns the base directory to the Kimai installation.
*
* @return string
*/
protected function getRootDirectory(): string
{
/** @var Application $application */
$application = $this->getApplication();
return $application->getKernel()->getProjectDir();
}
/**
* {@inheritdoc}
*/
@@ -53,6 +66,10 @@ final class ReloadCommand extends Command
$io->title('Reloading configurations ...');
// many users execute the bin/console command from arbitrary locations
$path = getcwd();
\chdir($this->getRootDirectory());
try {
$command = $this->getApplication()->find('lint:yaml');
$cmdInput = new StringInput('lint:yaml --parse-tags config');
@@ -92,6 +109,8 @@ final class ReloadCommand extends Command
// flush the cache, in case values from the database are cached
$cacheResult = $this->rebuildCaches($environment, $io, $input, $output);
chdir($path);
if ($cacheResult !== 0) {
$io->warning(
[