File tree Expand file tree Collapse file tree 4 files changed +14
-15
lines changed
Expand file tree Collapse file tree 4 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 33
44use phpbu \App \Backup \Compressor ;
55use phpbu \App \Backup \Target ;
6+ use phpbu \App \Util \Cli ;
67
78/**
89 * Execute Binary
@@ -45,6 +46,16 @@ abstract class Binary
4546 'tar ' => array (),
4647 );
4748
49+ /**
50+ * @param string $cmd
51+ * @param string $path
52+ * @return string
53+ */
54+ protected function detectCommand ($ cmd , $ path = null )
55+ {
56+ return Cli::detectCmdLocation ($ cmd , $ path , self ::getCommandLocations ($ cmd ));
57+ }
58+
4859 /**
4960 * Executes the cli commands and handles compression
5061 *
Original file line number Diff line number Diff line change @@ -148,11 +148,7 @@ public function setup(array $conf = array())
148148 protected function setupMongodump (array $ conf )
149149 {
150150 if (empty ($ this ->binary )) {
151- $ this ->binary = Util \Cli::detectCmdLocation (
152- 'mongodump ' ,
153- Util \Arr::getValue ($ conf , 'pathToMongodump ' ),
154- Binary::getCommandLocations ('mongodump ' )
155- );
151+ $ this ->binary = $ this ->detectCommand ('mongodump ' , Util \Arr::getValue ($ conf , 'pathToMongodump ' ));
156152 }
157153 }
158154
Original file line number Diff line number Diff line change @@ -145,11 +145,7 @@ public function setup(array $conf = array())
145145 protected function setupMysqldump (array $ conf )
146146 {
147147 if (empty ($ this ->binary )) {
148- $ this ->binary = Util \Cli::detectCmdLocation (
149- 'mysqldump ' ,
150- Util \Arr::getValue ($ conf , 'pathToMysqldump ' ),
151- Binary::getCommandLocations ('mysqldump ' )
152- );
148+ $ this ->binary = $ this ->detectCommand ('mysqldump ' , Util \Arr::getValue ($ conf , 'pathToMysqldump ' ));
153149 }
154150 }
155151
Original file line number Diff line number Diff line change @@ -71,11 +71,7 @@ public function setup(array $conf = array())
7171 protected function setupTar (array $ conf )
7272 {
7373 if (empty ($ this ->binary )) {
74- $ this ->binary = Util \Cli::detectCmdLocation (
75- 'tar ' ,
76- Util \Arr::getValue ($ conf , 'pathToTar ' ),
77- Binary::getCommandLocations ('tar ' )
78- );
74+ $ this ->binary = $ this ->detectCommand ('tar ' , Util \Arr::getValue ($ conf , 'pathToTar ' ));
7975 }
8076 }
8177
You can’t perform that action at this time.
0 commit comments