Update Queue.php

This commit is contained in:
Anyon 2020-05-22 13:55:15 +08:00
parent feffc0f5eb
commit 151b1bdd25

View File

@ -46,11 +46,12 @@ class Queue extends Controller
public function index() public function index()
{ {
if (AdminService::instance()->isSuper()) try { if (AdminService::instance()->isSuper()) try {
$process = ProcessService::instance(); $this->process = ProcessService::instance();
if ($process->iswin() || empty($_SERVER['USER'])) { if ($this->process->iswin()) {
$this->command = $process->think('xadmin:queue start'); $this->command = $this->process->think('xadmin:queue start');
} else { } else {
$this->command = "sudo -u {$_SERVER['USER']} {$process->think('xadmin:queue start')}"; $user = $this->request->server('user', 'www');
$this->command = "sudo -u {$user} {$this->process->think('xadmin:queue start')}";
} }
$this->message = $this->app->console->call('xadmin:queue', ['status'])->fetch(); $this->message = $this->app->console->call('xadmin:queue', ['status'])->fetch();
$this->listen = preg_match('/process.*?\d+.*?running/', $this->message, $attr); $this->listen = preg_match('/process.*?\d+.*?running/', $this->message, $attr);