ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilWebDAVLockUriPathResolver Class Reference
+ Collaboration diagram for ilWebDAVLockUriPathResolver:

Public Member Functions

 __construct (protected ilWebDAVRepositoryHelper $webdav_repository_helper)
 
 getRefIdForWebDAVPath (string $uri)
 

Protected Member Functions

 getRefIdFromPathInRepositoryMount (string $path_inside_of_mountpoint)
 
 getRefIdFromPathInRefMount (string $repository_mountpoint, string $path_inside_of_mountpoint)
 
 getRefIdFromGivenParentRefAndTitlePath (int $a_parent_ref, array $current_path_array)
 
 getChildRefIdByGivenTitle (int $a_parent_ref_id, string $a_searched_title)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLockUriPathResolver::__construct ( protected ilWebDAVRepositoryHelper  $webdav_repository_helper)

Definition at line 29 of file class.ilWebDAVLockUriPathResolver.php.

30  {
31  }

Member Function Documentation

◆ getChildRefIdByGivenTitle()

ilWebDAVLockUriPathResolver::getChildRefIdByGivenTitle ( int  $a_parent_ref_id,
string  $a_searched_title 
)
protected

Definition at line 115 of file class.ilWebDAVLockUriPathResolver.php.

References null.

Referenced by getRefIdFromGivenParentRefAndTitlePath().

115  : int
116  {
117  $ref_to_return = null;
118 
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;
123  }
124  }
125 
126  if (!is_null($ref_to_return)) {
127  return $ref_to_return;
128  }
129 
130  throw new NotFound('Node not found');
131  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getRefIdForWebDAVPath()

ilWebDAVLockUriPathResolver::getRefIdForWebDAVPath ( string  $uri)

Definition at line 33 of file class.ilWebDAVLockUriPathResolver.php.

References CLIENT_ID, getRefIdFromPathInRefMount(), and getRefIdFromPathInRepositoryMount().

33  : int
34  {
35  $uri = trim($uri, '/');
36 
37  $split_path = explode('/', $uri, 2);
38 
39  if (!isset($split_path[0])
40  || $split_path[0] === ''
41  || $split_path[0] !== CLIENT_ID) {
42  throw new BadRequest('Invalid client id given');
43  }
44 
45  $path_inside_of_mountpoint = $split_path[1] ?? '';
46  $mountpoint = '';
47 
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] ?? '';
53  }
54 
55  if ($mountpoint !== '') {
56  return $this->getRefIdFromPathInRefMount($mountpoint, $path_inside_of_mountpoint);
57  }
58 
59  return $this->getRefIdFromPathInRepositoryMount($path_inside_of_mountpoint);
60  }
getRefIdFromPathInRepositoryMount(string $path_inside_of_mountpoint)
const CLIENT_ID
Definition: constants.php:41
getRefIdFromPathInRefMount(string $repository_mountpoint, string $path_inside_of_mountpoint)
+ Here is the call graph for this function:

◆ getRefIdFromGivenParentRefAndTitlePath()

ilWebDAVLockUriPathResolver::getRefIdFromGivenParentRefAndTitlePath ( int  $a_parent_ref,
array  $current_path_array 
)
protected
Parameters
string[]$current_path_array

Definition at line 92 of file class.ilWebDAVLockUriPathResolver.php.

References getChildRefIdByGivenTitle().

Referenced by getRefIdFromPathInRefMount(), and getRefIdFromPathInRepositoryMount().

92  : int
93  {
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 !== '') {
98  try {
99  $current_ref_id = $this->getChildRefIdByGivenTitle($current_ref_id, $next_searched_title);
100  } catch (NotFound) {
101  if ($current_path_array === []) {
102  /* This is a really special case. It occurs, if the lock is meant for an object that does not
103  exist yet (so called NullRessources) since we can't and won't lock non existing objects, we
104  set the Exception code to -1. The receiving class SHOULD handle what to do with this value */
105  throw new NotFound('Last node not found', -1);
106  }
107 
108  throw new NotFound('Node not found', 0);
109  }
110  }
111  }
112  return $current_ref_id;
113  }
getChildRefIdByGivenTitle(int $a_parent_ref_id, string $a_searched_title)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefIdFromPathInRefMount()

ilWebDAVLockUriPathResolver::getRefIdFromPathInRefMount ( string  $repository_mountpoint,
string  $path_inside_of_mountpoint 
)
protected

Definition at line 71 of file class.ilWebDAVLockUriPathResolver.php.

References getRefIdFromGivenParentRefAndTitlePath(), and ILIAS\Repository\int().

Referenced by getRefIdForWebDAVPath().

71  : int
72  {
73  $relative_mountpoint_ref_id = (int) explode('_', $repository_mountpoint)[1];
74 
75  if ($relative_mountpoint_ref_id < 1) {
76  throw new NotFound('Mount point not found');
77  }
78 
79  if ($path_inside_of_mountpoint === '') {
80  return $relative_mountpoint_ref_id;
81  }
82 
84  $relative_mountpoint_ref_id,
85  explode('/', $path_inside_of_mountpoint)
86  );
87  }
getRefIdFromGivenParentRefAndTitlePath(int $a_parent_ref, array $current_path_array)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRefIdFromPathInRepositoryMount()

ilWebDAVLockUriPathResolver::getRefIdFromPathInRepositoryMount ( string  $path_inside_of_mountpoint)
protected

Definition at line 62 of file class.ilWebDAVLockUriPathResolver.php.

References getRefIdFromGivenParentRefAndTitlePath(), and ROOT_FOLDER_ID.

Referenced by getRefIdForWebDAVPath().

62  : int
63  {
64  if ($path_inside_of_mountpoint === '') {
65  return ROOT_FOLDER_ID;
66  }
67 
68  return $this->getRefIdFromGivenParentRefAndTitlePath(ROOT_FOLDER_ID, explode('/', $path_inside_of_mountpoint));
69  }
const ROOT_FOLDER_ID
Definition: constants.php:32
getRefIdFromGivenParentRefAndTitlePath(int $a_parent_ref, array $current_path_array)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: