This commit is contained in:
2020-09-04 00:41:33 +08:00
parent 622071256e
commit 46f9de1f6a
141 changed files with 105 additions and 73 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace HttpServer\Events;
use Exception;
use HttpServer\Events\Abstracts\Callback;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use Snowflake\Config;
use Snowflake\Core\JSON;
use Snowflake\Error\Logger;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
use Swoole\Server;
use Closure;
/**
* Class OnShutdown
* @package HttpServer\Events
*/
class OnShutdown extends Callback
{
/**
* @param Server $server
* @throws ComponentException
* @throws Exception
*/
public function onHandler(Server $server)
{
$this->system_mail('server shutdown~');
$event = Snowflake::app()->getEvent();
if (!$event->exists(Event::SERVER_SHUTDOWN)) {
return;
}
$event->trigger(Event::SERVER_SHUTDOWN);
}
}