]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/baculum/protected/Class/Bconsole.php
baculum: Assign Baculum copyright to Kern Sibbald
[bacula/bacula] / gui / baculum / protected / Class / Bconsole.php
index 89113d05a13f2cecfed97f0118e1937c4dd23821..073f90aaf2c67a862092d1a7a962e051841dd32a 100644 (file)
@@ -3,7 +3,7 @@
  * Bacula(R) - The Network Backup Solution
  * Baculum   - Bacula web interface
  *
- * Copyright (C) 2013-2015 Marcin Haba
+ * Copyright (C) 2013-2016 Kern Sibbald
  *
  * The main author of Baculum is Marcin Haba.
  * The original author of Bacula is Kern Sibbald, with contributions
@@ -28,7 +28,7 @@ class Bconsole extends TModule {
 
        const SUDO = 'sudo';
 
-       const BCONSOLE_COMMAND_PATTERN = "%s%s -c %s %s <<END_OF_DATA\n%s\nquit\n<<END_OF_DATA";
+       const BCONSOLE_COMMAND_PATTERN = "%s%s -c %s %s <<END_OF_DATA\n%s\nquit\nEND_OF_DATA";
 
        const BCONSOLE_DIRECTORS_PATTERN = "%s%s -c %s -l";
 
@@ -77,7 +77,7 @@ class Bconsole extends TModule {
                        }
                }
                $output = count($output) > 1 ? array_values($output) : array_shift($output);
-               return (object)array('output' => $output, 'exitcode' => $exitcode);
+               return (object)array('output' => $output, 'exitcode' => (integer)$exitcode);
        }
 
        public function bconsoleCommand($director, array $command, $user = null) {
@@ -91,6 +91,7 @@ class Bconsole extends TModule {
        }
 
        private function execCommand($director, array $command, $user) {
+               $cmd = '';
                if(!is_null($director) && $this->isValidDirector($director) === false) {
                        $output = array(BconsoleError::MSG_ERROR_INVALID_DIRECTOR, '');
                        $exitcode = BconsoleError::ERROR_INVALID_DIRECTOR;
@@ -137,7 +138,8 @@ class Bconsole extends TModule {
        public function testBconsoleCommand(array $command, $bconsoleCmdPath, $bconsoleCfgPath, $useSudo) {
                $this->setEnvironmentParams($bconsoleCmdPath, $bconsoleCfgPath, null, $useSudo);
                $director = array_shift($this->getDirectors()->output);
-               return $this->bconsoleCommand($director, $command);             
+               $result = $this->bconsoleCommand($director, $command);
+               return $result;
        }
 }
-?>
\ No newline at end of file
+?>