69 if (empty($params[
'CODE']) || empty($params[
'CALLBACK']))
74 $ss = (int)($params[
'STEP_SIZE'] ?? 0);
75 $order = count($this->stages);
76 $type = (string)($params[
'TYPE'] ??
'');
79 $type = static::CALLBACK_TYPE_MANUAL;
82 $beforeCallback = (string)($params[
'ON_BEFORE_CALLBACK'] ??
'');
83 if ($beforeCallback ===
'')
85 $beforeCallback =
false;
87 $afterCallback = (string)($params[
'ON_AFTER_CALLBACK'] ??
'');
88 if ($afterCallback ===
'')
90 $afterCallback =
false;
94 'STEP_SIZE' => $ss ?: 1,
95 'PERCENT' => (int)($params[
'PERCENT'] ?? 0),
96 'CODE' => $params[
'CODE'],
99 'CALLBACK' => $params[
'CALLBACK'],
100 'SUBPERCENT_CALLBACK' => $params[
'SUBPERCENT_CALLBACK'] ??
null,
101 'ON_BEFORE_CALLBACK' => $beforeCallback,
102 'ON_AFTER_CALLBACK' => $afterCallback,
104 $this->stagesByCode[$params[
'CODE']] =& $this->stages[count($this->stages) - 1];
143 if($this->stage == 0 && $this->step == 0)
147 if(static::DEBUG_MODE)
150 if(!file_exists($logDir))
151 mkdir($logDir, 755,
true);
153 $this->
logMessage(
'PROCESS STARTED, STAGE '.$this->stages[0][
'CODE']);
159 if(!isset($this->stages[$this->stage]))
162 if(self::JUST_SHOW_STAGES)
168 if($this->stages[
$stage][
'ON_BEFORE_CALLBACK'] !=
false)
169 call_user_func(array($this, $this->stages[
$stage][
'ON_BEFORE_CALLBACK']));
171 if($this->stages[$this->stage][
'TYPE'] == static::CALLBACK_TYPE_MANUAL)
172 call_user_func(array($this, $this->stages[$this->stage][
'CALLBACK']));
173 elseif($this->stages[$this->stage][
'TYPE'] == static::CALLBACK_TYPE_QUOTA)
177 $result = call_user_func(array($this, $this->stages[$this->stage][
'CALLBACK']));
188 if($this->stages[
$stage][
'ON_AFTER_CALLBACK'] !=
false)
189 call_user_func(array($this, $this->stages[
$stage][
'ON_AFTER_CALLBACK']));