added cwd in kimai:reload command (#1951)
This commit is contained in:
@@ -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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user