diff --git a/taskman.inc.php b/taskman.inc.php index 2a27f60..cc9473f 100644 --- a/taskman.inc.php +++ b/taskman.inc.php @@ -293,11 +293,7 @@ function _get_task_candidates() //get tasks defined as closures foreach($TASKMAN_CLOSURES as $name => $args) - { - if(isset($cands[$name])) - throw new Exception("Task '$name' is already defined"); $cands[$name] = $args; - } ksort($cands); @@ -385,6 +381,10 @@ function task($name) { global $TASKMAN_CLOSURES; + //TODO: can it be a feature? + if(isset($TASKMAN_CLOSURES[$name])) + throw new TaskmanException("Task '$name' is already defined"); + $args = func_get_args(); $TASKMAN_CLOSURES[$name] = $args; }