本文整理汇总了PHP中VTTaskManager::performTasks方法的典型用法代码示例。如果您正苦于以下问题:PHP VTTaskManager::performTasks方法的具体用法?PHP VTTaskManager::performTasks怎么用?PHP VTTaskManager::performTasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTTaskManager
的用法示例。
在下文中一共展示了VTTaskManager::performTasks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queueScheduledWorkflowTasks
public function queueScheduledWorkflowTasks()
{
global $default_timezone;
$adb = $this->db;
$vtWorflowManager = new VTWorkflowManager($adb);
$entityCache = new VTEntityCache($this->user);
// set the time zone to the admin's time zone, this is needed so that the scheduled workflow will be triggered
// at admin's time zone rather than the systems time zone. This is specially needed for Hourly and Daily scheduled workflows
$admin = Users::getActiveAdminUser();
$adminTimeZone = $admin->time_zone;
@date_default_timezone_set($adminTimeZone);
$currentTimestamp = date("Y-m-d H:i:s");
@date_default_timezone_set($default_timezone);
$scheduledWorkflows = $vtWorflowManager->getScheduledWorkflows($currentTimestamp);
$noOfScheduledWorkflows = count($scheduledWorkflows);
for ($i = 0; $i < $noOfScheduledWorkflows; ++$i) {
$workflow = $scheduledWorkflows[$i];
if ($workflow->active != 1) {
continue;
}
$tm = new VTTaskManager($adb);
$tasks = $tm->getTasksForWorkflow($workflow->id);
if ($tasks) {
$records = $this->getEligibleWorkflowRecords($workflow);
$noOfRecords = count($records);
for ($j = 0; $j < $noOfRecords; ++$j) {
$recordId = $records[$j];
// We need to pass proper module name to get the webservice
if ($workflow->moduleName == 'Calendar') {
$moduleName = vtws_getCalendarEntityType($recordId);
} else {
$moduleName = $workflow->moduleName;
}
$wsEntityId = vtws_getWebserviceEntityId($moduleName, $recordId);
$entityData = $entityCache->forId($wsEntityId);
$tm->performTasks($entityData, false);
}
}
$vtWorflowManager->updateNexTriggerTime($workflow);
}
$scheduledWorkflows = null;
}