Skip to content

Instantly share code, notes, and snippets.

@yellow1912
Created November 21, 2013 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yellow1912/7588335 to your computer and use it in GitHub Desktop.
Save yellow1912/7588335 to your computer and use it in GitHub Desktop.
just a short snippet to show an issue with pthreads on SF2
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace My\AsseticBundle\Command;
use My\AsseticBundle\Cache\ImageCacheWarmer;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
/**
* Dumps assets to the filesystem.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DumpCommand extends ContainerAwareCommand
{
private $cacheWarmer;
protected function configure()
{
$this
->setName('assetic:dump-images')
->setDescription('Dumps all images to the filesystem');
}
protected function execute(InputInterface $input, OutputInterface $stdout)
{
// capture error output
$stderr = $stdout instanceof ConsoleOutputInterface
? $stdout->getErrorOutput()
: $stdout;
// print the header
$stdout->writeln('Dumping all images.');
foreach ($this->getContainer()->get('My.manager.image')->findAll() as $image) {
$stdout->writeln(basename($image->getPath()));
$cacheWarmer = new ImageCacheWarmer();
$cacheWarmer->start();
}
$stdout->writeln('');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment