19declare(strict_types=1);
42 $webRelativeWithLeadingDot,
43 $webRelativeWithoutLeadingDot,
46 $customizingRelativeWithLeadingDot,
48 $libsRelativeWithLeadingDot,
51 $nodeModulesWithLeadingDot
57 $webRelativeWithLeadingDot,
62 $customizingRelativeWithLeadingDot,
65 default =>
throw new \InvalidArgumentException(
66 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"
88 $webRelativeWithLeadingDot,
89 $webRelativeWithoutLeadingDot,
92 $customizingRelativeWithLeadingDot,
94 $libsRelativeWithLeadingDot,
97 $nodeModulesWithLeadingDot
100 return match (
true) {
113 default =>
throw new \InvalidArgumentException(
114 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"
135 $webRelativeWithLeadingDot,
136 $webRelativeWithoutLeadingDot,
139 $customizingRelativeWithLeadingDot,
141 $libsRelativeWithLeadingDot,
144 $nodeModulesWithLeadingDot
147 return match (
true) {
149 $webRelativeWithoutLeadingDot,
153 $webRelativeWithLeadingDot,
164 $customizingRelativeWithLeadingDot,
168 $libsRelativeWithLeadingDot,
172 $nodeModulesWithLeadingDot,
175 default =>
throw new \InvalidArgumentException(
176 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"
183 $real_possible_path = realpath($possible_path);
185 return match (
true) {
186 $possible_path === $absolute_path, $real_possible_path === $absolute_path =>
"",
187 str_starts_with($absolute_path, $possible_path) => substr(
189 strlen($possible_path) + 1
191 str_starts_with($absolute_path, $real_possible_path) => substr(
193 strlen($real_possible_path) + 1
195 default =>
throw new \InvalidArgumentException(
196 "Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'"
203 $real_possible_path = realpath($possible_path);
205 return match (
true) {
206 $possible_path === $absolute_path =>
true,
207 $real_possible_path === $absolute_path =>
true,
208 is_string($possible_path) && str_starts_with($absolute_path, $possible_path) =>
true,
209 is_string($real_possible_path) && str_starts_with($absolute_path, $real_possible_path) =>
true,
223 $customizing = ILIAS_ABSOLUTE_PATH .
'/public/Customizing';
224 $customizingRelativeWithLeadingDot =
'./Customizing';
225 $libs = ILIAS_ABSOLUTE_PATH .
'/vendor';
226 $libsRelativeWithLeadingDot =
"./vendor";
228 $nodeModules = ILIAS_ABSOLUTE_PATH .
'/node_modules';
229 $nodeModulesWithLeadingDot =
'./node_modules';
233 $webRelativeWithLeadingDot,
234 $webRelativeWithoutLeadingDot,
237 $customizingRelativeWithLeadingDot,
239 $libsRelativeWithLeadingDot,
242 $nodeModulesWithLeadingDot
The legacy path helper provides convenient functions for the integration of the filesystem service wi...
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
static deriveLocationFrom(string $absolute_path)
static checkPossiblePath(string $possible_path, string $absolute_path)
static resolveRelativePath(string $possible_path, string $absolute_path)
trait FilesystemsAware
Trait which ease the filesystem integration within legacy ILIAS components.
const TEMPORARY
The ILIAS temporary directory.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
const WEB
The filesystem within the ilias web root.
const STORAGE
The filesystem outside of the ilias web root.
The filesystem interface provides the public interface for the Filesystem service API consumer.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static filesystems()
Returns the loaded filesystems.