function ProcessAllTask() { global $DB, $APPLICATION; $uniq = $APPLICATION->GetServerUniqID(); $uniq = "X" . $uniq . "_controller_all_task"; if (!CControllerAgent::_Lock($uniq)) { return false; } $dbrTask = CControllerTask::GetList(array("ID" => "ASC"), array("=STATUS" => array('N', 'P'))); while ($arTask = $dbrTask->Fetch()) { CControllerTask::ProcessTask($arTask["ID"]); } CControllerAgent::_UnLock($uniq); return true; }
while ($arTask = $dbrTask->Fetch()) { $status = CControllerTask::ProcessTask($arTask["ID"]); if ($status === "0" && ($e = $APPLICATION->GetException())) { $strError = GetMessage("CTRLR_TASK_ERR_LOCK") . "<br>" . $e->GetString(); if (strpos($strError, "PLS-00201") !== false && strpos($strError, "'DBMS_LOCK'") !== false) { $strError .= "<br>" . GetMessage("CTRLR_TASK_ERR_LOCK_ADVICE"); } $APPLICATION->ResetException(); break; } $iCntExecuted++; $iAvgExecTime = (getmicrotime() - $tTasksTime) / $iCntExecuted; //if(getmicrotime() - $tBeginTime + 1.5 * $iAvgExecTime > $iStepSize) break; while ($status == "P") { $status = CControllerTask::ProcessTask($arTask["ID"]); if (getmicrotime() - $tBeginTime + 1.5 * $iAvgExecTime > $iStepSize) { break; } } } if (strlen($strError)) { CAdminMessage::ShowMessage($strError); } else { CAdminMessage::ShowMessage(array("TYPE" => "PROGRESS", "MESSAGE" => GetMessage("CTRLR_TASK_PROGRESS"), "DETAILS" => GetMessage("CTRLR_TASK_PROGRESS_BAR") . " {$iCntExecuted} " . GetMessage("CTRLR_TASK_PROGRESS_BAR_FROM") . " {$iCntTotal} #PROGRESS_BAR#", "HTML" => true, "PROGRESS_TOTAL" => $iCntTotal, "PROGRESS_VALUE" => $iCntExecuted)); ?> <script> Start(<?php echo $iCntTotal; ?> , <?php
public static function ProcessAllTask() { $dbrTask = CControllerTask::GetList(array("ID" => "ASC"), array("=STATUS" => array('N', 'P'))); while ($arTask = $dbrTask->Fetch()) { CControllerTask::ProcessTask($arTask["ID"]); } return true; }