Rollback awareness.

Tasks are aware if they are in rollbacks; they will be invoked only if
they implement the new interface RollbackAware.
This commit is contained in:
Andrs Montaez
2012-01-03 23:25:42 -02:00
parent 01cbd0e447
commit 9cf720c602
9 changed files with 70 additions and 23 deletions
@@ -20,4 +20,6 @@ tasks:
- scm/update
on-deploy:
- privileges
- sampleTask
- sampleTaskRollbackAware
#post-deploy:
@@ -10,4 +10,6 @@ tasks:
- scm/update
on-deploy:
- privileges
- sampleTask
- sampleTaskRollbackAware
#post-deploy:
@@ -0,0 +1,14 @@
<?php
class Task_SampleTask
extends Mage_Task_TaskAbstract
{
public function getName()
{
return 'A Sample Task';
}
public function run()
{
return true;
}
}
@@ -0,0 +1,19 @@
<?php
class Task_SampleTaskRollbackAware
extends Mage_Task_TaskAbstract
implements Mage_Task_Releases_RollbackAware
{
public function getName()
{
if ($this->inRollback()) {
return 'A Sample Task aware of rollbacks [in rollback]';
} else {
return 'A Sample Task aware of rollbacks [not in rollback]';
}
}
public function run()
{
return true;
}
}