diff --git a/atf.inc.php b/atf.inc.php index 716ae74..bfd2677 100644 --- a/atf.inc.php +++ b/atf.inc.php @@ -53,7 +53,7 @@ function host_put_file_async(string $atf_host, string $local_path, string $remot return taskman\deploy_rsync_async($atf_host, $local_path, $remote_path); } -function _spread(array $items, $num) +function spread(array $items, $num) { $k = sizeof($items) / $num; @@ -66,7 +66,7 @@ function _spread(array $items, $num) return $res; } -function _slice(array $items, $max) +function slice(array $items, $max) { $sliced = array(); diff --git a/device.inc.php b/device.inc.php index 5ea3247..9d5f281 100644 --- a/device.inc.php +++ b/device.inc.php @@ -2,6 +2,7 @@ namespace ATF; use Exception; +use Amp; interface IDevicePool { diff --git a/im.inc.php b/im.inc.php index f68b6c3..13cfd05 100644 --- a/im.inc.php +++ b/im.inc.php @@ -2,6 +2,7 @@ namespace ATF; use Exception; +use Amp; interface IMChan { @@ -72,7 +73,7 @@ class MattermostChan implements IMChan function mm_post(string $server, string $token, string $chan, string $message, $fields = array()) { - $ch = _atf_mm_post_curl($server, $token, $chan, $message, $fields); + $ch = _mm_post_curl($server, $token, $chan, $message, $fields); $result = curl_exec($ch); curl_close($ch); @@ -86,8 +87,8 @@ function mm_post_async(string $server, string $token, string $chan, string $mess { return Amp\call(function() use($server, $token, $chan, $message, $fields) { - $ch = _atf_mm_post_curl($server, $token, $chan, $message, $fields); - $result = yield _atf_multi_curl_async($ch, true); + $ch = _mm_post_curl($server, $token, $chan, $message, $fields); + $result = yield _multi_curl_async($ch, true); curl_close($ch); $json = json_decode($result, true); @@ -160,7 +161,7 @@ function mm_get_permalink(string $server, string $team, string $msg_id) return "$server/$team/pl/$msg_id"; } -function _atf_mm_post_curl(string $server, string $token, string $chan, string $message, $fields = array()) +function _mm_post_curl(string $server, string $token, string $chan, string $message, $fields = array()) { $ch = curl_init("$server/api/v4/posts"); diff --git a/plan.inc.php b/plan.inc.php index 07ec4f6..92dfd96 100644 --- a/plan.inc.php +++ b/plan.inc.php @@ -353,7 +353,7 @@ class Plan $task->getLastFatalProblem() == Task::CODE_HUNG) { $app_log = get_logcat_unity($this->session->conf->atf_host, $task->device, 300); - $app_log = _atf_trim_start($app_log, 2000); + $app_log = _trim_start($app_log, 2000); $this->post("Last logs: \n```\n$app_log\n```\n *{$task->device}*"); } @@ -528,7 +528,7 @@ class Plan static function _printToShellExtItem(Task $task, array $item) { - $shell_msg = _atf_trim($item['message'], 200); + $shell_msg = _trim($item['message'], 200); if(Task::isProblemCode($item['error'])) $shell_msg = "[PRB] Code:{$item['error']}, $shell_msg"; $shell_msg = "(".round($item['time'],1)."s) {$shell_msg} *{$task->device}*"; @@ -538,7 +538,7 @@ class Plan function _postToMessengerExtStatusItem(Task $task, array $item) { - $orig_msg = _atf_trim($item['message'], 3000); + $orig_msg = _trim($item['message'], 3000); $mm_msg = $orig_msg; if($item['error'] == Task::CODE_EXCEPTION) @@ -628,13 +628,13 @@ class Plan function _postReplayToMessenger(Task $task, $repl_txt) { - $repl_txt = _atf_try_lz4_replay($repl_txt); + $repl_txt = _try_lz4_replay($repl_txt); $this->post("Last Replay: \n```\n$repl_txt\n```\n *{$task->device}*"); } function _reportErrorFromLogcatToMessenger(Task $task, $limit) { - $errors_log = _atf_trim(get_logcat_errors($task->device, $limit), 3950); + $errors_log = _trim(get_logcat_errors($task->device, $limit), 3950); if($errors_log) $this->post("\n```\n$errors_log\n```\n *{$task->device}*"); }