File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed
Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 33.idea
44.env
55.project
6+ .phpunit.result.cache
67.settings
78/backup /*
89/build /coverage
Original file line number Diff line number Diff line change 22 "type" : " sftp" ,
33 "options" : {
44 "host" : " backup.example.com" ,
5+ "port" : " 22" ,
56 "user" : " user.name" ,
67 "password" : " mySecret" ,
78 "key" : " someDir/id_rsa" ,
Original file line number Diff line number Diff line change 99 <!-- optional, if key presented it is used as key password -->
1010 <option name =" password" value =" mysecret" />
1111
12+ <!-- optional, default 22 -->
13+ <option name =" port" value =" 22" />
14+
1215 <!-- optional -->
1316 <option name =" key" value =" somedir/id_rsa" />
1417
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ class Sftp extends Xtp
3434 */
3535 protected $ remotePath ;
3636
37+ /**
38+ * Remote port of sftp server
39+ *
40+ * @var string
41+ */
42+ protected $ port ;
43+
3744 /**
3845 * @var int
3946 */
@@ -72,6 +79,7 @@ public function setup(array $config)
7279 }
7380 $ this ->privateKey = $ privateKey ;
7481 $ this ->remotePath = new Path ($ config ['path ' ], $ this ->time );
82+ $ this ->port = Util \Arr::getValue ($ config , 'port ' , '22 ' );
7583
7684 $ this ->setUpCleanable ($ config );
7785 }
@@ -145,7 +153,7 @@ protected function createClient() : phpseclib\Net\SFTP
145153 if (!$ this ->sftp ) {
146154 // silence phpseclib errors
147155 $ old = error_reporting (0 );
148- $ this ->sftp = new phpseclib \Net \SFTP ($ this ->host );
156+ $ this ->sftp = new phpseclib \Net \SFTP ($ this ->host , $ this -> port );
149157 $ auth = $ this ->getAuth ();
150158
151159 if (!$ this ->sftp ->login ($ this ->user , $ auth )) {
You can’t perform that action at this time.
0 commit comments