Adding support for RAW messages posting
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
854e697685
commit
5fa6de2365
20
plan.inc.php
20
plan.inc.php
|
@ -16,6 +16,8 @@ class Plan
|
|||
const BOGUS_REINSTALL_APP_EVERY_N = 2;
|
||||
const IM_THREAD_UPDATE_INTERVAL = 5;
|
||||
|
||||
const MaxImTextPostLen = 3000;
|
||||
|
||||
public Session $session;
|
||||
|
||||
public string $name;
|
||||
|
@ -551,7 +553,7 @@ class Plan
|
|||
|
||||
static function _printToShellExtItem(Task $task, array $item)
|
||||
{
|
||||
$shell_msg = _trim($item['message'], 3000);
|
||||
$shell_msg = _trim($item['message'], self::MaxImTextPostLen);
|
||||
if(Task::isProblemCode($item['error']))
|
||||
$shell_msg = "[PRB] Code:{$item['error']}, $shell_msg";
|
||||
$shell_msg = "(".round($item['time'],1)."s) {$shell_msg} *{$task->device}*";
|
||||
|
@ -561,7 +563,7 @@ class Plan
|
|||
|
||||
function _postToMessengerExtStatusItem(Task $task, array $item)
|
||||
{
|
||||
$orig_msg = _trim($item['message'], 3000);
|
||||
$orig_msg = _trim($item['message'], self::MaxImTextPostLen);
|
||||
$mm_msg = $orig_msg;
|
||||
|
||||
if($item['error'] == Task::CODE_EXCEPTION)
|
||||
|
@ -640,6 +642,10 @@ class Plan
|
|||
{
|
||||
$this->_postToMessengerExtStatusItem($task, $item);
|
||||
}
|
||||
else if($item['error'] == Task::CODE_RAW)
|
||||
{
|
||||
$this->_postRawDataToMessenger($task, $item['message']);
|
||||
}
|
||||
else if($msg_type === '[WRN]')
|
||||
{
|
||||
$task->addStatusCode(Task::CODE_WARN);
|
||||
|
@ -674,11 +680,19 @@ class Plan
|
|||
});
|
||||
}
|
||||
|
||||
function _postRawDataToMessenger(Task $task, string $txt)
|
||||
{
|
||||
if(strlen($txt) > self::MaxImTextPostLen)
|
||||
$this->postFileData("Raw data: *{$task->device}*", 'text/plain', $txt, '.txt');
|
||||
else
|
||||
$this->post("Raw data: \n```\n$txt\n```\n *{$task->device}*");
|
||||
}
|
||||
|
||||
function _postReplayToMessenger(Task $task, $repl_txt)
|
||||
{
|
||||
$repl_txt = _try_lz4_replay($repl_txt);
|
||||
|
||||
if(strlen($repl_txt) > 3000)
|
||||
if(strlen($repl_txt) > self::MaxImTextPostLen)
|
||||
$this->postFileData("Replay File: *{$task->device}*", 'text/plain', $repl_txt, '.txt');
|
||||
else
|
||||
$this->post("Last Replay: \n```\n$repl_txt\n```\n *{$task->device}*");
|
||||
|
|
|
@ -26,6 +26,7 @@ class Task
|
|||
const CODE_MESSAGE = 0;
|
||||
const CODE_EXCEPTION = 1;
|
||||
const CODE_WARN = 2;
|
||||
const CODE_RAW = 3;
|
||||
const CODE_NSTART = 124;
|
||||
const CODE_STUCK = 125;
|
||||
const CODE_GONE = 126;
|
||||
|
@ -42,6 +43,8 @@ class Task
|
|||
return "exception";
|
||||
case self::CODE_WARN:
|
||||
return "warning";
|
||||
case self::CODE_RAW:
|
||||
return "raw";
|
||||
case self::CODE_STUCK:
|
||||
return "stuck";
|
||||
case self::CODE_NSTART:
|
||||
|
|
Loading…
Reference in New Issue