| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
require_once(dirname(__FILE__).'/sfPluginBaseTask.class.php');
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* Lists installed plugins.
|
|
|
15 |
*
|
|
|
16 |
* @package symfony
|
|
|
17 |
* @subpackage task
|
|
|
18 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
19 |
* @version SVN: $Id: sfPluginListTask.class.php 23922 2009-11-14 14:58:38Z fabien $
|
|
|
20 |
*/
|
|
|
21 |
class sfPluginListTask extends sfPluginBaseTask
|
|
|
22 |
{
|
|
|
23 |
/**
|
|
|
24 |
* @see sfTask
|
|
|
25 |
*/
|
|
|
26 |
protected function configure()
|
|
|
27 |
{
|
|
|
28 |
$this->namespace = 'plugin';
|
|
|
29 |
$this->name = 'list';
|
|
|
30 |
|
|
|
31 |
$this->briefDescription = 'Lists installed plugins';
|
|
|
32 |
|
|
|
33 |
$this->detailedDescription = <<<EOF
|
|
|
34 |
The [plugin:list|INFO] task lists all installed plugins:
|
|
|
35 |
|
|
|
36 |
[./symfony plugin:list|INFO]
|
|
|
37 |
|
|
|
38 |
It also gives the channel and version for each plugin.
|
|
|
39 |
EOF;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* @see sfTask
|
|
|
44 |
*/
|
|
|
45 |
protected function execute($arguments = array(), $options = array())
|
|
|
46 |
{
|
|
|
47 |
$this->log($this->formatter->format('Installed plugins:', 'COMMENT'));
|
|
|
48 |
|
|
|
49 |
foreach ($this->getPluginManager()->getInstalledPlugins() as $package)
|
|
|
50 |
{
|
|
|
51 |
$alias = $this->getPluginManager()->getEnvironment()->getRegistry()->getChannel($package->getChannel())->getAlias();
|
|
|
52 |
$this->log(sprintf(' %-40s %10s-%-6s %s', $this->formatter->format($package->getPackage(), 'INFO'), $package->getVersion(), $package->getState() ? $package->getState() : null, $this->formatter->format(sprintf('# %s (%s)', $package->getChannel(), $alias), 'COMMENT')));
|
|
|
53 |
}
|
|
|
54 |
}
|
|
|
55 |
}
|