From 330ab830fd8915743348560fe6b2094206dd907d Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Fri, 19 Aug 2011 10:56:41 +0200 Subject: verschiedene Gearman Einstellungen in die application.ini verschoben --- application/configs/application.ini.dist | 4 +++ application/controllers/GearmanController.php | 37 +++++++++++++++++---------- 2 files changed, 27 insertions(+), 14 deletions(-) (limited to 'application') diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist index 92cb0cf..123c33f 100644 --- a/application/configs/application.ini.dist +++ b/application/configs/application.ini.dist @@ -30,6 +30,10 @@ pbs2.getperson = /resource/getperson/apikey/ pbs2.getmembership = /resource/getmembership/apikey/ pbs2.getgroup = /resource/getgroup/apikey/ pbs2.getrole = /resource/getrole/apikey/ +gearman.server.host = +gearman.server.port = +gearman.worker.waitTime = 120 +gearman.worker.updateRate = 1 resources.layout.layout = "default" resources.layout.layoutPath = APPLICATION_PATH "/layouts" diff --git a/application/controllers/GearmanController.php b/application/controllers/GearmanController.php index 7ca673d..8167275 100644 --- a/application/controllers/GearmanController.php +++ b/application/controllers/GearmanController.php @@ -7,6 +7,10 @@ class GearmanController extends Zend_Controller_Action protected $pbs2host; protected $userIDsNamespace; protected $acl; + protected $gearmanServerHost; + protected $gearmanServerPort; + protected $gearmanWorkerUpdateRate; + protected $gearmanWorkerWaitTime; public function init() { @@ -18,12 +22,17 @@ class GearmanController extends Zend_Controller_Action if(isset($this->userIDsNamespace['apikey'])) { $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } + $this->gearmanServerHost = $this->config['gearman']['server']['host']; + $this->gearmanServerPort = $this->config['gearman']['server']['port']; + $this->gearmanWorkerWaitTime = $this->config['gearman']['worker']['waitTime']; + $this->gearmanWorkerUpdateRate = $this->config['gearman']['worker']['updateRate']; $this->gearmanClient = new GearmanClient(); - $this->gearmanClient->addServer('127.0.0.1'); + $this->gearmanClient->addServer($this->gearmanServerHost); } else { $this->_helper->redirector('login', 'auth'); return; } + } public function indexAction() @@ -91,13 +100,13 @@ class GearmanController extends Zend_Controller_Action public function bootAction() { $eventName = 'bootTest'; $eventOS = 'testOS'; - $updateRate = 1; - $waitTime = 120; $clients = array( 'eventName' => $eventName, 'eventOS' => $eventOS, - 'updateRate' => $updateRate, - 'waitTime' => $waitTime, + 'updateRate' => $this->gearmanWorkerUpdateRate, + 'waitTime' => $this->gearmanWorkerWaitTime, + 'host' => $this->gearmanServerHost, + 'port' => $this->gearmanServerPort, 'clients' => array( 0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'), ), @@ -115,12 +124,12 @@ class GearmanController extends Zend_Controller_Action public function shutdownAction() { $eventName = 'shutdownTest'; - $updateRate = 1; - $waitTime = 120; $clients = array( 'eventName' => $eventName, - 'updateRate' => $updateRate, - 'waitTime' => $waitTime, + 'updateRate' => $this->gearmanWorkerUpdateRate, + 'waitTime' => $this->gearmanWorkerWaitTime, + 'host' => $this->gearmanServerHost, + 'port' => $this->gearmanServerPort, 'clients' => array( 0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'), ), @@ -135,15 +144,15 @@ class GearmanController extends Zend_Controller_Action } $this->view->result = $result; } - + public function maintenanceAction() { $eventName = 'maintenance_pool-113'; //maintenance of pool-113 - $updateRate = 1; - $waitTime = 120; $clients = array( 'eventName' => $eventName, - 'updateRate' => $updateRate, - 'waitTime' => $waitTime, + 'updateRate' => $this->gearmanWorkerUpdateRate, + 'waitTime' => $this->gearmanWorkerWaitTime, + 'host' => $this->gearmanServerHost, + 'port' => $this->gearmanServerPort, 'clients' => array( 0 => array('id' => '1', 'ip' =>'132.230.4.121', 'mac' =>'00:1e:0b:a6:f8:19'), 0 => array('id' => '2', 'ip' =>'132.230.4.122', 'mac' =>'00:1e:0b:a6:d5:de'), -- cgit v1.2.3-55-g7522