3 declare(strict_types=1);
38 $uri = trim($uri,
'/');
40 $split_path = explode(
'/', $uri, 2);
42 if (!isset($split_path[0])
43 || $split_path[0] ===
'' 45 throw new BadRequest(
'Invalid client id given');
48 $path_inside_of_mountpoint = isset($split_path[1]) ? $split_path[1] :
'';
51 if ($path_inside_of_mountpoint !==
'' 52 && substr($path_inside_of_mountpoint, 0, 4) ===
'ref_') {
53 $split_path = explode(
'/', $path_inside_of_mountpoint, 2);
54 $mountpoint = $split_path[0];
55 $path_inside_of_mountpoint = isset($split_path[1]) ? $split_path[1] :
'';
58 if ($mountpoint !==
'') {
67 if ($path_inside_of_mountpoint ===
'') {
76 $relative_mountpoint_ref_id = (
int) explode(
'_', $repository_mountpoint)[1];
78 if ($relative_mountpoint_ref_id < 1) {
79 throw new NotFound(
'Mount point not found');
82 if ($path_inside_of_mountpoint ===
'') {
83 return $relative_mountpoint_ref_id;
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 !==
'') {
100 }
catch (NotFound
$e) {
101 if (count($current_path_array) === 0) {
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');
ilWebDAVRepositoryHelper $webdav_repository_helper
getRefIdFromPathInRepositoryMount(string $path_inside_of_mountpoint)
getChildRefIdByGivenTitle(int $a_parent_ref_id, string $a_searched_title)
getRefIdForWebDAVPath(string $uri)
__construct(ilWebDAVRepositoryHelper $webdav_repository_helper)
getRefIdFromGivenParentRefAndTitlePath(int $a_parent_ref, array $current_path_array)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getRefIdFromPathInRefMount(string $repository_mountpoint, string $path_inside_of_mountpoint)