• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/util/process.php
  • Класс: BitrixSaleLocationUtilProcess
  • Вызов: Process::performIteration
public function performIteration()
{
	if($this->stage == 0 && $this->step == 0)
	{
		$this->lockProcess();

		if(static::DEBUG_MODE)
		{
			$logDir = $this->getLogFileDir();
			if(!file_exists($logDir))
				mkdir($logDir, 755, true);

			$this->logMessage('PROCESS STARTED, STAGE '.$this->stages[0]['CODE']);
		}
	}

	$this->onBeforePerformIteration();

	if(!isset($this->stages[$this->stage]))
		throw new MainSystemException('No more stages to perform');

	if(self::JUST_SHOW_STAGES)
		$this->nextStage();
	else
	{
		$stage = $this->stage;

		if($this->stages[$stage]['ON_BEFORE_CALLBACK'] != false)
			call_user_func(array($this, $this->stages[$stage]['ON_BEFORE_CALLBACK']));

		if($this->stages[$this->stage]['TYPE'] == static::CALLBACK_TYPE_MANUAL)
			call_user_func(array($this, $this->stages[$this->stage]['CALLBACK']));
		elseif($this->stages[$this->stage]['TYPE'] == static::CALLBACK_TYPE_QUOTA)
		{
			while($this->checkQuota())
			{
				$result = call_user_func(array($this, $this->stages[$this->stage]['CALLBACK']));
				$this->nextStep();

				if($result)
					break;
			}

			if($result)
				$this->nextStage();
		}

		if($this->stages[$stage]['ON_AFTER_CALLBACK'] != false)
			call_user_func(array($this, $this->stages[$stage]['ON_AFTER_CALLBACK']));
	}

	$this->onAfterPerformIteration();
	$percent = $this->getPercent();

	$this->saveMemoryPeak();

	$this->logMessage('HIT ENDED '.$this->getTimeStampString(), false);

	if($percent == 100)
		$this->unLockProcess();

	return $percent;
}