-
Notifications
You must be signed in to change notification settings - Fork 181
/
Copy pathsfPluginUpgradeTask.class.php
65 lines (51 loc) · 1.94 KB
/
sfPluginUpgradeTask.class.php
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
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__.'/sfPluginBaseTask.class.php';
/**
* Upgrades a plugin.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class sfPluginUpgradeTask extends sfPluginBaseTask
{
/**
* @see sfTask
*/
protected function configure()
{
$this->addArguments([
new sfCommandArgument('name', sfCommandArgument::REQUIRED, 'The plugin name'),
]);
$this->addOptions([
new sfCommandOption('stability', 's', sfCommandOption::PARAMETER_REQUIRED, 'The preferred stability (stable, beta, alpha)', null),
new sfCommandOption('release', 'r', sfCommandOption::PARAMETER_REQUIRED, 'The preferred version', null),
new sfCommandOption('channel', 'c', sfCommandOption::PARAMETER_REQUIRED, 'The PEAR channel name', null),
]);
$this->namespace = 'plugin';
$this->name = 'upgrade';
$this->briefDescription = 'Upgrades a plugin';
$this->detailedDescription = <<<'EOF'
The [plugin:upgrade|INFO] task tries to upgrade a plugin:
[./symfony plugin:upgrade sfGuardPlugin|INFO]
The default channel is [symfony|INFO].
If the plugin contains some web content (images, stylesheets or javascripts),
the task also updates the [web/%name%|COMMENT] directory content on Windows.
See [plugin:install|INFO] for more information about the format of the plugin name and options.
EOF;
}
/**
* @see sfTask
*/
protected function execute($arguments = [], $options = [])
{
$this->logSection('plugin', sprintf('upgrading plugin "%s"', $arguments['name']));
$this->getPluginManager()->installPlugin($arguments['name'], $options);
return 0;
}
}