|  | 
| 10 | 10 | use Icewind\SMB\BasicAuth; | 
| 11 | 11 | use Icewind\SMB\KerberosApacheAuth; | 
| 12 | 12 | use Icewind\SMB\KerberosAuth; | 
|  | 13 | +use Icewind\SMB\Native\NativeServer; | 
|  | 14 | +use Icewind\SMB\Wrapped\Server; | 
| 13 | 15 | use OCA\Files_External\Lib\Auth\AuthMechanism; | 
| 14 | 16 | use OCA\Files_External\Lib\Auth\Password\Password; | 
| 15 | 17 | use OCA\Files_External\Lib\Auth\SMB\KerberosApacheAuth as KerberosApacheAuthMechanism; | 
| 16 | 18 | use OCA\Files_External\Lib\DefinitionParameter; | 
| 17 | 19 | use OCA\Files_External\Lib\InsufficientDataForMeaningfulAnswerException; | 
| 18 |  | -use OCA\Files_External\Lib\LegacyDependencyCheckPolyfill; | 
|  | 20 | +use OCA\Files_External\Lib\MissingDependency; | 
|  | 21 | +use OCA\Files_External\Lib\Storage\SystemBridge; | 
| 19 | 22 | use OCA\Files_External\Lib\StorageConfig; | 
| 20 | 23 | use OCP\IL10N; | 
| 21 | 24 | use OCP\IUser; | 
| 22 | 25 | 
 | 
| 23 | 26 | class SMB extends Backend { | 
| 24 |  | -	use LegacyDependencyCheckPolyfill; | 
| 25 |  | - | 
| 26 | 27 | 	public function __construct(IL10N $l, Password $legacyAuth) { | 
| 27 | 28 | 		$this | 
| 28 | 29 | 			->setIdentifier('smb') | 
| @@ -122,4 +123,20 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = | 
| 122 | 123 | 
 | 
| 123 | 124 | 		$storage->setBackendOption('auth', $smbAuth); | 
| 124 | 125 | 	} | 
|  | 126 | + | 
|  | 127 | +	public function checkDependencies() { | 
|  | 128 | +		$system = \OCP\Server::get(SystemBridge::class); | 
|  | 129 | +		if (NativeServer::available($system)) { | 
|  | 130 | +			return []; | 
|  | 131 | +		} elseif (Server::available($system)) { | 
|  | 132 | +			$missing = new MissingDependency('php-smbclient'); | 
|  | 133 | +			$missing->setOptional(true); | 
|  | 134 | +			$missing->setMessage('The php-smbclient library provides improved compatibility and performance for SMB storages.'); | 
|  | 135 | +			return [$missing]; | 
|  | 136 | +		} else { | 
|  | 137 | +			$missing = new MissingDependency('php-smbclient'); | 
|  | 138 | +			$missing->setMessage('Either the php-smbclient library (preferred) or the smbclient binary is required for SMB storages.'); | 
|  | 139 | +			return [$missing, new MissingDependency('smbclient')]; | 
|  | 140 | +		} | 
|  | 141 | +	} | 
| 125 | 142 | } | 
0 commit comments