• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Debugger/Session/Session.php
  • Класс: BitrixBizprocDebuggerSessionSession
  • Вызов: Session::killWorkflows
private function killWorkflows()
{
	$workflowContexts = $this->getWorkflowContexts();

	if ($workflowContexts)
	{
		foreach ($workflowContexts as $context)
		{
			CBPDocument::killWorkflow($context->getWorkflowId());

			$shouldSaveTemplateShards = (bool)DebuggerSessionWorkflowContextTable::getList([
				'filter' => [
					'!=ID' => $context->getId(),
					'TEMPLATE_SHARDS_ID' => $context->getTemplateShardsId(),
				],
				'limit' => 1,
			])->fetchObject();

			if (!$shouldSaveTemplateShards)
			{
				$shards = $context->fillTemplateShards();
				if ($shards)
				{
					$shards->delete();
				}
			}

			$context->delete();
		}
	}
}