1 | <?php |
||
16 | class NativeServer extends AbstractServer { |
||
17 | /** |
||
18 | * @var NativeState |
||
19 | */ |
||
20 | protected $state; |
||
21 | |||
22 | 257 | public function __construct($host, IAuth $auth, ISystem $system, TimeZoneProvider $timeZoneProvider, IOptions $options) { |
|
26 | |||
27 | 1 | protected function connect() { |
|
30 | |||
31 | /** |
||
32 | * @return \Icewind\SMB\IShare[] |
||
33 | * @throws \Icewind\SMB\Exception\AuthenticationException |
||
34 | * @throws \Icewind\SMB\Exception\InvalidHostException |
||
35 | */ |
||
36 | 1 | public function listShares() { |
|
37 | 1 | $this->connect(); |
|
38 | 1 | $shares = []; |
|
39 | 1 | $dh = $this->state->opendir('smb://' . $this->getHost()); |
|
40 | 1 | while ($share = $this->state->readdir($dh)) { |
|
41 | 1 | if ($share['type'] === 'file share') { |
|
42 | 1 | $shares[] = $this->getShare($share['name']); |
|
43 | } |
||
44 | } |
||
45 | 1 | $this->state->closedir($dh); |
|
46 | 1 | return $shares; |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param string $name |
||
51 | * @return \Icewind\SMB\IShare |
||
52 | */ |
||
53 | 256 | public function getShare($name) { |
|
56 | |||
57 | /** |
||
58 | * Check if the smbclient php extension is available |
||
59 | * |
||
60 | * @param ISystem $system |
||
61 | * @return bool |
||
62 | */ |
||
63 | 7 | public static function available(ISystem $system) { |
|
66 | } |
||
67 |