Answer the question
In order to leave comments, you need to log in
How to flush cache and update assets from Symfony2 controller?
There is this code in the controller, the purpose of which is to reset the entire cache and update the assets in the prod environment.
public function resetAction()
{
$app_path = $this->container->getParameter('kernel.root_dir') . '/console';
$process = new \Symfony\Component\Process\Process("php $app_path cache:clear --env=prod --no-debug --no-warmup");
$process->run();
$process = new \Symfony\Component\Process\Process("php $app_path assets:install");
$process->run();
$process = new \Symfony\Component\Process\Process("php $app_path assetic:dump --env=prod --no-debug");
$process->run();
return new Response('ok');
}
Answer the question
In order to leave comments, you need to log in
Replace
with
AND it turns out that the code does not work successfully.
Most likely, another php.ini is used.
Compare the output php -i
in the console and like this:
$process = new \Symfony\Component\Process\Process("php -i");
$process->run();
return new Response($process->getOutput());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question