mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-09 14:58:57 +02:00
[Discovery One] Add Cache Pool Task for Symfony, remove Assetic task
This commit is contained in:
+14
-15
@@ -10,45 +10,44 @@
|
||||
|
||||
namespace Mage\Task\BuiltIn\Symfony;
|
||||
|
||||
use Mage\Task\Exception\ErrorException;
|
||||
use Symfony\Component\Process\Process;
|
||||
use Mage\Task\AbstractTask;
|
||||
|
||||
/**
|
||||
* Symfony Task - Dump Assetics
|
||||
* Symfony Task - Cache Pool Clear
|
||||
*
|
||||
* @author Andrés Montañez <andresmontanez@gmail.com>
|
||||
*/
|
||||
class AsseticDumpTask extends AbstractTask
|
||||
class CachePoolClearTask extends AbstractSymfonyTask
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'symfony/assetic-dump';
|
||||
return 'symfony/cache-pool-clear';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return '[Symfony] Assetic Dump';
|
||||
return '[Symfony] Cache Pool Clear';
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = sprintf('%s assetic:dump --env=%s %s', $options['console'], $options['env'], $options['flags']);
|
||||
|
||||
if (!$options['pools']) {
|
||||
throw new ErrorException('Parameter "pools" is not defined');
|
||||
}
|
||||
|
||||
$command = $options['console'] . ' cache:pool:clear --env=' . $options['env'] . ' ' . $options['flags'] . ' ' . $options['pools'];
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand(trim($command), $options['timeout']);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
protected function getSymfonyOptions()
|
||||
{
|
||||
$options = array_merge(
|
||||
['console' => 'bin/console', 'env' => 'dev', 'flags' => '', 'timeout' => 120],
|
||||
$this->runtime->getMergedOption('symfony'),
|
||||
$this->options
|
||||
);
|
||||
|
||||
return $options;
|
||||
return ['pools' => null];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* 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 - Cache Pool Prune
|
||||
*
|
||||
* @author Andrés Montañez <andresmontanez@gmail.com>
|
||||
*/
|
||||
class CachePoolPruneTask extends AbstractSymfonyTask
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'symfony/cache-pool-prune';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return '[Symfony] Cache Pool Prune';
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = $options['console'] . ' cache:pool:prune --env=' . $options['env'] . ' ' . $options['flags'];
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user