]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/API/Pages/API/PoolUpdate.php
baculum: API endpoints code refactor
[bacula/bacula] / gui / baculum / protected / API / Pages / API / PoolUpdate.php
index 394f82ad744f66c91cdea4c4c6527b178373b764..300e8d090ed61e9b3c4b2fd4299f103b2c116308 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
 class PoolUpdate extends BaculumAPIServer {
 
        public function set($id, $params) {
-               $pool = $this->getModule('pool')->getPoolById($id);
-               if(!is_null($pool)) {
-                       $poolUpdate = $this->getModule('bconsole')->bconsoleCommand($this->director, array('update', 'pool="' .  $pool->name . '"'), $this->user);
-                       $this->output = $poolUpdate->output;
-                       $this->error = (integer)$poolUpdate->exitcode;
+               $poolid = intval($id);
+               $pool = $this->getModule('pool')->getPoolById($poolid);
+               if(is_object($pool)) {
+                       $result = $this->getModule('bconsole')->bconsoleCommand(
+                               $this->director,
+                               array('update', 'pool="' .  $pool->name . '"')
+                       );
+                       $this->output = $result->output;
+                       $this->error = $result->exitcode;
                } else {
                        $this->output = PoolError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
                        $this->error = PoolError::ERROR_POOL_DOES_NOT_EXISTS;