Skip to content

Commit 4d93677

Browse files
authored
Merge pull request #65 from iobotis/binary-path-setting-in-factory
Added custom path for binary in Tools Factory.
2 parents 86e1f53 + 9d29719 commit 4d93677

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Backup/Binary.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function run($cmd_parameters, $environment_vars = array(), $directory = n
8585

8686
private function exec($command, &$output, &$exitCode)
8787
{
88-
echo $command ."\n";
88+
//echo $command ."\n";
8989
exec($command, $output, $exitCode);
9090
$this->_execution_list[] = $command;
9191
}

src/Backup/Tools/Factory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public static function create($class, array $settings = null)
5959
if (!in_array($class, self::$_classes_supported)) {
6060
throw new \Backup\Exception\InvalidArgumentException('Class not supported.');
6161
}
62-
62+
$path = (isset($settings['binary_path'])? $settings['binary_path']: null);
6363
if ($class === 'Duplicity') {
64-
$binary = new Binary('duplicity');
64+
$binary = new Binary($path? $path: 'duplicity');
6565

6666
if (empty($settings['path_to_backup']) || empty($settings['destination'])) {
6767
throw new \Backup\Exception\InvalidArgumentException('Please see the documentation for the settings needed.');
@@ -82,7 +82,7 @@ public static function create($class, array $settings = null)
8282

8383
return $duplicity;
8484
} elseif ($class === 'Tar') {
85-
$binary = new Binary('tar');
85+
$binary = new Binary($path? $path: 'tar');
8686

8787
if (empty($settings['path_to_backup']) || empty($settings['destination'])) {
8888
throw new \Backup\Exception\InvalidArgumentException('Please see the documentation for the settings needed.');
@@ -99,7 +99,7 @@ public static function create($class, array $settings = null)
9999

100100
return $tar;
101101
} elseif ($class === 'Borg') {
102-
$binary = new Binary('borg');
102+
$binary = new Binary($path? $path: 'borg');
103103

104104
if (empty($settings['path_to_backup']) || empty($settings['destination'])) {
105105
throw new \Backup\Exception\InvalidArgumentException('Please see the documentation for the settings needed.');

0 commit comments

Comments
 (0)