修复工单PHP CLI同步问题 系统设置可以设置并发阈值
This commit is contained in:
Regular → Executable
+33
-2
@@ -51,6 +51,7 @@ class SplitTicketSyncDispatchService
|
||||
'queued' => $queued,
|
||||
'skipped' => $skipped,
|
||||
'failed' => $failed,
|
||||
'phpCli' => $php,
|
||||
]);
|
||||
|
||||
return [
|
||||
@@ -130,13 +131,43 @@ class SplitTicketSyncDispatchService
|
||||
|
||||
private function resolvePhpBinary(): string
|
||||
{
|
||||
if (defined('PHP_BINARY') && PHP_BINARY !== '') {
|
||||
return PHP_BINARY;
|
||||
if (method_exists(SplitSyncConfigService::class, 'getCliPhpBinary')) {
|
||||
return SplitSyncConfigService::getCliPhpBinary();
|
||||
}
|
||||
|
||||
return $this->resolvePhpBinaryFallback();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当 SplitSyncConfigService 未部署 getCliPhpBinary 时的兜底解析
|
||||
*/
|
||||
private function resolvePhpBinaryFallback(): string
|
||||
{
|
||||
if (defined('PHP_BINDIR') && PHP_BINDIR !== '') {
|
||||
$candidate = rtrim(PHP_BINDIR, '/\\') . DIRECTORY_SEPARATOR . 'php';
|
||||
if ($this->isUsableCliPhp($candidate)) {
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
foreach (['/usr/bin/php', '/usr/local/bin/php'] as $candidate) {
|
||||
if ($this->isUsableCliPhp($candidate)) {
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
return 'php';
|
||||
}
|
||||
|
||||
private function isUsableCliPhp(string $path): bool
|
||||
{
|
||||
if (stripos($path, 'fpm') !== false) {
|
||||
return false;
|
||||
}
|
||||
if ($path === 'php') {
|
||||
return true;
|
||||
}
|
||||
return is_file($path) && is_executable($path);
|
||||
}
|
||||
|
||||
private function resolveThinkScript(): string
|
||||
{
|
||||
$root = $this->resolveRootPath();
|
||||
|
||||
Reference in New Issue
Block a user