2 declare(strict_types=1);
40 $web, $webRelativeWithLeadingDot, $webRelativeWithoutLeadingDot, $storage, $customizing, $customizingRelativeWithLeadingDot, $libs, $libsRelativeWithLeadingDot, $temp
45 case self::checkPossiblePath($temp, $absolute_path):
47 case self::checkPossiblePath($web, $absolute_path):
49 case self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path):
51 case self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path):
53 case self::checkPossiblePath($storage, $absolute_path):
55 case self::checkPossiblePath($customizing, $absolute_path):
57 case self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path):
59 case self::checkPossiblePath($libs, $absolute_path):
61 case self::checkPossiblePath($libsRelativeWithLeadingDot, $absolute_path):
64 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
84 $web, $webRelativeWithLeadingDot, $webRelativeWithoutLeadingDot, $storage, $customizing, $customizingRelativeWithLeadingDot, $libs, $libsRelativeWithLeadingDot, $temp
90 case self::checkPossiblePath($webRelativeWithoutLeadingDot, $absolute_path):
91 return self::resolveRelativePath($webRelativeWithoutLeadingDot, $absolute_path);
93 case self::checkPossiblePath($webRelativeWithLeadingDot, $absolute_path):
94 return self::resolveRelativePath($webRelativeWithLeadingDot, $absolute_path);
96 case self::checkPossiblePath($web, $absolute_path):
97 return self::resolveRelativePath($web, $absolute_path);
99 case self::checkPossiblePath($temp, $absolute_path):
100 return self::resolveRelativePath($temp, $absolute_path);
102 case self::checkPossiblePath($storage, $absolute_path):
103 return self::resolveRelativePath($storage, $absolute_path);
105 case self::checkPossiblePath($customizing, $absolute_path):
106 return self::resolveRelativePath($customizing, $absolute_path);
108 case self::checkPossiblePath($customizingRelativeWithLeadingDot, $absolute_path):
109 return self::resolveRelativePath($customizingRelativeWithLeadingDot, $absolute_path);
111 case self::checkPossiblePath($libs, $absolute_path):
113 case self::checkPossiblePath($libsRelativeWithLeadingDot, $absolute_path):
114 return self::resolveRelativePath($libsRelativeWithLeadingDot, $absolute_path);
116 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
123 $real_possible_path = realpath($possible_path);
126 case $possible_path === $absolute_path:
127 case $real_possible_path === $absolute_path:
129 case strpos($absolute_path, $possible_path) === 0:
130 return substr($absolute_path, strlen($possible_path) + 1);
131 case strpos($absolute_path, $real_possible_path) === 0:
132 return substr($absolute_path, strlen($real_possible_path) + 1);
134 throw new \InvalidArgumentException(
"Invalid path supplied. Path must start with the web, storage, temp, customizing or libs storage location. Path given: '{$absolute_path}'");
147 $real_possible_path = realpath($possible_path);
150 case $possible_path === $absolute_path:
152 case $real_possible_path === $absolute_path:
154 case strpos($absolute_path, $possible_path) === 0:
156 case strpos($absolute_path, $real_possible_path) === 0:
169 $web = CLIENT_WEB_DIR;
170 $webRelativeWithLeadingDot =
'./' . ILIAS_WEB_DIR .
'/' . CLIENT_ID;
171 $webRelativeWithoutLeadingDot = ILIAS_WEB_DIR .
'/' . CLIENT_ID;
172 $storage = CLIENT_DATA_DIR;
173 $customizing = ILIAS_ABSOLUTE_PATH .
'/Customizing';
174 $customizingRelativeWithLeadingDot =
'./Customizing';
175 $libs = ILIAS_ABSOLUTE_PATH .
'/libs';
176 $libsRelativeWithLeadingDot =
"./libs";
177 $temp = CLIENT_DATA_DIR .
"/temp";
179 return array($web, $webRelativeWithLeadingDot, $webRelativeWithoutLeadingDot, $storage, $customizing, $customizingRelativeWithLeadingDot, $libs, $libsRelativeWithLeadingDot, $temp);
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.
static deriveFilesystemFrom(string $absolute_path)
Tries to fetch the filesystem responsible for the absolute path.
Class FlySystemFileAccessTest.