From f6364df4f1990c63a183ebc0bae2b0baf1450c21 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 27 Oct 2011 09:46:53 +0200 Subject: GearmanController gelöscht --- application/controllers/GearmanController.php | 213 -------------------------- 1 file changed, 213 deletions(-) delete mode 100755 application/controllers/GearmanController.php (limited to 'application') diff --git a/application/controllers/GearmanController.php b/application/controllers/GearmanController.php deleted file mode 100755 index 9308a5e..0000000 --- a/application/controllers/GearmanController.php +++ /dev/null @@ -1,213 +0,0 @@ -hasIdentity()) { - $bootstrap = $this->getInvokeArg('bootstrap'); - $this->config = $bootstrap->getOptions(); - $this->pbs2host = $this->config['pbs2']['host']; - $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - 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']); - } - if(!$this->acl->checkRight('er')) { - header('HTTP/1.0 403 No Right to run events'); - die(); - } - $this->gearmanServerHost = $this->config['gearman']['server']['host']; - $this->gearmanClient = new GearmanClient(); - $this->gearmanClient->addServer($this->gearmanServerHost); - } else { - $this->_helper->redirector('login', 'auth'); - return; - } - } - - public function indexAction() - { - - } - - public function somepingAction() - { - $data = array( - 0 => '132.230.4.1', - 1 => '132.230.4.2', - 2 => '132.230.4.3', - 3 => '132.230.4.4', - 4 => '132.230.4.5', - 5 => '132.230.4.6', - 6 => '132.230.4.7', - 7 => '132.230.4.8', - 8 => '132.230.4.9', - 9 => '132.230.4.10', - 10 => '132.230.4.11', - 11 => '132.230.4.12', - 12 => '132.230.4.13', - 13 => '132.230.4.14', - 14 => '132.230.4.15', - 15 => '132.230.4.16', - 16 => '132.230.4.17', - 17 => '132.230.4.18', - 18 => '132.230.4.19', - 19 => '132.230.4.20', - 20 => '132.230.4.21', - 21 => '132.230.4.22', - 22 => '132.230.4.23', - 23 => '132.230.4.24', - 24 => '132.230.4.25', - 25 => '132.230.4.26', - 26 => '132.230.4.27', - 27 => '132.230.4.28', - 28 => '132.230.4.29', - 29 => '132.230.4.30', - ); - - $dataString = json_encode($data); - - $result = $this->gearmanClient->do("somePing", $dataString, 'somePing'); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $resultsExp = explode('; ', $result); - if(is_array($resultsExp)) { - foreach($resultsExp as $result) { - $resultDecode = json_decode($result); - $resultDecode->rawoutput = sprintf('%s', $resultDecode->rawoutput); - $resultDecode->rawoutput = str_replace("\n", "
\t", $resultDecode->rawoutput); - $resultDecode->alive = sprintf('%s', $resultDecode->alive); - $resultDecode->rc = sprintf('%s', $resultDecode->rc); - $results[] = $resultDecode; - } - } - $this->view->results = $results; - } - - public function bootAction() { - $eventName = 'bootTest'; - $eventOS = 'testOS'; - $data = array( - 'eventName' => $eventName, - 'eventOS' => $eventOS, - 'clients' => array( - 0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'), - ), - ); - - $dataString = json_encode($data); - $result = $this->gearmanClient->do("boot", $dataString, 'boot' . $eventName); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $this->view->result = $result; - } - - public function shutdownAction() { - $eventName = 'shutdownTest'; - $data = array( - 'eventName' => $eventName, - 'clients' => array( - 0 => array('id' => '1', 'ip' =>'132.230.4.24', 'mac' =>'00:13:72:C7:FD:A1'), - ), - ); - - $dataString = json_encode($data); - $result = $this->gearmanClient->do("shutdown", $dataString, 'shutdown' . $eventName); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $this->view->result = $result; - } - - public function maintenanceAction() { - $eventName = 'maintenance_pool-113'; //maintenance of pool-113 - $data = array( - 'eventName' => $eventName, - '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'), - 0 => array('id' => '3', 'ip' =>'132.230.4.123', 'mac' =>'00:1e:0b:a6:d5:8e'), - 0 => array('id' => '4', 'ip' =>'132.230.4.124', 'mac' =>'00:1e:0b:a6:f8:2c'), - 0 => array('id' => '5', 'ip' =>'132.230.4.125', 'mac' =>'00:1e:0b:a6:d5:e9'), - 0 => array('id' => '6', 'ip' =>'132.230.4.126', 'mac' =>'00:1e:0b:a6:d5:07'), - 0 => array('id' => '7', 'ip' =>'132.230.4.127', 'mac' =>'00:1e:0b:a6:'), // unvollständig - 0 => array('id' => '8', 'ip' =>'132.230.4.128', 'mac' =>'00:1e:0b:a6:'), // unvollständig - 0 => array('id' => '9', 'ip' =>'132.230.4.129', 'mac' =>'00:1e:0b:a6:'), // unvollständig - 0 => array('id' => '10', 'ip' =>'132.230.4.130', 'mac' =>'00:1e:0b:a6:f7:eb'), - 0 => array('id' => '11', 'ip' =>'132.230.4.131', 'mac' =>'00:1e:0b:a6:f8:a7'), - 0 => array('id' => '12', 'ip' =>'132.230.4.132', 'mac' =>'00:1e:0b:a6:d5:e4'), - 0 => array('id' => '13', 'ip' =>'132.230.4.133', 'mac' =>'00:1e:0b:a6:'), // unvollständig - 0 => array('id' => '14', 'ip' =>'132.230.4.134', 'mac' =>'00:1e:0b:a6:'), // unvollständig - 0 => array('id' => '15', 'ip' =>'132.230.4.135', 'mac' =>'00:1e:0b:a6:'), // unvollständig - ), - ); - - $dataString = json_encode($data); - $result = $this->gearmanClient->do("shutdown", $dataString, 'shutdown' . $eventName); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $this->view->result = $result; - } - - public function checkbootstatusAction() { - $eventName = 'bootTest'; - $data = array( - 'type' => 'getBootState', - 'events' => array( - 0 => $eventName, - ), - ); - - $dataString = json_encode($data); - $result = $this->gearmanClient->do("status", $dataString, 'status' . $eventName); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $this->view->result = $result; - } - - public function checkshutdownstatusAction() { - $eventName = 'shutdownTest'; - $data = array( - 'type' => 'getShutdownState', - 'events' => array( - 0 => $eventName, - ), - ); - - $dataString = json_encode($data); - $result = $this->gearmanClient->do("status", $dataString, 'status' . $eventName); - if (! $this->gearmanClient->runTasks()) - { - echo "ERROR " . $gmc->error() . "\n"; - exit; - } - $this->view->result = $result; - } -} -- cgit v1.2.3-55-g7522 From a08ee3dd84d1b7ca9a0d7e375426e23595dfe5e3 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Thu, 27 Oct 2011 10:16:06 +0200 Subject: kleine Korrektur --- application/controllers/EventController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'application') diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index 0cb4954..5bc200f 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -284,7 +284,7 @@ class EventController extends Zend_Controller_Action $event->setRunning(false); } $event->setCreated(time()); - $overlapping = false; + $overlapping = 0; if($event->repeat) { $overlapping = $this->repeatEvent($event); } else { @@ -464,13 +464,13 @@ class EventController extends Zend_Controller_Action $params['immediate'] = 0; $event->setOptions($params); $event->setID($eventID); - $overlapping = false; + $overlapping = 0; if($event->getRepeat() == 1 && !isset($params['wdh'])) { $event->setRepeat(2); } else { $overlappingEvents = $this->eventMapper->getOverlappingEvents(date('Y-m-d H:i:s', strtotime($event->getStart())), date('Y-m-d H:i:s', strtotime($event->getEnd())), $event->getPbs_PoolID()); if(count($overlappingEvents) > 0 ) { - $overlapping = true; + $overlapping = 1; } if(!$overlapping) { $result = $this->eventcategoryMapper->findBy(array('title' => 'Shutdown')); @@ -2688,12 +2688,12 @@ class EventController extends Zend_Controller_Action break; } - $overlapping = false; + $overlapping = 0; $overlappingEvents = array(); foreach($events as $evt) { $overlappingEvents = $this->eventMapper->getOverlappingEvents(date('Y-m-d H:i:s', strtotime($evt->getStart())), date('Y-m-d H:i:s', strtotime($evt->getEnd())), $evt->getPbs_PoolID(), $event, true); if(count($overlappingEvents) > 0 ) { - $overlapping = true; + $overlapping = 1; break; } } -- cgit v1.2.3-55-g7522