Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 9, 10 & 11 compatibility + phpseclib v3 #93

Open
wants to merge 8 commits into
base: 6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "laravelcollective/remote",
"name": "whitecube/remote",
"description": "Remote SSH access for The Laravel Framework.",
"license": "MIT",
"homepage": "http://laravelcollective.com",
Expand All @@ -19,12 +19,12 @@
],
"require": {
"php": ">=7.2",
"illuminate/support": "^6.0|^7.0|^8.0",
"illuminate/filesystem": "^6.0|^7.0|^8.0",
"phpseclib/phpseclib": "^2.0"
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/filesystem": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"phpseclib/phpseclib": "^3.0"
},
"require-dev": {
"illuminate/console": "^6.0|^7.0|^8.0",
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~5.5"
},
Expand Down
15 changes: 2 additions & 13 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,9 @@ public function run($commands, Closure $callback = null, int $timeout = null)
$gateway->setTimeout($timeout);
}

$callback = $this->getCallback($callback);
$result = $gateway->run($this->formatCommands($commands));

$gateway->run($this->formatCommands($commands));

// After running the commands against the server, we will continue to ask for
// the next line of output that is available, and write it them out using
// our callback. Once we hit the end of output, we'll bail out of here.
while (true) {
if (is_null($line = $gateway->nextLine())) {
break;
}

call_user_func($callback, $line, $this);
}
call_user_func($this->getCallback($callback), $result);
}

/**
Expand Down
16 changes: 7 additions & 9 deletions src/SecLibGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Collective\Remote;

use phpseclib\Net\SFTP;
use phpseclib\Net\SSH2;
use phpseclib\Crypt\RSA;
use phpseclib3\Net\SFTP;
use phpseclib3\Net\SSH2;
use phpseclib3\Crypt\RSA;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use phpseclib\System\SSH\Agent;
use phpseclib3\System\SSH\Agent;
use Illuminate\Filesystem\Filesystem;

class SecLibGateway implements GatewayInterface
Expand Down Expand Up @@ -280,11 +280,11 @@ public function connected()
*
* @param string $command
*
* @return void
* @return string|bool
*/
public function run($command)
{
$this->getConnection()->exec($command, false);
return $this->getConnection()->exec($command, null);
}

/**
Expand Down Expand Up @@ -382,9 +382,7 @@ public function delete($remote)
*/
public function nextLine()
{
$value = $this->getConnection()->_get_channel_packet(SSH2::CHANNEL_EXEC);

return $value === true ? null : $value;
return null;
}

/**
Expand Down