| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
class sfProjectDisableTask extends sfBaseTask |
|---|
| 20 |
{ |
|---|
| 21 |
|
|---|
| 22 |
* @see sfTask |
|---|
| 23 |
*/ |
|---|
| 24 |
protected function configure() |
|---|
| 25 |
{ |
|---|
| 26 |
$this->addArguments(array( |
|---|
| 27 |
new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), |
|---|
| 28 |
new sfCommandArgument('env', sfCommandArgument::REQUIRED, 'The environment name'), |
|---|
| 29 |
)); |
|---|
| 30 |
|
|---|
| 31 |
$this->aliases = array('disable'); |
|---|
| 32 |
$this->namespace = 'project'; |
|---|
| 33 |
$this->name = 'disable'; |
|---|
| 34 |
$this->briefDescription = 'Disables an application in a given environment'; |
|---|
| 35 |
|
|---|
| 36 |
$this->detailedDescription = <<<EOF |
|---|
| 37 |
The [project:disable|INFO] task disables an application for a specific environment: |
|---|
| 38 |
|
|---|
| 39 |
[./symfony project:disable frontend prod|INFO] |
|---|
| 40 |
EOF; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
* @see sfTask |
|---|
| 45 |
*/ |
|---|
| 46 |
protected function execute($arguments = array(), $options = array()) |
|---|
| 47 |
{ |
|---|
| 48 |
$app = $arguments['application']; |
|---|
| 49 |
$env = $arguments['env']; |
|---|
| 50 |
|
|---|
| 51 |
$lockFile = sfConfig::get('sf_data_dir').'/'.$app.'_'.$env.'.lck'; |
|---|
| 52 |
if (file_exists($lockFile)) |
|---|
| 53 |
{ |
|---|
| 54 |
$this->logSection('enable', sprintf('%s [%s] is currently DISABLED', $app, $env)); |
|---|
| 55 |
} |
|---|
| 56 |
else |
|---|
| 57 |
{ |
|---|
| 58 |
$this->getFilesystem()->touch($lockFile); |
|---|
| 59 |
|
|---|
| 60 |
$this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); |
|---|
| 61 |
} |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|