mirror of
https://github.com/hauke68/Magallanes.git
synced 2025-08-25 21:00:18 +02:00
Tasks are aware if they are in rollbacks; they will be invoked only if they implement the new interface RollbackAware.
29 lines
855 B
PHP
29 lines
855 B
PHP
<?php
|
|
class Mage_Task_Factory
|
|
{
|
|
/**
|
|
*
|
|
*
|
|
* @param string $taskName
|
|
* @param boolean $inRollback
|
|
* @return Mage_Task_TaskAbstract
|
|
*/
|
|
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, $inRollback);
|
|
|
|
} else {
|
|
$taskName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $taskName)));
|
|
$className = 'Mage_Task_BuiltIn_' . $taskName;
|
|
$instance = new $className($taskConfig, $inRollback);
|
|
}
|
|
|
|
assert($instance instanceOf Mage_Task_TaskAbstract);
|
|
return $instance;
|
|
}
|
|
} |