Skip to content

Commit

Permalink
Fixed phpseclib class namespace in Varien_Io_Sftp (#3008)
Browse files Browse the repository at this point in the history
  • Loading branch information
elidrissidev authored and fballiano committed Feb 4, 2023
1 parent 54e2072 commit e40f263
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/Varien/Io/Sftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

require_once('phpseclib/Net/SFTP.php');

/**
* Sftp client interface
*
Expand All @@ -35,7 +33,7 @@ class Varien_Io_Sftp extends Varien_Io_Abstract implements Varien_Io_Interface
public const SSH2_PORT = 22;

/**
* @var phpseclib\Net\SFTP $_connection
* @var \phpseclib3\Net\SFTP $_connection
*/
protected $_connection = null;

Expand All @@ -60,7 +58,7 @@ public function open(array $args = [])
$host = $args['host'];
$port = self::SSH2_PORT;
}
$this->_connection = new phpseclib\Net\SFTP($host, $port, $args['timeout']);
$this->_connection = new \phpseclib3\Net\SFTP($host, $port, $args['timeout']);
if (!$this->_connection->login($args['username'], $args['password'])) {
throw new Exception(sprintf(__("Unable to open SFTP connection as %s@%s", $args['username'], $args['host'])));
}
Expand Down Expand Up @@ -117,7 +115,7 @@ public function rmdir($dir, $recursive = false)
$list = $this->_connection->nlist();
if (!count($list)) {
// Go back
$this->_connection->chdir($pwd);
$this->_connection->chdir($cwd);
return $this->rmdir($dir, false);
} else {
foreach ($list as $filename) {
Expand All @@ -129,7 +127,7 @@ public function rmdir($dir, $recursive = false)
}
}
}
$no_errors = $no_errors && ($this->_connection->chdir($pwd) && $this->_connection->rmdir($dir));
$no_errors = $no_errors && ($this->_connection->chdir($cwd) && $this->_connection->rmdir($dir));
return $no_errors;
} else {
return $this->_connection->rmdir($dir);
Expand Down Expand Up @@ -234,6 +232,6 @@ public function rawls()
*/
public function writeFile($filename, $src)
{
return $this->_connection->put($filename, $src, phpseclib\Net\SFTP::SOURCE_LOCAL_FILE);
return $this->_connection->put($filename, $src, \phpseclib3\Net\SFTP::SOURCE_LOCAL_FILE);
}
}

0 comments on commit e40f263

Please sign in to comment.