Ferreteria/v0.6/clade/IO/Aspect/Connx/Plug/Shell/Remote/SSH/@removed
Jump to navigation
Jump to search
|
Removed Code
|
2026-01-09
Commented out yesterday:
#
// 2026-01-08 Does anything use this anymore?
public function RunProcess(CmdLineIface $oCmd) : ProcIface {
$oCmdFull = $this->WrapCommand($oCmd);
return parent::RunProcess($oCmdFull);
}
*/
// -- ACTION -- //
// ++ FIGURING ++ //
// 2026-01-08 ACTUALLY NO -- just use ssh2_exec() or ssh2_connect(), hey?
protected function WrapCommand(CmdLineIface $oCmd) : CmdLineIface {
// [+STANDARD CODE]: get connection specs
$oCred = $this->OCred();
$oSock = $this->OSock();
$oHost = $oSock->OHost();
$sUser = $oCred->QSUser()->GetIt();
$sHost = $oHost->QSAddr()->GetIt();
$onPort = $oHost->QIPort();
// [-STANDARD CODE]
$oCmdPfx = $oCmd->SpawnBlank();
$oCmdPfx->AddString('ssh');
if ($onPort->HasIt()) {
$nPort = $onPort->GetIt();
#$sPort = ' -p '.$nPort;
$oCmdPfx->AddArray(['-p',$nPort]);
}
$oCmdPfx->AddString("$sUser@$sHost");
$oCmd->EmbedWithin($oCmdPfx);
return $oCmd;
}
2026-01-08
Commented out yesterday:
#
// 2026-01-07 old API v2
public function DoCommand(string|array $saCmd, StreamIface $oResps) : CommOpIface {
$sCmdFull = $this->WrapCommand($saCmd);
return parent::DoCommand($sCmdFull,$oResps);
}
#
// 2026-01-07 old API
// 2025-03-29 FUTURE: maybe this should always return an array -- but that's harder to debug.
protected function WrapCommand(string|array $saCmd) : string {
// [+STANDARD CODE]: get connection specs
$oCred = $this->OCred();
$oSock = $this->OSock();
$oHost = $oSock->OHost();
$sUser = $oCred->QSUser()->GetIt();
$sHost = $oHost->QSAddr()->GetIt();
$onPort = $oHost->QIPort();
// [-STANDARD CODE]
if ($onPort->HasIt()) {
$nPort = $onPort->GetIt();
$sPort = ' -p '.$nPort;
} else {
$sPort = '';
}
$sCmdSafe = escapeshellarg($saCmd);
$sCmdFull = "ssh$sPort $sUser@$sHost $sCmdSafe";
return $sCmdFull;
}
#
// 2026-01-07 old API
public function RunProcess(string|array $saCmd) : ProcIface {
$sCmdFull = $this->WrapCommand($saCmd);
return parent::RunProcess($sCmdFull);
}
#
// 2025-12-28 old API v1
public function DoCommand(string|array $saCmd, StreamIface $oResps, ?CommOpIface $oAct=NULL) : CommOpIface {
$sCmdFull = $this->WrapCommand($saCmd);
$oAct = parent::DoCommand($sCmdFull,$oResps,$oAct);
return $oAct;
}
2025-12-04
Commented out from DoCommand() earlier:
#
$oAct = $this->NewAction();
$oCreds = $this->Creds();
$sHost = $oCreds->QHost()->GetIt();
$sUser = $oCreds->QUser()->GetIt();
$sPort = $oCreds->QPort()->GetStrNz('',' -p ');
$sCmdSafe = escapeshellarg($sCmd);
$sCmdFull = "ssh$sPort $sUser@$sHost $sCmdSafe";
2025-06-03
#
// 2025-05-28 old
public function __construct(private CredsIface $oCreds) {
$oCreds->QPort()->SetDefault(22); // SSH default port
}
public function Creds() : CredsIface { return $this->oCreds; }
2024-12-03
It looks like this was moved to ../Opener.php:
#
private int $nOpens = 0;
public function Open() : ActionIface {
$nOpens = $this->nOpens++;
if ($nOpens == 0) {
$oAct = $this->ActualOpen();
} else {
$oAct = new ActionIface();
$oAct->SetNoOp();
}
return $oAct;
}
public function Shut() : ActionIface {
$nOpens = --$this->nOpens;
if ($nOpens == 0) {
$oAct = $this->ActualShut();
} else {
$oAct = new ActionIface();
$oAct->SetNoOp();
}
return $oAct;
}
2024-11-27
This never worked anyway -- gives a "Segmentation fault (core dumped)" error -- but that's ok, because ssh2_auth_agent() was the one I wanted to use anyway. I only tried this when that wasn't working (which turned out to be because you have to explicitly add keys to the SSH Agent).
This was in Open(), in place of the ssh2_auth_agent() call:
#
$ok = ssh2_auth_pubkey_file($rSSH,$sUser,'/home/woozle/.ssh/id_ed25519.pub','/home/woozle/.ssh/id_ed25519');