19 declare(strict_types=1);
35 $uri = trim($uri,
'/');
37 $split_path = explode(
'/', $uri, 2);
39 if (!isset($split_path[0])
40 || $split_path[0] ===
'' 42 throw new BadRequest(
'Invalid client id given');
45 $path_inside_of_mountpoint = $split_path[1] ??
'';
48 if ($path_inside_of_mountpoint !==
'' 49 && str_starts_with($path_inside_of_mountpoint,
'ref_')) {
50 $split_path = explode(
'/', $path_inside_of_mountpoint, 2);
51 $mountpoint = $split_path[0];
52 $path_inside_of_mountpoint = $split_path[1] ??
'';
55 if ($mountpoint !==
'') {
64 if ($path_inside_of_mountpoint ===
'') {
73 $relative_mountpoint_ref_id = (
int) explode(
'_', $repository_mountpoint)[1];
75 if ($relative_mountpoint_ref_id < 1) {
76 throw new NotFound(
'Mount point not found');
79 if ($path_inside_of_mountpoint ===
'') {
80 return $relative_mountpoint_ref_id;
84 $relative_mountpoint_ref_id,
85 explode(
'/', $path_inside_of_mountpoint)
94 $current_ref_id = $a_parent_ref;
95 while (count($current_path_array) >= 1) {
96 $next_searched_title = array_shift($current_path_array);
97 if ($next_searched_title !==
'') {
101 if ($current_path_array === []) {
105 throw new NotFound(
'Last node not found', -1);
108 throw new NotFound(
'Node not found', 0);
112 return $current_ref_id;
117 $ref_to_return =
null;
119 foreach ($this->webdav_repository_helper->getChildrenOfRefId($a_parent_ref_id) as $child_ref) {
120 $child_title = $this->webdav_repository_helper->getObjectTitleFromRefId($child_ref,
true);
121 if ($a_searched_title === $child_title) {
122 $ref_to_return = $child_ref;
126 if (!is_null($ref_to_return)) {
127 return $ref_to_return;
130 throw new NotFound(
'Node not found');
getRefIdFromPathInRepositoryMount(string $path_inside_of_mountpoint)
getChildRefIdByGivenTitle(int $a_parent_ref_id, string $a_searched_title)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(protected ilWebDAVRepositoryHelper $webdav_repository_helper)
getRefIdForWebDAVPath(string $uri)
getRefIdFromGivenParentRefAndTitlePath(int $a_parent_ref, array $current_path_array)
getRefIdFromPathInRefMount(string $repository_mountpoint, string $path_inside_of_mountpoint)