mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-08-28 10:08:56 +02:00
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:
@@ -5,21 +5,22 @@ class Mage_Task_Factory
|
||||
*
|
||||
*
|
||||
* @param string $taskName
|
||||
* @param boolean $inRollback
|
||||
* @return Mage_Task_TaskAbstract
|
||||
*/
|
||||
public static function get($taskName, Mage_Config $taskConfig)
|
||||
public static function get($taskName, Mage_Config $taskConfig, $inRollback = false)
|
||||
{
|
||||
$instance = null;
|
||||
|
||||
if (strpos($taskName, '/') === false) {
|
||||
Mage_Autoload::loadUserTask($taskName);
|
||||
$className = 'Task_' . ucfirst($taskName);
|
||||
$instance = new $className($taskConfig);
|
||||
$instance = new $className($taskConfig, $inRollback);
|
||||
|
||||
} else {
|
||||
$taskName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $taskName)));
|
||||
$className = 'Mage_Task_BuiltIn_' . $taskName;
|
||||
$instance = new $className($taskConfig);
|
||||
$instance = new $className($taskConfig, $inRollback);
|
||||
}
|
||||
|
||||
assert($instance instanceOf Mage_Task_TaskAbstract);
|
||||
|
||||
Reference in New Issue
Block a user