2 Commits
9.x ... 10.0

Author SHA1 Message Date
User
91af1ea14f 20250419#2 2025-04-19 18:46:40 +03:00
User
41523e6899 20250419#1 2025-04-19 18:45:41 +03:00
2 changed files with 11 additions and 14 deletions

View File

@@ -10,12 +10,12 @@ Stable version
composer require rmphp/storage
```
```bash
composer require rmphp/storage:"^9.0"
composer require rmphp/storage:"^10.0"
```
Dev version contains the latest changes
```bash
composer require rmphp/storage:"9.x-dev"
composer require rmphp/storage:"10.x-dev"
```

View File

@@ -13,26 +13,23 @@ class MysqlStorage implements MysqlStorageInterface {
private Mysqli $mysqli;
/**
* Внутренний конструктор подключения к БД
* Mysql constructor.
* @param object $params
* @param array $paramsArray
* @throws Exception
*/
public function __construct(
private readonly object $params
) {
public function __construct(array $paramsArray) {
$params = (object) $paramsArray;
$this->mysqli = new mysqli(
$this->params->host,
$this->params->user,
$this->params->pass,
$this->params->base
$params->host,
$params->user,
$params->pass,
$params->base
);
// выводим ошибку при неудачном подключении
if ($this->mysqli->connect_errno) {
throw new Exception($this->mysqli->connect_errno);
}
$this->mysqli->set_charset("utf8");
if(!empty($this->params->logsEnable)) $this->logsEnabled = true;
$this->mysqli->set_charset($params->chartset ?? "utf8");
if(!empty($params->logs)) $this->logsEnabled = true;
}
/** @inheritDoc */