24 protected const BASE_PATH =
"./Customizing/global/plugins/";
30 return \ilArtifactComponentRepository::PLUGIN_DATA_PATH;
37 foreach ([
"Modules",
"Services"] as $type) {
38 $components = $this->
scanDir(static::BASE_PATH . $type);
39 foreach ($components as $component) {
41 || ! $this->
isDir(static::BASE_PATH .
"$type/$component")) {
44 $slots = $this->
scanDir(static::BASE_PATH .
"$type/$component");
45 foreach ($slots as $slot) {
47 || ! $this->
isDir(static::BASE_PATH .
"$type/$component/$slot")) {
50 $plugins = $this->
scanDir(static::BASE_PATH .
"$type/$component/$slot");
53 || ! $this->
isDir(static::BASE_PATH .
"$type/$component/$slot/$plugin")) {
61 return new Setup\Artifact\ArrayArtifact(
$data);
66 $plugin_path = $this->
buildPluginPath($type, $component, $slot, $plugin);
67 $plugin_php = $plugin_path . static::PLUGIN_PHP;
69 throw new \RuntimeException(
70 "Cannot read $plugin_php." 74 $plugin_class = $plugin_path . sprintf(static::PLUGIN_CLASS_FILE, $plugin);
76 throw new \RuntimeException(
77 "Cannot read $plugin_class." 81 require_once($plugin_php);
83 throw new \InvalidArgumentException(
"$plugin does not define \$id");
86 throw new \InvalidArgumentException(
"$plugin does not define \$version");
89 throw new \InvalidArgumentException(
"$plugin does not define \$ilias_min_version");
92 throw new \InvalidArgumentException(
"$plugin does not define \$ilias_max_version");
95 if (isset($data[
$id])) {
96 throw new \RuntimeException(
97 "Plugin with id $id already exists." 113 $supports_cli_setup ?? null
120 protected function scanDir(
string $dir): array
122 if (!file_exists($dir)) {
125 $result = scandir($dir);
126 return array_values(array_diff($result, [
".",
".."]));
131 return file_exists($path) && is_file($path);
134 protected function isDir(
string $dir): bool
136 return file_exists($dir) && is_dir($dir);
141 return (substr($file, 0, 1) ===
'.');
146 return static::BASE_PATH .
"$type/$component/$slot/$plugin/";
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)