mirror of https://github.com/MISP/MISP
function cacheServerAll -- cache all server
parent
282a9c4047
commit
c34d320186
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue