mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
check if we can find smbclient in path
This commit is contained in:
parent
82f961896f
commit
7ddcd96e47
3 changed files with 24 additions and 3 deletions
|
|
@ -153,7 +153,7 @@ class Server {
|
|||
* @return \Icewind\SMB\IShare
|
||||
*/
|
||||
public function getShare($name) {
|
||||
return new Share($this, $name);
|
||||
return new Share($this, $name, $this->system);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,17 +43,22 @@ class Share extends AbstractShare {
|
|||
/**
|
||||
* @param Server $server
|
||||
* @param string $name
|
||||
* @param System $system
|
||||
*/
|
||||
public function __construct($server, $name) {
|
||||
public function __construct($server, $name, System $system = null) {
|
||||
parent::__construct();
|
||||
$this->server = $server;
|
||||
$this->name = $name;
|
||||
$this->system = new System();
|
||||
$this->system = (!is_null($system)) ? $system : new System();
|
||||
$this->parser = new Parser(new TimeZoneProvider($this->server->getHost(), $this->system));
|
||||
}
|
||||
|
||||
protected function getConnection() {
|
||||
$workgroupArgument = ($this->server->getWorkgroup()) ? ' -W ' . escapeshellarg($this->server->getWorkgroup()) : '';
|
||||
$smbClientPath = $this->system->getSmbclientPath();
|
||||
if (!$smbClientPath) {
|
||||
throw new DependencyException('Can\'t find smbclient binary in path');
|
||||
}
|
||||
$command = sprintf('%s%s %s --authentication-file=%s %s',
|
||||
$this->system->hasStdBuf() ? 'stdbuf -o0 ' : '',
|
||||
$this->system->getSmbclientPath(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue