GetCallbackAsText(); } else { $Name = get_class($Callback[0]) . "::" . $Callback[1]; } } else { $Name= $Callback[0] . "::" . $Callback[1]; } } return $Name; } function GetTaskCallbackParameterString($Task) { $Parameters = $Task["Parameters"]; $String = NULL; if (is_array($Parameters)) { $Separator = ""; foreach ($Parameters as $Parameter) { $String .= $Separator; if (is_int($Parameter) || is_float($Parameter)) { $String .= $Parameter; } else if (is_string($Parameter)) { $String .= "\"".htmlspecialchars($Parameter)."\""; } else if (is_array($Parameter)) { $String .= "ARRAY"; } else if (is_object($Parameter)) { $String .= "OBJECT"; } else if (is_null($Parameter)) { $String .= "NULL"; } else if (is_bool($Parameter)) { $String .= $Parameter ? "TRUE" : "FALSE"; } else if (is_resource($Parameter)) { $String .= get_resource_type($Parameter); } else { $String .= "????"; } $Separator = ", "; } } return $String; } function GetTaskCrashInfo($Task) { $CrashInfo = NULL; if (isset($Task["CrashInfo"])) { $CrashData = unserialize($Task["CrashInfo"]); if (isset($CrashData["LastError"])) { $Error = $CrashData["LastError"]; $File = preg_replace(":".getcwd()."/:", "", $Error["file"]); $Message = $Error["message"]; $Line = $Error["line"]; $CrashInfo = "ERROR: ".$Message." FILE: ".$File." LINE: ".$Line; } } return $CrashInfo; } function GetTaskLinks($Task) { $Links = NULL; $Separator = ""; foreach ($Task["Links"] as $Label => $Link) { $Links .= '' . $Label . ''; } return $Links; } function DisplayTask($Task, $DisplayStartedAt=FALSE, $DisplayLinks=FALSE) { $PriorityMapping = array( ApplicationFramework::PRIORITY_HIGH => "High", ApplicationFramework::PRIORITY_MEDIUM => "Medium", ApplicationFramework::PRIORITY_LOW => "Low", ApplicationFramework::PRIORITY_BACKGROUND => "Bkgrnd"); $TaskId = $Task["TaskId"]; $TaskPriority = $Task["Priority"]; $TaskDescription = $Task["Description"]; if ($DisplayStartedAt) { $TaskStartedAt = $Task["StartedAt"]; $StartFormat = (date("n/j", strtotime($TaskStartedAt)) == date("n/j")) ? "G:i:s" : "D n/j G:i:s"; } if ($DisplayLinks) { $Links = GetTaskLinks($Task); } $CallbackName = GetTaskCallbackName($Task); $CallbackParameterString = GetTaskCallbackParameterString($Task); $CallbackString = $CallbackName . " (" . $CallbackParameterString . ")"; $Priority = $PriorityMapping[$TaskPriority]; $TitleAttribute = htmlspecialchars(GetTaskCrashInfo($Task)); $Description = strip_tags($TaskDescription, ""); ?>

Task ID | Callback | Description | Priority | Started | Actions
--- | --- | --- | --- | --- | ---
0) { ?>

GetRunningTaskList(); $RunningTaskCount = count($RunningTasks); $QueuedTasks = $AF->GetQueuedTaskList($MaxTasksToDisplay); $QueuedTaskCount = $AF->GetTaskQueueSize(); $OrphanedTasks = $AF->GetOrphanedTaskList($MaxTasksToDisplay); $OrphanedTaskCount = $AF->GetOrphanedTaskCount(); # add links to queued task info foreach ($QueuedTasks as $TaskId => $Task) { $QueuedTasks[$TaskId]["Links"] = array( "Del" => "index.php?P=TaskQueue&ID=".$TaskId."&AC=DELETE", "Run" => "index.php?P=TaskQueue&ID=".$TaskId."&AC=RUN"); } # add links to orphaned task info foreach ($OrphanedTasks as $TaskId => $Task) { $OrphanedTasks[$TaskId]["Links"] = array( "Que" => "index.php?P=TaskQueue&ID=".$TaskId."&AC=REQUEUE", "Del" => "index.php?P=TaskQueue&ID=".$TaskId."&AC=DELETE", "Run" => "index.php?P=TaskQueue&ID=".$TaskId."&AC=RUN"); } ?>

# Running Tasks

Automatic Task Execution Enabled: TaskExecutionEnabled()) { print "checked"; } ?> onchange="this.form.submit();">

currently running

# Queued Tasks

currently queued count($QueuedTasks)) { print " (first ".$MaxTasksToDisplay." displayed)"; } ?>

0) { ?>

# Orphaned Tasks

currently orphaned count($OrphanedTasks)) { print " (first ".$MaxTasksToDisplay." displayed)"; } ?> Requeue All

TaskExecutionEnabled()) { ?>