Skip to content

Commit

Permalink
update to 0.5.10, fix workerman log problem
Browse files Browse the repository at this point in the history
  • Loading branch information
crazywhalecc committed Feb 11, 2023
1 parent a1ab42a commit b9be96c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/OneBot/Driver/Workerman/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

use Workerman\Connection\ConnectionInterface;
use Workerman\Lib\Timer;
use function is_file;
use function pcntl_signal;
use function set_error_handler;

/**
* @property callable|\Closure $onWebSocketConnect
Expand Down Expand Up @@ -189,15 +186,16 @@ protected static function init()

// Log file.
// [jerry]: 不需要Workerman自作主张写文件了!!
/*
// [jerry]: 还是得写个日志,要不然workerman就报错了
if (empty(static::$logFile)) {
static::$logFile = __DIR__ . '/../workerman.log';
$rand = random_int(100000, 999999);
static::$logFile = ONEBOT_TMP_DIR . '/.libob ' . $rand . '.workerman.log';
}
$log_file = (string) static::$logFile;
if (!is_file($log_file)) {
if (!\is_file($log_file)) {
touch($log_file);
chmod($log_file, 0622);
}*/
}

// State.
static::$_status = static::STATUS_STARTING;
Expand Down
12 changes: 11 additions & 1 deletion src/OneBot/global_defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use ZM\Logger\ConsoleLogger;

const ONEBOT_VERSION = '12';
const ONEBOT_LIBOB_VERSION = '0.5.9';
const ONEBOT_LIBOB_VERSION = '0.5.10';

const ONEBOT_JSON = 1;
const ONEBOT_MSGPACK = 2;
Expand All @@ -37,6 +37,16 @@

class_alias(MessageSegment::class, 'MessageSegment');

if (DIRECTORY_SEPARATOR === '\\') {
define('ONEBOT_TMP_DIR', 'C:\\Windows\\Temp');
} elseif (!empty(getenv('TMPDIR'))) {
define('ONEBOT_TMP_DIR', getenv('TMPDIR'));
} elseif (is_writable('/tmp')) {
define('ONEBOT_TMP_DIR', '/tmp');
} else {
define('ONEBOT_TMP_DIR', getcwd() . '/.zm-tmp');
}

/**
* 更漂亮的dump变量
*
Expand Down

0 comments on commit b9be96c

Please sign in to comment.