Skip to content

Commit

Permalink
Merge pull request #70 from acelaya-forks/feature/clear-cache
Browse files Browse the repository at this point in the history
Feature/clear cache
  • Loading branch information
acelaya authored Apr 6, 2020
2 parents 7e2e66d + feaff7d commit c2c9881
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 9 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## 4.3.2 - 2020-04-06

#### Added

* *Nothing*

#### Changed

* [#68](https://github.com/shlinkio/shlink-installer/issues/68) Updated dev dependencies.

#### Deprecated

* *Nothing*

#### Removed

* *Nothing*

#### Fixed

* [#69](https://github.com/shlinkio/shlink-installer/issues/69) Ensured `doctrine orm:clear-cache:meta` command is run after the installation, to avoid outdated cached metadata to be persisted between versions.


## 4.3.1 - 2020-03-23

#### Added
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
},
"require-dev": {
"devster/ubench": "^2.0",
"infection/infection": "^0.15.0",
"phpstan/phpstan": "^0.12.0",
"phpunit/phpunit": "^8.0",
"infection/infection": "^0.16.1",
"phpstan/phpstan": "^0.12.18",
"phpunit/phpunit": "~9.0.2",
"roave/security-advisories": "dev-master",
"shlinkio/php-coding-standard": "~2.1.0",
"symfony/var-dumper": "^5.0"
Expand All @@ -52,12 +52,12 @@
],
"cs": "phpcs",
"cs:fix": "phpcbf",
"stan": "phpstan analyse src --level=6",
"stan": "phpstan analyse src --level=7",
"test": "phpdbg -qrr vendor/bin/phpunit --order-by=random --testdox --colors=always",
"test:ci": "@test --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/junit.xml",
"test:pretty": "@test --coverage-html build/coverage-html",
"infect": "infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered",
"infect:ci": "@infect --coverage=build",
"infect:ci": "@infect --coverage=build --skip-initial-tests",
"infect:show": "@infect --show-mutations",
"infect:show:ci": "@infect --show-mutations --coverage=build",
"test:infect": [
Expand Down
5 changes: 5 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@
'initMessage' => 'Generating proxies...',
'errorMessage' => 'Error generating proxies.',
],
'orm_clear_cache' => [
'command' => 'vendor/doctrine/orm/bin/doctrine.php orm:clear-cache:metadata',
'initMessage' => 'Clearing entities cache...',
'errorMessage' => 'Error clearing entities cache.',
],
],
],

Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
1 change: 1 addition & 0 deletions src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class InstallCommand extends Command
'db_create_schema',
'db_migrate',
'orm_proxies',
'orm_clear_cache',
];

private WriterInterface $configWriter;
Expand Down
4 changes: 1 addition & 3 deletions src/Service/InstallationCommandsRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Process\PhpExecutableFinder;

use function array_unshift;
use function explode;
use function implode;
use function sprintf;
Expand Down Expand Up @@ -37,8 +36,7 @@ public function execPhpCommand(string $name, SymfonyStyle $io): bool
['command' => $command, 'initMessage' => $initMessage, 'errorMessage' => $errorMessage] = $commandConfig;
$io->write($initMessage);

$command = explode(' ', $command);
array_unshift($command, $this->phpBinary);
$command = [$this->phpBinary, ...explode(' ', $command)];
$io->write(
sprintf(' <options=bold>[Running "%s"]</> ', implode(' ', $command)),
false,
Expand Down
2 changes: 1 addition & 1 deletion test/Command/InstallCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function commandIsExecutedAsExpected(bool $isUpdate): void
$this->commandTester->setInputs(['no']);
$this->commandTester->execute([]);

$execPhpCommand->shouldHaveBeenCalledTimes($isUpdate ? 2 : 3);
$execPhpCommand->shouldHaveBeenCalledTimes($isUpdate ? 3 : 4);
$resolvePreviousCommand->shouldHaveBeenCalledTimes($isUpdate ? 1 : 0);
$importAssets->shouldHaveBeenCalledTimes($isUpdate ? 1 : 0);
$persistConfig->shouldHaveBeenCalledOnce();
Expand Down

0 comments on commit c2c9881

Please sign in to comment.