|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package midcom.console |
|
4
|
|
|
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
5
|
|
|
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
6
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace midcom\console\command; |
|
10
|
|
|
|
|
11
|
|
|
use Symfony\Component\Console\Command\Command; |
|
|
|
|
|
|
12
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
13
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
14
|
|
|
use midcom_services_cache; |
|
15
|
|
|
use Symfony\Component\Filesystem\Filesystem; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* clear the cache of the current site |
|
19
|
|
|
* |
|
20
|
|
|
* @see midcom_services_cache |
|
21
|
|
|
* @package midcom.console |
|
22
|
|
|
*/ |
|
23
|
|
|
class cacheinvalidate extends Command |
|
24
|
|
|
{ |
|
25
|
|
|
private midcom_services_cache $cache; |
|
26
|
|
|
|
|
27
|
|
|
private string $cachedir; |
|
28
|
|
|
|
|
29
|
|
|
public function __construct(midcom_services_cache $cache, string $cachedir) |
|
30
|
|
|
{ |
|
31
|
|
|
$this->cache = $cache; |
|
32
|
|
|
$this->cachedir = $cachedir; |
|
33
|
|
|
parent::__construct(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
protected function configure() |
|
37
|
|
|
{ |
|
38
|
|
|
$this->setName('midcom:cache-invalidate') |
|
39
|
|
|
->setAliases(['cache-invalidate']) |
|
40
|
|
|
->setDescription('Clears the cache'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) : int |
|
44
|
|
|
{ |
|
45
|
|
|
try { |
|
46
|
|
|
$this->cache->invalidate_all(); |
|
47
|
|
|
} catch (\Throwable $e) { |
|
48
|
|
|
$output->writeln($e->getMessage()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
$fs = new Filesystem; |
|
52
|
|
|
$fs->remove([$this->cachedir]); |
|
53
|
|
|
return 0; |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths