| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfUpgradeTo13Task extends sfBaseTask |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* @see sfTask |
|---|
| 23 |
*/ |
|---|
| 24 |
protected function configure() |
|---|
| 25 |
{ |
|---|
| 26 |
$this->namespace = 'project'; |
|---|
| 27 |
$this->name = 'upgrade1.3'; |
|---|
| 28 |
$this->briefDescription = 'Upgrade a symfony project to the 1.3 symfony release (from 1.2)'; |
|---|
| 29 |
|
|---|
| 30 |
$this->detailedDescription = <<<EOF |
|---|
| 31 |
The [project:upgrade1.3|INFO] task upgrades a symfony project based on the 1.2 |
|---|
| 32 |
release to the 1.3 symfony release. |
|---|
| 33 |
|
|---|
| 34 |
[./symfony project:upgrade1.3|INFO] |
|---|
| 35 |
|
|---|
| 36 |
Please read the UPGRADE_TO_1_3 file to have information on what this task does. |
|---|
| 37 |
EOF; |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
* @see sfTask |
|---|
| 42 |
*/ |
|---|
| 43 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 44 |
{ |
|---|
| 45 |
foreach ($this->getUpgradeClasses() as $class) |
|---|
| 46 |
{ |
|---|
| 47 |
$this->logSection('upgrade', strtolower(str_replace(array('sf', 'Upgrade'), '', $class))); |
|---|
| 48 |
|
|---|
| 49 |
$upgrader = new $class($this->dispatcher, $this->formatter); |
|---|
| 50 |
$upgrader->setCommandApplication($this->commandApplication); |
|---|
| 51 |
$upgrader->setConfiguration($this->configuration); |
|---|
| 52 |
$upgrader->upgrade(); |
|---|
| 53 |
} |
|---|
| 54 |
|
|---|
| 55 |
$this->logSection('upgrade', 'complete!'); |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
protected function getUpgradeClasses() |
|---|
| 59 |
{ |
|---|
| 60 |
$baseDir = dirname(__FILE__).'/upgrade1.3/'; |
|---|
| 61 |
$classes = array(); |
|---|
| 62 |
|
|---|
| 63 |
foreach (glob($baseDir.'*.class.php') as $file) |
|---|
| 64 |
{ |
|---|
| 65 |
$class = str_replace(array($baseDir, '.class.php'), '', $file); |
|---|
| 66 |
|
|---|
| 67 |
if ('sfUpgrade' != $class) |
|---|
| 68 |
{ |
|---|
| 69 |
$classes[] = $class; |
|---|
| 70 |
|
|---|
| 71 |
require_once $baseDir.$class.'.class.php'; |
|---|
| 72 |
} |
|---|
| 73 |
} |
|---|
| 74 |
|
|---|
| 75 |
return $classes; |
|---|
| 76 |
} |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|