diff --git a/app/Console/Command/ServerShell.php b/app/Console/Command/ServerShell.php index 183ff901c..21f8272b8 100644 --- a/app/Console/Command/ServerShell.php +++ b/app/Console/Command/ServerShell.php @@ -12,17 +12,8 @@ require_once 'AppShell.php'; */ class ServerShell extends AppShell { - /** @var BackgroundJobsTool */ - private $BackgroundJobsTool; - public $uses = array('Server', 'Task', 'Job', 'User', 'Feed'); - public function initialize(): void - { - parent::initialize(); - $this->BackgroundJobsTool = new BackgroundJobsTool(Configure::read('SimpleBackgroundJobs')); - } - public function list() { $servers = $this->Server->find('all', [ @@ -89,7 +80,7 @@ class ServerShell extends AppShell foreach ($servers as $serverId => $serverName) { - $backgroundJobId = $this->BackgroundJobsTool->enqueue( + $backgroundJobId = $this->Server->getBackgroundJobsTool()->enqueue( BackgroundJobsTool::DEFAULT_QUEUE, BackgroundJobsTool::CMD_SERVER, [ @@ -199,7 +190,7 @@ class ServerShell extends AppShell foreach ($servers as $serverId => $serverName) { - $jobId = $this->BackgroundJobsTool->enqueue( + $jobId = $this->Server->getBackgroundJobsTool()->enqueue( BackgroundJobsTool::DEFAULT_QUEUE, BackgroundJobsTool::CMD_SERVER, [ @@ -319,7 +310,7 @@ class ServerShell extends AppShell foreach ($servers as $serverId => $serverName) { - $jobId = $this->BackgroundJobsTool->enqueue( + $jobId = $this->Server->getBackgroundJobsTool()->enqueue( BackgroundJobsTool::DEFAULT_QUEUE, BackgroundJobsTool::CMD_SERVER, [