removing without skeleton files string from the user creation steps

This commit is contained in:
Niraj Acharya
2024-11-29 09:39:21 +05:45
parent a265fcbe46
commit c98841904d
219 changed files with 663 additions and 804 deletions

View File

@@ -181,79 +181,6 @@ class OcisHelper {
\closedir($dir);
}
/**
* Helper for Recursive Upload of file/folder
*
* @param string|null $baseUrl
* @param string|null $source
* @param string|null $userId
* @param string|null $password
* @param string|null $xRequestId
* @param string|null $destination
*
* @return void
* @throws Exception|GuzzleException
*/
public static function recurseUpload(
?string $baseUrl,
?string $source,
?string $userId,
?string $password,
?string $xRequestId = '',
?string $destination = ''
):void {
if ($destination !== '') {
$response = WebDavHelper::makeDavRequest(
$baseUrl,
$userId,
$password,
"MKCOL",
$destination,
[],
null,
$xRequestId
);
if ($response->getStatusCode() !== 201) {
throw new Exception("Could not create folder destination" . $response->getBody()->getContents());
}
}
$dir = \opendir($source);
while (($file = \readdir($dir)) !== false) {
if (($file != '.') && ($file != '..')) {
$sourcePath = $source . '/' . $file;
$destinationPath = $destination . '/' . $file;
if (\is_dir($sourcePath)) {
self::recurseUpload(
$baseUrl,
$sourcePath,
$userId,
$password,
$xRequestId,
$destinationPath
);
} else {
$response = UploadHelper::upload(
$baseUrl,
$userId,
$password,
$sourcePath,
$destinationPath,
$xRequestId
);
$responseStatus = $response->getStatusCode();
if ($responseStatus !== 201) {
throw new Exception(
"Could not upload skeleton file $sourcePath to $destinationPath for user '$userId' status '$responseStatus' response body: '"
. $response->getBody()->getContents() . "'"
);
}
}
}
}
\closedir($dir);
}
/**
* @return int
*/