23 protected const BASE_PATH =
"./public/Customizing/global/plugins/";
36 foreach ([
'Modules',
'Services'] as $type) {
37 $base_path = static::BASE_PATH . $type .
'/';
38 if (! $this->
isDir($base_path)) {
44 || ! $this->
isDir($base_path .
"$component")) {
47 $slots = $this->
scanDir($base_path .
"$component");
48 foreach ($slots as $slot) {
50 || ! $this->
isDir($base_path .
"$component/$slot")) {
53 $plugins = $this->
scanDir($base_path .
"$component/$slot");
56 || ! $this->
isDir($base_path .
"$component/$slot/$plugin")) {
64 return new Setup\Artifact\ArrayArtifact(
$data);
69 $plugin_path = $this->
buildPluginPath($type, $component, $slot, $plugin);
70 $plugin_php = $plugin_path . static::PLUGIN_PHP;
72 throw new \RuntimeException(
73 "Cannot read $plugin_php." 77 $plugin_class = $plugin_path . sprintf(static::PLUGIN_CLASS_FILE, $plugin);
79 throw new \RuntimeException(
80 "Cannot read $plugin_class." 84 require_once($plugin_php);
86 throw new \InvalidArgumentException(
"$plugin does not define \$id");
89 throw new \InvalidArgumentException(
"$plugin does not define \$version");
92 throw new \InvalidArgumentException(
"$plugin does not define \$ilias_min_version");
95 throw new \InvalidArgumentException(
"$plugin does not define \$ilias_max_version");
98 if (isset($data[
$id])) {
99 throw new \RuntimeException(
100 "Plugin with id $id already exists." 116 $supports_cli_setup ??
null 123 protected function scanDir(
string $dir): array
125 if (!file_exists($dir)) {
128 $result = scandir($dir);
129 return array_values(array_diff($result, [
".",
".."]));
134 return file_exists($path) && is_file($path);
137 protected function isDir(
string $dir): bool
139 return file_exists($dir) && is_dir($dir);
144 return (substr($file, 0, 1) ===
'.');
149 return static::BASE_PATH .
"$type/$component/$slot/$plugin/";
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildPluginPath(string $type, string $component, string $slot, string $plugin)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
An artifact is some file that is build on demand per installation and is not shipped with the ILIAS s...
addPlugin(array &$data, string $type, string $component, string $slot, string $plugin)