sfPluginUninstallTask.class.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. * Uninstall a plugin.
  12. *
  13. * @package symfony
  14. * @subpackage task
  15. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  16. * @version SVN: $Id: sfPluginUninstallTask.class.php 8474 2008-04-15 22:47:27Z fabien $
  17. */
  18. class sfPluginUninstallTask extends sfPluginBaseTask
  19. {
  20. /**
  21. * @see sfTask
  22. */
  23. protected function configure()
  24. {
  25. $this->addArguments(array(
  26. new sfCommandArgument('name', sfCommandArgument::REQUIRED, 'The plugin name'),
  27. ));
  28. $this->addOptions(array(
  29. new sfCommandOption('channel', 'c', sfCommandOption::PARAMETER_REQUIRED, 'The PEAR channel name', null),
  30. new sfCommandOption('install_deps', 'd', sfCommandOption::PARAMETER_NONE, 'Whether to force installation of dependencies', null),
  31. ));
  32. $this->aliases = array('plugin-uninstall');
  33. $this->namespace = 'plugin';
  34. $this->name = 'uninstall';
  35. $this->briefDescription = 'Uninstalls a plugin';
  36. $this->detailedDescription = <<<EOF
  37. The [plugin:uninstall|INFO] task uninstalls a plugin:
  38. [./symfony plugin:uninstall sfGuardPlugin|INFO]
  39. The default channel is [symfony|INFO].
  40. You can also uninstall a plugin which has a different channel:
  41. [./symfony plugin:uninstall --channel=mypearchannel sfGuardPlugin|INFO]
  42. [./symfony plugin:uninstall -c mypearchannel sfGuardPlugin|INFO]
  43. Or you can use the [channel/package|INFO] notation:
  44. [./symfony plugin:uninstall mypearchannel/sfGuardPlugin|INFO]
  45. You can get the PEAR channel name of a plugin by launching the
  46. [plugin:list] task.
  47. If the plugin contains some web content (images, stylesheets or javascripts),
  48. the task also removes the [web/%name%|COMMENT] symbolic link (on *nix)
  49. or directory (on Windows).
  50. EOF;
  51. }
  52. /**
  53. * @see sfTask
  54. */
  55. protected function execute($arguments = array(), $options = array())
  56. {
  57. $this->logSection('plugin', sprintf('uninstalling plugin "%s"', $arguments['name']));
  58. $this->getPluginManager()->uninstallPlugin($arguments['name'], $options['channel']);
  59. }
  60. }