/usr/share/php/Symfony/Bundle/FrameworkBundle/Command/RouterApacheDumperCommand.php is in php-symfony-framework-bundle 2.8.7+dfsg-1.3+deb9u1.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper;
use Symfony\Component\Routing\RouterInterface;
/**
* RouterApacheDumperCommand.
*
* @deprecated since version 2.5, to be removed in 3.0.
* The performance gains are minimal and it's very hard to replicate
* the behavior of PHP implementation.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class RouterApacheDumperCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
if (!$this->getContainer()->has('router')) {
return false;
}
$router = $this->getContainer()->get('router');
if (!$router instanceof RouterInterface) {
return false;
}
return parent::isEnabled();
}
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('router:dump-apache')
->setDefinition(array(
new InputArgument('script_name', InputArgument::OPTIONAL, 'The script name of the application\'s front controller'),
new InputOption('base-uri', null, InputOption::VALUE_REQUIRED, 'The base URI'),
))
->setDescription('[DEPRECATED] Dumps all routes as Apache rewrite rules')
->setHelp(<<<'EOF'
The <info>%command.name%</info> dumps all routes as Apache rewrite rules.
These can then be used with the ApacheUrlMatcher to use Apache for route
matching.
<info>php %command.full_name%</info>
EOF
)
;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Router Apache Dumper');
$io->caution('The router:dump-apache command is deprecated since version 2.5 and will be removed in 3.0.');
$router = $this->getContainer()->get('router');
$dumpOptions = array();
if ($input->getArgument('script_name')) {
$dumpOptions['script_name'] = $input->getArgument('script_name');
}
if ($input->getOption('base-uri')) {
$dumpOptions['base_uri'] = $input->getOption('base-uri');
}
$dumper = new ApacheMatcherDumper($router->getRouteCollection());
$io->writeln($dumper->dump($dumpOptions), OutputInterface::OUTPUT_RAW);
}
}
|