sfPluginListTask.class.php 1.7 KB

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