diff --git a/app/Console/Command/ServerShell.php b/app/Console/Command/ServerShell.php index 05ac12536..cf49406e3 100644 --- a/app/Console/Command/ServerShell.php +++ b/app/Console/Command/ServerShell.php @@ -320,6 +320,34 @@ class ServerShell extends AppShell echo $message . PHP_EOL; } + public function cacheServerAll() + { + $this->ConfigLoad->execute(); + + $userId = $this->args[0]; + $user = $this->User->getAuthUser($userId); + if (empty($user)) { + die('User ID do not match an existing user.' . PHP_EOL); + } + + $servers = $this->Server->find('all', array( + 'conditions' => array('Server.pull' => 1), + 'recursive' => -1, + 'order' => 'Server.priority', + 'fields' => array('Server.name', 'Server.id'), + )); + + foreach ($servers as $server) { + $jobId = CakeResque::enqueue( + 'default', + 'ServerShell', + array('cacheServer', $userId, $server['Server']['id']) + ); + $this->out("Enqueued cacheServer from {$server['Server']['name']} server as job $jobId"); + } + + } + public function cacheFeed() { $this->ConfigLoad->execute();