| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
require_once(dirname(__FILE__).'/sfPluginBaseTask.class.php'); |
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
class sfPluginUpgradeTask extends sfPluginBaseTask |
|---|
| 22 |
{ |
|---|
| 23 |
|
|---|
| 24 |
* @see sfTask |
|---|
| 25 |
*/ |
|---|
| 26 |
protected function configure() |
|---|
| 27 |
{ |
|---|
| 28 |
$this->addArguments(array( |
|---|
| 29 |
new sfCommandArgument('name', sfCommandArgument::REQUIRED, 'The plugin name'), |
|---|
| 30 |
)); |
|---|
| 31 |
|
|---|
| 32 |
$this->addOptions(array( |
|---|
| 33 |
new sfCommandOption('stability', 's', sfCommandOption::PARAMETER_REQUIRED, 'The preferred stability (stable, beta, alpha)', null), |
|---|
| 34 |
new sfCommandOption('release', 'r', sfCommandOption::PARAMETER_REQUIRED, 'The preferred version', null), |
|---|
| 35 |
new sfCommandOption('channel', 'c', sfCommandOption::PARAMETER_REQUIRED, 'The PEAR channel name', null), |
|---|
| 36 |
)); |
|---|
| 37 |
|
|---|
| 38 |
$this->aliases = array('plugin-upgrade'); |
|---|
| 39 |
$this->namespace = 'plugin'; |
|---|
| 40 |
$this->name = 'upgrade'; |
|---|
| 41 |
|
|---|
| 42 |
$this->briefDescription = 'Upgrades a plugin'; |
|---|
| 43 |
|
|---|
| 44 |
$this->detailedDescription = <<<EOF |
|---|
| 45 |
The [plugin:upgrade|INFO] task tries to upgrade a plugin: |
|---|
| 46 |
|
|---|
| 47 |
[./symfony plugin:upgrade sfGuardPlugin|INFO] |
|---|
| 48 |
|
|---|
| 49 |
The default channel is [symfony|INFO]. |
|---|
| 50 |
|
|---|
| 51 |
If the plugin contains some web content (images, stylesheets or javascripts), |
|---|
| 52 |
the task also updates the [web/%name%|COMMENT] directory content on Windows. |
|---|
| 53 |
|
|---|
| 54 |
See [plugin:install|INFO] for more information about the format of the plugin name and options. |
|---|
| 55 |
EOF; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
* @see sfTask |
|---|
| 60 |
*/ |
|---|
| 61 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 62 |
{ |
|---|
| 63 |
$this->logSection('plugin', sprintf('upgrading plugin "%s"', $arguments['name'])); |
|---|
| 64 |
|
|---|
| 65 |
$this->getPluginManager()->installPlugin($arguments['name'], $options); |
|---|
| 66 |
} |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|