19
19
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
20
*/
21
21
22
- require_once ('phpseclib/Net/SFTP.php ' );
23
-
24
22
/**
25
23
* Sftp client interface
26
24
*
@@ -35,7 +33,7 @@ class Varien_Io_Sftp extends Varien_Io_Abstract implements Varien_Io_Interface
35
33
public const SSH2_PORT = 22 ;
36
34
37
35
/**
38
- * @var phpseclib \Net\SFTP $_connection
36
+ * @var \phpseclib3 \Net\SFTP $_connection
39
37
*/
40
38
protected $ _connection = null ;
41
39
@@ -60,7 +58,7 @@ public function open(array $args = [])
60
58
$ host = $ args ['host ' ];
61
59
$ port = self ::SSH2_PORT ;
62
60
}
63
- $ this ->_connection = new phpseclib \Net \SFTP ($ host , $ port , $ args ['timeout ' ]);
61
+ $ this ->_connection = new \ phpseclib3 \Net \SFTP ($ host , $ port , $ args ['timeout ' ]);
64
62
if (!$ this ->_connection ->login ($ args ['username ' ], $ args ['password ' ])) {
65
63
throw new Exception (sprintf (__ ("Unable to open SFTP connection as %s@%s " , $ args ['username ' ], $ args ['host ' ])));
66
64
}
@@ -117,7 +115,7 @@ public function rmdir($dir, $recursive = false)
117
115
$ list = $ this ->_connection ->nlist ();
118
116
if (!count ($ list )) {
119
117
// Go back
120
- $ this ->_connection ->chdir ($ pwd );
118
+ $ this ->_connection ->chdir ($ cwd );
121
119
return $ this ->rmdir ($ dir , false );
122
120
} else {
123
121
foreach ($ list as $ filename ) {
@@ -129,7 +127,7 @@ public function rmdir($dir, $recursive = false)
129
127
}
130
128
}
131
129
}
132
- $ no_errors = $ no_errors && ($ this ->_connection ->chdir ($ pwd ) && $ this ->_connection ->rmdir ($ dir ));
130
+ $ no_errors = $ no_errors && ($ this ->_connection ->chdir ($ cwd ) && $ this ->_connection ->rmdir ($ dir ));
133
131
return $ no_errors ;
134
132
} else {
135
133
return $ this ->_connection ->rmdir ($ dir );
@@ -234,6 +232,6 @@ public function rawls()
234
232
*/
235
233
public function writeFile ($ filename , $ src )
236
234
{
237
- return $ this ->_connection ->put ($ filename , $ src , phpseclib \Net \SFTP ::SOURCE_LOCAL_FILE );
235
+ return $ this ->_connection ->put ($ filename , $ src , \ phpseclib3 \Net \SFTP ::SOURCE_LOCAL_FILE );
238
236
}
239
237
}
0 commit comments