ILIAS  release_8 Revision v8.24
ilWebDAVLockUriPathResolver Class Reference
+ Collaboration diagram for ilWebDAVLockUriPathResolver:

Public Member Functions

 __construct (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)
 

Protected Attributes

ilWebDAVRepositoryHelper $webdav_repository_helper
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWebDAVLockUriPathResolver::__construct ( ilWebDAVRepositoryHelper  $webdav_repository_helper)

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

32 {
33 $this->webdav_repository_helper = $webdav_repository_helper;
34 }
ilWebDAVRepositoryHelper $webdav_repository_helper

References $webdav_repository_helper.

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.

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 }

Referenced by getRefIdFromGivenParentRefAndTitlePath().

+ Here is the caller graph for this function:

◆ getRefIdForWebDAVPath()

ilWebDAVLockUriPathResolver::getRefIdForWebDAVPath ( string  $uri)

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

36 : int
37 {
38 $uri = trim($uri, '/');
39
40 $split_path = explode('/', $uri, 2);
41
42 if (!isset($split_path[0])
43 || $split_path[0] === ''
44 || $split_path[0] !== CLIENT_ID) {
45 throw new BadRequest('Invalid client id given');
46 }
47
48 $path_inside_of_mountpoint = isset($split_path[1]) ? $split_path[1] : '';
49 $mountpoint = '';
50
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] : '';
56 }
57
58 if ($mountpoint !== '') {
59 return $this->getRefIdFromPathInRefMount($mountpoint, $path_inside_of_mountpoint);
60 }
61
62 return $this->getRefIdFromPathInRepositoryMount($path_inside_of_mountpoint);
63 }
getRefIdFromPathInRefMount(string $repository_mountpoint, string $path_inside_of_mountpoint)
getRefIdFromPathInRepositoryMount(string $path_inside_of_mountpoint)
const CLIENT_ID
Definition: constants.php:41

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

+ 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.

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 $e) {
101 if (count($current_path_array) === 0) {
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)

References Vendor\Package\$e, and getChildRefIdByGivenTitle().

Referenced by getRefIdFromPathInRefMount(), and getRefIdFromPathInRepositoryMount().

+ 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 74 of file class.ilWebDAVLockUriPathResolver.php.

74 : int
75 {
76 $relative_mountpoint_ref_id = (int) explode('_', $repository_mountpoint)[1];
77
78 if ($relative_mountpoint_ref_id < 1) {
79 throw new NotFound('Mount point not found');
80 }
81
82 if ($path_inside_of_mountpoint === '') {
83 return $relative_mountpoint_ref_id;
84 }
85
86 return $this->getRefIdFromGivenParentRefAndTitlePath($relative_mountpoint_ref_id, explode('/', $path_inside_of_mountpoint));
87 }
getRefIdFromGivenParentRefAndTitlePath(int $a_parent_ref, array $current_path_array)

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

Referenced by getRefIdForWebDAVPath().

+ 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 65 of file class.ilWebDAVLockUriPathResolver.php.

65 : int
66 {
67 if ($path_inside_of_mountpoint === '') {
68 return ROOT_FOLDER_ID;
69 }
70
71 return $this->getRefIdFromGivenParentRefAndTitlePath(ROOT_FOLDER_ID, explode('/', $path_inside_of_mountpoint));
72 }
const ROOT_FOLDER_ID
Definition: constants.php:32

References getRefIdFromGivenParentRefAndTitlePath(), and ROOT_FOLDER_ID.

Referenced by getRefIdForWebDAVPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $webdav_repository_helper

ilWebDAVRepositoryHelper ilWebDAVLockUriPathResolver::$webdav_repository_helper
protected

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

Referenced by __construct().


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