/usr/share/php/Doctrine/Bundle/DoctrineCacheBundle/Command/StatsCommand.php is in php-doctrine-cache-bundle 1.3.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | <?php
namespace Doctrine\Bundle\DoctrineCacheBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Get stats from cache provider.
*
* @author Alan Doucette <dragonwize@gmail.com>
*/
class StatsCommand extends CacheCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('doctrine:cache:stats')
->setDescription('Get stats on a given cache provider')
->addArgument('cache-name', InputArgument::REQUIRED, 'For which cache provider would you like to get stats?');
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$cacheName = $input->getArgument('cache-name');
$cacheProvider = $this->getCacheProvider($cacheName);
$cacheProviderName = get_class($cacheProvider);
$stats = $cacheProvider->getStats();
if ($stats === null) {
$output->writeln(sprintf('Stats were not provided for the <info>%s</info> provider of type <info>%s</info>', $cacheName, $cacheProviderName, true));
return;
}
$formatter = $this->getHelperSet()->get('formatter');
$lines = array();
foreach ($stats as $key => $stat) {
$lines[] = $formatter->formatSection($key, $stat);
}
$output->writeln(sprintf('Stats for the <info>%s</info> provider of type <info>%s</info>:', $cacheName, $cacheProviderName, true));
$output->writeln($lines);
}
}
|