Skip to content

Commit

Permalink
Another small tweaks.
Browse files Browse the repository at this point in the history
Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed May 20, 2014
1 parent 9ed50cd commit aec76d7
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/Support/Ftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,20 @@ public function removeDirectory($directory)
*/
public function connect()
{
$host = array_get($this->config, 'host');
$port = array_get($this->config, 'port');
$user = array_get($this->config, 'user');
$password = array_get($this->config, 'password');
$passive = array_get($this->config, 'passive');
$timeout = array_get($this->config, 'timeout');

if (is_null($host)) {
$config = $this->config;

if (is_null($config['host'])) {
return ;
}

$this->createConnection($host, $port, $timeout);
$this->createConnection($config['host'], $config['port'], $config['timeout']);

if (! (@Facade::login($this->connection, $user, $password))) {
throw new ServerException("Failed FTP login to [{$host}].");
if (! (@Facade::login($this->connection, $config['user'], $config['password']))) {
throw new ServerException("Failed FTP login to [{$config['host']}].");
}

// Set passive mode.
@Facade::pasv($this->connection, (bool) $passive);
@Facade::pasv($this->connection, (bool) $config['passive']);

// Set system type.
$this->systemType = @Facade::systype($this->connection);
Expand Down

0 comments on commit aec76d7

Please sign in to comment.