Example #1
0
 public function zmqAfterHook($setting, $value)
 {
     App::uses('PubSubTool', 'Tools');
     $pubSubTool = new PubSubTool();
     // If we are trying to change the enable setting to false, we don't need to test anything, just kill the server and return true.
     if ($setting == 'Plugin.ZeroMQ_enable') {
         if ($value == false || $value == 0) {
             $pubSubTool->killService();
             return true;
         }
     } elseif (!Configure::read('Plugin.ZeroMQ_enable')) {
         // If we are changing any other ZeroMQ settings but the feature is disabled, don't reload the service
         return true;
     }
     $pubSubTool->reloadServer();
     return true;
 }
Example #2
0
 public function stopZeroMQServer()
 {
     if (!$this->_isSiteAdmin()) {
         throw new MethodNotAllowedException();
     }
     App::uses('PubSubTool', 'Tools');
     $pubSubTool = new PubSubTool();
     $result = $pubSubTool->killService();
     if ($result === true) {
         return new CakeResponse(array('body' => json_encode(array('saved' => true, 'success' => 'ZeroMQ server successfully killed.')), 'status' => 200));
     } else {
         return new CakeResponse(array('body' => json_encode(array('saved' => false, 'errors' => 'Could not kill the previous instance of the ZeroMQ script.')), 'status' => 200));
     }
 }