改名
This commit is contained in:
+29
-25
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
|||||||
namespace Database;
|
namespace Database;
|
||||||
|
|
||||||
|
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Database\Mysql\Schema;
|
use Database\Mysql\Schema;
|
||||||
@@ -69,7 +69,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::RELEASE_ALL, [$this, 'disconnect']);
|
$event->on(Event::RELEASE_ALL, [$this, 'disconnect']);
|
||||||
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'clear_connection']);
|
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'clear_connection']);
|
||||||
}
|
}
|
||||||
@@ -85,7 +85,7 @@ class Connection extends Component
|
|||||||
}
|
}
|
||||||
$this->beginTransaction();
|
$this->beginTransaction();
|
||||||
|
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Connection::TRANSACTION_COMMIT, [$this, 'commit'], false, true);
|
$event->on(Connection::TRANSACTION_COMMIT, [$this, 'commit'], false, true);
|
||||||
$event->on(Connection::TRANSACTION_ROLLBACK, [$this, 'rollback'], false, true);
|
$event->on(Connection::TRANSACTION_ROLLBACK, [$this, 'rollback'], false, true);
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function getConnect($sql = NULL): PDO
|
public function getConnect($sql = NULL): PDO
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
$connections->initConnections($this->cds, true, $this->maxNumber);
|
$connections->initConnections($this->cds, true, $this->maxNumber);
|
||||||
$connections->initConnections($this->slaveConfig['cds'], false, $this->maxNumber);
|
$connections->initConnections($this->slaveConfig['cds'], false, $this->maxNumber);
|
||||||
$connections->setTimeout($this->timeout);
|
$connections->setTimeout($this->timeout);
|
||||||
@@ -108,10 +108,11 @@ class Connection extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化 Channel
|
* 初始化 Channel
|
||||||
|
* @throws ComponentException
|
||||||
*/
|
*/
|
||||||
public function fill()
|
public function fill()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
$connections->initConnections($this->cds, true, $this->maxNumber);
|
$connections->initConnections($this->cds, true, $this->maxNumber);
|
||||||
$connections->initConnections($this->slaveConfig['cds'], false, $this->maxNumber);
|
$connections->initConnections($this->slaveConfig['cds'], false, $this->maxNumber);
|
||||||
}
|
}
|
||||||
@@ -152,7 +153,7 @@ class Connection extends Component
|
|||||||
* @param $sql
|
* @param $sql
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isWrite($sql): bool
|
#[Pure] public function isWrite($sql): bool
|
||||||
{
|
{
|
||||||
if (empty($sql)) return false;
|
if (empty($sql)) return false;
|
||||||
|
|
||||||
@@ -179,13 +180,11 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function masterInstance(): PDO
|
public function masterInstance(): PDO
|
||||||
{
|
{
|
||||||
$config = [
|
return $this->connections()->getConnection([
|
||||||
'cds' => $this->cds,
|
'cds' => $this->cds,
|
||||||
'username' => $this->username,
|
'username' => $this->username,
|
||||||
'password' => $this->password
|
'password' => $this->password
|
||||||
];
|
], true);
|
||||||
$pool = Snowflake::app()->connections;
|
|
||||||
return $pool->getConnection($config, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -194,12 +193,20 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function slaveInstance(): PDO
|
public function slaveInstance(): PDO
|
||||||
{
|
{
|
||||||
if (empty($this->slaveConfig)) {
|
if (empty($this->slaveConfig) || $this->slaveConfig['cds'] == $this->cds) {
|
||||||
return $this->masterInstance();
|
return $this->masterInstance();
|
||||||
}
|
}
|
||||||
|
return $this->connections()->getConnection($this->slaveConfig, false);
|
||||||
|
}
|
||||||
|
|
||||||
$connections = Snowflake::app()->connections;
|
|
||||||
return $connections->getConnection($this->slaveConfig, false);
|
/**
|
||||||
|
* @return \Snowflake\Pool\Connection
|
||||||
|
* @throws ComponentException
|
||||||
|
*/
|
||||||
|
private function connections(): \Snowflake\Pool\Connection
|
||||||
|
{
|
||||||
|
return Snowflake::app()->getConnections();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,8 +216,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function beginTransaction(): static
|
public function beginTransaction(): static
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$this->connections()->beginTransaction($this->cds);
|
||||||
$connections->beginTransaction($this->cds);
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,8 +226,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function inTransaction(): bool|static
|
public function inTransaction(): bool|static
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
return $this->connections()->inTransaction($this->cds);
|
||||||
return $connections->inTransaction($this->cds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,8 +235,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function rollback()
|
public function rollback()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$this->connections()->rollback($this->cds);
|
||||||
$connections->rollback($this->cds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -240,8 +244,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function commit()
|
public function commit()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$this->connections()->commit($this->cds);
|
||||||
$connections->commit($this->cds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -287,7 +290,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function release()
|
public function release()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
|
|
||||||
$connections->release($this->cds, true);
|
$connections->release($this->cds, true);
|
||||||
$connections->release($this->slaveConfig['cds'], false);
|
$connections->release($this->slaveConfig['cds'], false);
|
||||||
@@ -296,10 +299,11 @@ class Connection extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 临时回收
|
* 临时回收
|
||||||
|
* @throws ComponentException
|
||||||
*/
|
*/
|
||||||
public function recovery()
|
public function recovery()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
|
|
||||||
$connections->release($this->cds, true);
|
$connections->release($this->cds, true);
|
||||||
$connections->release($this->slaveConfig['cds'], false);
|
$connections->release($this->slaveConfig['cds'], false);
|
||||||
@@ -312,7 +316,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function clear_connection()
|
public function clear_connection()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
|
|
||||||
$connections->release($this->cds, true);
|
$connections->release($this->cds, true);
|
||||||
$connections->release($this->slaveConfig['cds'], false);
|
$connections->release($this->slaveConfig['cds'], false);
|
||||||
@@ -324,7 +328,7 @@ class Connection extends Component
|
|||||||
*/
|
*/
|
||||||
public function disconnect()
|
public function disconnect()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->connections;
|
$connections = $this->connections();
|
||||||
$connections->disconnect($this->cds);
|
$connections->disconnect($this->cds);
|
||||||
$connections->disconnect($this->slaveConfig['cds']);
|
$connections->disconnect($this->slaveConfig['cds']);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -43,7 +43,7 @@ class Db
|
|||||||
*/
|
*/
|
||||||
public static function commit()
|
public static function commit()
|
||||||
{
|
{
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Connection::TRANSACTION_COMMIT);
|
$event->trigger(Connection::TRANSACTION_COMMIT);
|
||||||
$event->offName(Connection::TRANSACTION_COMMIT);
|
$event->offName(Connection::TRANSACTION_COMMIT);
|
||||||
static::$isActive = false;
|
static::$isActive = false;
|
||||||
@@ -54,7 +54,7 @@ class Db
|
|||||||
*/
|
*/
|
||||||
public static function rollback()
|
public static function rollback()
|
||||||
{
|
{
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Connection::TRANSACTION_ROLLBACK);
|
$event->trigger(Connection::TRANSACTION_ROLLBACK);
|
||||||
$event->offName(Connection::TRANSACTION_ROLLBACK);
|
$event->offName(Connection::TRANSACTION_ROLLBACK);
|
||||||
static::$isActive = false;
|
static::$isActive = false;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ abstract class Callback extends Application
|
|||||||
$logger->write($this->_MESSAGE[$message] . $worker_id);
|
$logger->write($this->_MESSAGE[$message] . $worker_id);
|
||||||
$logger->clear();
|
$logger->clear();
|
||||||
|
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->offName(Event::EVENT_AFTER_REQUEST);
|
$event->offName(Event::EVENT_AFTER_REQUEST);
|
||||||
$event->offName(Event::EVENT_BEFORE_REQUEST);
|
$event->offName(Event::EVENT_BEFORE_REQUEST);
|
||||||
$this->eventNotify($message, $event);
|
$this->eventNotify($message, $event);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class OnConnect extends Callback
|
|||||||
*/
|
*/
|
||||||
public function onHandler(\Swoole\Server $server, int $fd, int $reactorId)
|
public function onHandler(\Swoole\Server $server, int $fd, int $reactorId)
|
||||||
{
|
{
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::RECEIVE_CONNECTION, [$server, $fd, $reactorId]);
|
$event->trigger(Event::RECEIVE_CONNECTION, [$server, $fd, $reactorId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class OnManagerStart extends Callback
|
|||||||
$this->debug('manager start.');
|
$this->debug('manager start.');
|
||||||
Snowflake::setWorkerId($server->manager_pid);
|
Snowflake::setWorkerId($server->manager_pid);
|
||||||
|
|
||||||
$events = Snowflake::app()->event;
|
$events = Snowflake::app()->getEvent();
|
||||||
$events->trigger(Event::SERVER_MANAGER_START, null, $server);
|
$events->trigger(Event::SERVER_MANAGER_START, null, $server);
|
||||||
if (Snowflake::isLinux()) {
|
if (Snowflake::isLinux()) {
|
||||||
$prefix = Config::get('id', false, 'system:');
|
$prefix = Config::get('id', false, 'system:');
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class OnManagerStop extends Callback
|
|||||||
{
|
{
|
||||||
$this->warning('manager stop.');
|
$this->warning('manager stop.');
|
||||||
|
|
||||||
$events = Snowflake::app()->event;
|
$events = Snowflake::app()->getEvent();
|
||||||
$events->trigger(Event::SERVER_MANAGER_STOP, [$server]);
|
$events->trigger(Event::SERVER_MANAGER_STOP, [$server]);
|
||||||
|
|
||||||
$runPath = storage(null, 'worker');
|
$runPath = storage(null, 'worker');
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class OnPacket extends Callback
|
|||||||
$response = DataResolve::pack($this->pack, $response);
|
$response = DataResolve::pack($this->pack, $response);
|
||||||
return $server->sendto($clientInfo['address'], $clientInfo['port'], $response);
|
return $server->sendto($clientInfo['address'], $clientInfo['port'], $response);
|
||||||
} finally {
|
} finally {
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::SERVER_WORKER_STOP);
|
$event->trigger(Event::SERVER_WORKER_STOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class OnReceive extends Callback
|
|||||||
$response = DataResolve::pack($this->pack, $response);
|
$response = DataResolve::pack($this->pack, $response);
|
||||||
return $server->send($fd, $response);
|
return $server->send($fd, $response);
|
||||||
} finally {
|
} finally {
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::SERVER_WORKER_STOP);
|
$event->trigger(Event::SERVER_WORKER_STOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class OnStart extends Callback
|
|||||||
if (Snowflake::isLinux()) {
|
if (Snowflake::isLinux()) {
|
||||||
name(Config::get('id', false, 'system:') . ': master.');
|
name(Config::get('id', false, 'system:') . ': master.');
|
||||||
}
|
}
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::SERVER_EVENT_START, null, $server);
|
$event->trigger(Event::SERVER_EVENT_START, null, $server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class OnTask extends Callback
|
|||||||
$finish['info'] = $this->format($exception);
|
$finish['info'] = $this->format($exception);
|
||||||
$this->error($exception, 'Task');
|
$this->error($exception, 'Task');
|
||||||
} finally {
|
} finally {
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::RELEASE_ALL);
|
$event->trigger(Event::RELEASE_ALL);
|
||||||
Timer::clearAll();
|
Timer::clearAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class OnWorkerStart extends Callback
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->debug(sprintf('Worker #%d is start.....', $worker_id));
|
$this->debug(sprintf('Worker #%d is start.....', $worker_id));
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::SERVER_WORKER_START, [$worker_id]);
|
$event->trigger(Event::SERVER_WORKER_START, [$worker_id]);
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
write($exception->getMessage(), 'worker');
|
write($exception->getMessage(), 'worker');
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class Response extends Application
|
|||||||
$string .= 'Command End!' . PHP_EOL . PHP_EOL;
|
$string .= 'Command End!' . PHP_EOL . PHP_EOL;
|
||||||
echo $string;
|
echo $string;
|
||||||
|
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger('CONSOLE_END');
|
$event->trigger('CONSOLE_END');
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ class Server extends Application
|
|||||||
if (!is_array($config['events'])) {
|
if (!is_array($config['events'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
foreach ($config['events'] as $name => $_event) {
|
foreach ($config['events'] as $name => $_event) {
|
||||||
$event->on($name, $_event);
|
$event->on($name, $_event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ abstract class BaseApplication extends Service
|
|||||||
if (!isset($config['events']) || !is_array($config['events'])) {
|
if (!isset($config['events']) || !is_array($config['events'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
foreach ($config['events'] as $key => $value) {
|
foreach ($config['events'] as $key => $value) {
|
||||||
if (is_string($value)) {
|
if (is_string($value)) {
|
||||||
if (!class_exists($value)) {
|
if (!class_exists($value)) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Component extends BaseObject
|
|||||||
*/
|
*/
|
||||||
public function trigger($name, $event = null, $params = [], $isRemove = false)
|
public function trigger($name, $event = null, $params = [], $isRemove = false)
|
||||||
{
|
{
|
||||||
$aEvents = Snowflake::app()->event;
|
$aEvents = Snowflake::app()->getEvent();
|
||||||
if (isset($this->_events[$name])) {
|
if (isset($this->_events[$name])) {
|
||||||
$events = $this->_events[$name];
|
$events = $this->_events[$name];
|
||||||
foreach ($events as $key => $_event) {
|
foreach ($events as $key => $_event) {
|
||||||
@@ -100,7 +100,7 @@ class Component extends BaseObject
|
|||||||
*/
|
*/
|
||||||
public function off($name, $handler = NULL): void
|
public function off($name, $handler = NULL): void
|
||||||
{
|
{
|
||||||
$aEvents = Snowflake::app()->event;
|
$aEvents = Snowflake::app()->getEvent();
|
||||||
if (!isset($this->_events[$name])) {
|
if (!isset($this->_events[$name])) {
|
||||||
$aEvents->of($name, $handler);
|
$aEvents->of($name, $handler);
|
||||||
return;
|
return;
|
||||||
@@ -129,7 +129,7 @@ class Component extends BaseObject
|
|||||||
public function offAll()
|
public function offAll()
|
||||||
{
|
{
|
||||||
$this->_events = [];
|
$this->_events = [];
|
||||||
$aEvents = Snowflake::app()->event;
|
$aEvents = Snowflake::app()->getEvent();
|
||||||
$aEvents->clean();
|
$aEvents->clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Snowflake\Cache;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
use Snowflake\Abstracts\Component;
|
use Snowflake\Abstracts\Component;
|
||||||
use Swoole\Coroutine\System;
|
use Swoole\Coroutine\System;
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ class File extends Component implements ICache
|
|||||||
/**
|
/**
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $hashKey
|
* @param string $hashKey
|
||||||
* @return string|int|bool
|
* @return string|int|bool|null
|
||||||
*/
|
*/
|
||||||
public function hGet(string $key, string $hashKey): string|int|bool|null
|
public function hGet(string $key, string $hashKey): string|int|bool|null
|
||||||
{
|
{
|
||||||
@@ -119,7 +120,7 @@ class File extends Component implements ICache
|
|||||||
* @param $key
|
* @param $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function exists($key): bool
|
#[Pure] public function exists($key): bool
|
||||||
{
|
{
|
||||||
return file_exists($key);
|
return file_exists($key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Redis extends Component
|
|||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->on(Event::RELEASE_ALL, [$this, 'destroy']);
|
$event->on(Event::RELEASE_ALL, [$this, 'destroy']);
|
||||||
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'release']);
|
$event->on(Event::EVENT_AFTER_REQUEST, [$this, 'release']);
|
||||||
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
|
$event->on(Event::SERVER_WORKER_START, [$this, 'createPool']);
|
||||||
@@ -46,10 +46,11 @@ class Redis extends Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
|
* @throws ComponentException
|
||||||
*/
|
*/
|
||||||
public function createPool()
|
public function createPool()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->pool->redis;
|
$connections = Snowflake::app()->getPool()->getRedis();
|
||||||
|
|
||||||
$config = $this->get_config();
|
$config = $this->get_config();
|
||||||
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
|
$name = $config['host'] . ':' . $config['prefix'] . ':' . $config['databases'];
|
||||||
@@ -112,10 +113,11 @@ SCRIPT;
|
|||||||
/**
|
/**
|
||||||
* 释放连接池
|
* 释放连接池
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
|
* @throws ComponentException
|
||||||
*/
|
*/
|
||||||
public function release()
|
public function release()
|
||||||
{
|
{
|
||||||
$connections = Snowflake::app()->pool->redis;
|
$connections = Snowflake::app()->getPool()->getRedis();
|
||||||
$connections->release($this->get_config(), true);
|
$connections->release($this->get_config(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
{
|
{
|
||||||
$this->category = 'exception';
|
$this->category = 'exception';
|
||||||
|
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::RELEASE_ALL);
|
$event->trigger(Event::RELEASE_ALL);
|
||||||
|
|
||||||
$this->sendError($exception->getMessage(), $exception->getFile(), $exception->getLine());
|
$this->sendError($exception->getMessage(), $exception->getFile(), $exception->getLine());
|
||||||
@@ -102,7 +102,7 @@ class ErrorHandler extends Component implements ErrorInterface
|
|||||||
|
|
||||||
logger()->error($data, 'error');
|
logger()->error($data, 'error');
|
||||||
|
|
||||||
$event = Snowflake::app()->event;
|
$event = Snowflake::app()->getEvent();
|
||||||
$event->trigger(Event::RELEASE_ALL);
|
$event->trigger(Event::RELEASE_ALL);
|
||||||
|
|
||||||
throw new \ErrorException($error[1], $error[0], 1, $error[2], $error[3]);
|
throw new \ErrorException($error[1], $error[0], 1, $error[2], $error[3]);
|
||||||
|
|||||||
Reference in New Issue
Block a user