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: ".htmlspecialchars($Message)." " ."FILE: ".$File." " ."LINE: ".$Line; } } return $CrashInfo; } function GetTaskLinks($Task) { $Links = NULL; $Separator = ""; foreach ($Task["Links"] as $Label => $Link) { $Links .= '' . $Label . ''; } return $Links; } function GetTaskCallbackString($Task) { $CallbackName = GetTaskCallbackName($Task); $CallbackParameterString = GetTaskCallbackParameterString($Task); return $CallbackName . "(" . $CallbackParameterString . ")"; } 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); } $CallbackString = GetTaskCallbackString($Task); $Priority = $PriorityMapping[$TaskPriority]; $TitleAttribute = 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(); $PeriodicEventInfo = $AF->GetKnownPeriodicEvents(); $PeriodicEventCount = count($PeriodicEventInfo); function Compare_PeriodicEventInfo($A, $B) { return ($A["NextRun"] < $B["NextRun"]) ? -1 : 1; } usort($PeriodicEventInfo, "Compare_PeriodicEventInfo"); # 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

# Periodic Events

periodic found

Callback | Frequency | Last Run | Next Queued | Actions
--- | --- | --- | --- | ---

TaskExecutionEnabled()) { ?>