• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/update/update229000.php
  • Класс: BitrixImopenlinesUpdateUpdate229000
  • Вызов: Update229000::execute
public function execute(array &$option): bool
{
	$return = Stepper::FINISH_EXECUTION;

	if (Loader::includeModule(self::$moduleId))
	{
		$stepVars = Option::get(self::$moduleId, self::OPTION_NAME, '');
		$stepVars = ($stepVars !== '' ? @unserialize($stepVars, ['allowed_classes' => false]) : []);
		$stepVars = (is_array($stepVars) ? $stepVars : []);
		if (empty($stepVars))
		{
			$stepVars = [
				'number' => 0,
				'count' => Correction::getCountChatSessionId(),
			];
		}

		if ($stepVars['count'] > 0)
		{
			$option['count'] = $stepVars['count'];

			$resultCorrectionSession = Correction::restoreChatSessionId(true, 100);

			if (count($resultCorrectionSession) > 0)
			{
				$stepVars['number'] += count($resultCorrectionSession);

				Option::set(self::$moduleId, self::OPTION_NAME, serialize($stepVars));
				$return = Stepper::CONTINUE_EXECUTION;
			}
			else
			{
				Option::delete(self::$moduleId, ["name" => self::OPTION_NAME]);
			}

			$option['progress'] = round($stepVars['number'] * 100 / $stepVars['count']);
			$option['steps'] = $stepVars['number'];
		}
		else
		{
			Option::delete(self::$moduleId, ["name" => self::OPTION_NAME]);
		}
	}

	return $return;
}