magallanes/src/Task/BuiltIn/Symfony/CacheClearTask.php

44 lines
1,003 B
PHP
Raw Normal View History

2016-12-31 07:52:25 +01:00
<?php
2022-04-10 06:20:03 +02:00
2016-12-31 07:52:25 +01:00
/*
* This file is part of the Magallanes package.
*
* (c) Andrés Montañez <andres@andresmontanez.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mage\Task\BuiltIn\Symfony;
use Symfony\Component\Process\Process;
/**
* Symfony Task - Clear Cache
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
2017-04-14 20:43:27 +02:00
class CacheClearTask extends AbstractSymfonyTask
2016-12-31 07:52:25 +01:00
{
2022-04-10 06:20:03 +02:00
public function getName(): string
2016-12-31 07:52:25 +01:00
{
return 'symfony/cache-clear';
}
2022-04-10 06:20:03 +02:00
public function getDescription(): string
2016-12-31 07:52:25 +01:00
{
return '[Symfony] Cache Clear';
}
2022-04-10 06:20:03 +02:00
public function execute(): bool
2016-12-31 07:52:25 +01:00
{
$options = $this->getOptions();
$command = $options['console'] . ' cache:clear --env=' . $options['env'] . ' ' . $options['flags'];
/** @var Process $process */
$process = $this->runtime->runCommand(trim($command));
2016-12-31 07:52:25 +01:00
return $process->isSuccessful();
}
}