3 declare(strict_types=1);
45 $webRelativeWithLeadingDot,
46 $webRelativeWithoutLeadingDot,
49 $customizingRelativeWithLeadingDot,
51 $libsRelativeWithLeadingDot,
54 $nodeModulesWithLeadingDot
55 ] = self::listPaths();
58 case self::checkPossiblePath($temp, $absolute_path):
59 return Location::TEMPORARY;
60 case self::checkPossiblePath($web, $absolute_path):
61 case self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path):
62 case self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path):
64 case self::checkPossiblePath($storage, $absolute_path):
65 return Location::STORAGE;
66 case self::checkPossiblePath($customizing, $absolute_path):
67 case self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path):
68 return Location::CUSTOMIZING;
70 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
91 $webRelativeWithLeadingDot,
92 $webRelativeWithoutLeadingDot,
95 $customizingRelativeWithLeadingDot,
97 $libsRelativeWithLeadingDot,
100 $nodeModulesWithLeadingDot
101 ] = self::listPaths();
104 case self::checkPossiblePath($temp, $absolute_path):
106 case self::checkPossiblePath($web, $absolute_path):
108 case self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path):
110 case self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path):
112 case self::checkPossiblePath($storage, $absolute_path):
114 case self::checkPossiblePath($customizing, $absolute_path):
116 case self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path):
118 case self::checkPossiblePath($libs, $absolute_path):
120 case self::checkPossiblePath($libsRelativeWithLeadingDot, $absolute_path):
122 case self::checkPossiblePath($nodeModules, $absolute_path):
124 case self::checkPossiblePath($nodeModulesWithLeadingDot, $absolute_path):
127 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
148 $webRelativeWithLeadingDot,
149 $webRelativeWithoutLeadingDot,
152 $customizingRelativeWithLeadingDot,
154 $libsRelativeWithLeadingDot,
157 $nodeModulesWithLeadingDot
158 ] = self::listPaths();
162 case self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path):
163 return self::resolveRelativePath($webRelativeWithoutLeadingDot, $absolute_path);
165 case self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path):
166 return self::resolveRelativePath($webRelativeWithLeadingDot, $absolute_path);
168 case self::checkPossiblePath($web, $absolute_path):
169 return self::resolveRelativePath($web, $absolute_path);
171 case self::checkPossiblePath($temp, $absolute_path):
172 return self::resolveRelativePath($temp, $absolute_path);
174 case self::checkPossiblePath($storage, $absolute_path):
175 return self::resolveRelativePath($storage, $absolute_path);
177 case self::checkPossiblePath($customizing, $absolute_path):
178 return self::resolveRelativePath($customizing, $absolute_path);
180 case self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path):
181 return self::resolveRelativePath($customizingRelativeWithLeadingDot, $absolute_path);
183 case self::checkPossiblePath($libs, $absolute_path):
185 case self::checkPossiblePath($libsRelativeWithLeadingDot, $absolute_path):
186 return self::resolveRelativePath($libsRelativeWithLeadingDot, $absolute_path);
188 case self::checkPossiblePath($nodeModules, $absolute_path):
190 case self::checkPossiblePath($nodeModulesWithLeadingDot, $absolute_path):
191 return self::resolveRelativePath($nodeModulesWithLeadingDot, $absolute_path);
193 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
200 $real_possible_path = realpath($possible_path);
203 case $possible_path === $absolute_path:
204 case $real_possible_path === $absolute_path:
206 case strpos($absolute_path, $possible_path) === 0:
209 strlen($possible_path) + 1
211 case strpos($absolute_path, $real_possible_path) === 0:
214 strlen($real_possible_path) + 1
217 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
230 $real_possible_path = realpath($possible_path);
233 case $possible_path === $absolute_path:
235 case $real_possible_path === $absolute_path:
237 case is_string($possible_path) && strpos($absolute_path, $possible_path) === 0:
239 case is_string($real_possible_path) && strpos($absolute_path, $real_possible_path) === 0:
256 $customizing = ILIAS_ABSOLUTE_PATH .
'/Customizing';
257 $customizingRelativeWithLeadingDot =
'./Customizing';
258 $libs = ILIAS_ABSOLUTE_PATH .
'/libs';
259 $libsRelativeWithLeadingDot =
"./libs";
261 $nodeModules = ILIAS_ABSOLUTE_PATH .
'/node_modules';
262 $nodeModulesWithLeadingDot =
'./node_modules';
265 $webRelativeWithLeadingDot,
266 $webRelativeWithoutLeadingDot,
269 $customizingRelativeWithLeadingDot,
271 $libsRelativeWithLeadingDot,
274 $nodeModulesWithLeadingDot
static createRelativePath(string $absolute_path)
Creates a relative path from an absolute path which starts with a valid storage location.
trait FilesystemsAware
Trait FilesystemsAware.
static resolveRelativePath(string $possible_path, string $absolute_path)
static checkPossiblePath(string $possible_path, string $absolute_path)
static filesystems()
Returns the loaded filesystems.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static deriveLocationFrom(string $absolute_path)
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
Class FlySystemFileAccessTest disabled disabled disabled.