Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
style(PHP): code cleanup, no effective changes
Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Jul 10, 2025
commit 80f891eee0791f5aa010a4068cb7526a8e561192
18 changes: 7 additions & 11 deletions apps/files_external/lib/Lib/Backend/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ public function __construct(IL10N $l, Password $legacyAuth) {
->setLegacyAuthMechanism($legacyAuth);
}

/**
* @return void
*/
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
$auth = $storage->getAuthMechanism();
if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) {
if (!is_string($storage->getBackendOption('user')) || !is_string($storage->getBackendOption('password'))) {
Expand Down Expand Up @@ -93,26 +90,25 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
} else {
try {
$credentials = $credentialsStore->getLoginCredentials();
$user = $credentials->getLoginName();
$loginName = $credentials->getLoginName();
$pass = $credentials->getPassword();
preg_match('/(.*)@(.*)/', $user, $matches);
preg_match('/(.*)@(.*)/', $loginName, $matches);
$realm = $storage->getBackendOption('default_realm');
if (empty($realm)) {
$realm = 'WORKGROUP';
}
if (count($matches) === 0) {
$username = $user;
$username = $loginName;
$workgroup = $realm;
} else {
$username = $matches[1];
$workgroup = $matches[2];
[, $username, $workgroup] = $matches;
}
$smbAuth = new BasicAuth(
$username,
$workgroup,
$pass
);
} catch (\Exception $e) {
} catch (\Exception) {
throw new InsufficientDataForMeaningfulAnswerException('No session credentials saved');
}
}
Expand All @@ -126,7 +122,7 @@ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user =
$storage->setBackendOption('auth', $smbAuth);
}

public function checkDependencies() {
public function checkDependencies(): array {
$system = \OCP\Server::get(SystemBridge::class);
if (NativeServer::available($system)) {
return [];
Expand Down
Loading