Skip to content

Commit e40f263

Browse files
elidrissidevfballiano
authored andcommitted
Fixed phpseclib class namespace in Varien_Io_Sftp (#3008)
1 parent 54e2072 commit e40f263

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/Varien/Io/Sftp.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
2020
*/
2121

22-
require_once('phpseclib/Net/SFTP.php');
23-
2422
/**
2523
* Sftp client interface
2624
*
@@ -35,7 +33,7 @@ class Varien_Io_Sftp extends Varien_Io_Abstract implements Varien_Io_Interface
3533
public const SSH2_PORT = 22;
3634

3735
/**
38-
* @var phpseclib\Net\SFTP $_connection
36+
* @var \phpseclib3\Net\SFTP $_connection
3937
*/
4038
protected $_connection = null;
4139

@@ -60,7 +58,7 @@ public function open(array $args = [])
6058
$host = $args['host'];
6159
$port = self::SSH2_PORT;
6260
}
63-
$this->_connection = new phpseclib\Net\SFTP($host, $port, $args['timeout']);
61+
$this->_connection = new \phpseclib3\Net\SFTP($host, $port, $args['timeout']);
6462
if (!$this->_connection->login($args['username'], $args['password'])) {
6563
throw new Exception(sprintf(__("Unable to open SFTP connection as %s@%s", $args['username'], $args['host'])));
6664
}
@@ -117,7 +115,7 @@ public function rmdir($dir, $recursive = false)
117115
$list = $this->_connection->nlist();
118116
if (!count($list)) {
119117
// Go back
120-
$this->_connection->chdir($pwd);
118+
$this->_connection->chdir($cwd);
121119
return $this->rmdir($dir, false);
122120
} else {
123121
foreach ($list as $filename) {
@@ -129,7 +127,7 @@ public function rmdir($dir, $recursive = false)
129127
}
130128
}
131129
}
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));
133131
return $no_errors;
134132
} else {
135133
return $this->_connection->rmdir($dir);
@@ -234,6 +232,6 @@ public function rawls()
234232
*/
235233
public function writeFile($filename, $src)
236234
{
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);
238236
}
239237
}

0 commit comments

Comments
 (0)