Skip to content

Commit

Permalink
queue settings
Browse files Browse the repository at this point in the history
  • Loading branch information
phphleb committed Dec 13, 2024
1 parent d920d82 commit ad61bb5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions HlebQueueBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
use Hleb\Base\RollbackInterface;
use Hleb\Base\Task;
use Hleb\Constructor\Data\DebugAnalytics;
use Hleb\Constructor\Data\SystemSettings;
use Hleb\Init\ErrorLog;
use Hleb\Main\Logger\Log;
use Hleb\Main\Logger\LoggerInterface;
use Hleb\Constructor\Attributes\Accessible;
use Hleb\Constructor\Attributes\AvailableAsParent;
use Hleb\Main\Logger\LogLevel;
use Throwable;

/**
Expand Down Expand Up @@ -149,6 +152,8 @@ public function load(?string $commandClass = null, array $arguments = []): int
$status = true;

try {
$this->loadSettings();

$command = new $commandClass();

$status = $command->call($arguments, strictVerbosity: $this->verbosity);
Expand Down Expand Up @@ -230,4 +235,20 @@ public function errorLog(Throwable $e): void
\error_log((string)$t);
}
}

/**
* Simplified project assembly.
*
* Упрощённая сборка проекта.
*/
protected function loadSettings(): void
{
$startTime = \defined('HLEB_START') ? HLEB_START : \microtime(true);
$this->config['system']['start.unixtime'] = $startTime;
SystemSettings::setStartTime($startTime);
$this->logger and Log::setLogger($this->logger);
LogLevel::setDefaultMaxLogLevel(SystemSettings::getCommonValue('max.log.level'));
\date_default_timezone_set($this->config['common']['timezone']);
\ini_set('display_errors', $this->config['common']['debug'] ? '1' : '0');
}
}

0 comments on commit ad61bb5

Please sign in to comment.