19 declare(strict_types=1);
52 $this->component_id_by_type_and_name = [
53 "components/ILIAS" => []
55 $this->pluginslot_by_id = [];
56 $plugins_per_slot = [];
57 foreach ($component_data as $comp_id => [$type, $comp_name, $slot_data]) {
65 foreach ($slot_data as [$slot_id, $slot_name]) {
66 $plugins_per_slot[$slot_id] = [];
71 $plugins_per_slot[$slot_id]
73 $this->pluginslot_by_id[$slot_id] = $slots[$slot_id];
76 $this->component_id_by_type_and_name[$type][$comp_name] = $comp_id;
79 $this->plugin_by_id = [];
80 foreach ($plugin_data as $plugin_id =>
$data) {
96 if (!$this->
hasComponent(
'components/ILIAS', $comp_name)) {
97 throw new \InvalidArgumentException(
98 "Can't find component $type/$comp_name for plugin $plugin_name" 103 if (!$component->hasPluginSlotName($slot_name)) {
104 throw new \InvalidArgumentException(
105 "Can't find slot $type/$comp_name/$slot_name for plugin $plugin_name" 108 $slot = $component->getPluginSlotByName($slot_name);
110 $this->ilias_version,
115 $this->plugin_state_db->isPluginActivated($plugin_id),
116 $this->plugin_state_db->getCurrentPluginVersion($plugin_id),
117 $this->plugin_state_db->getCurrentPluginDBVersion($plugin_id),
118 $this->data_factory->version($plugin_version),
119 $this->data_factory->version($ilias_min_version),
120 $this->data_factory->version($ilias_max_version),
123 $learning_progress ??
false,
124 $supports_export ??
false,
125 $supports_cli_setup ?? true
127 $plugins_per_slot[$slot->getId()][$plugin_id] = $this->plugin_by_id[$plugin_id];
133 return require ilComponentBuildComponentInfoObjective::PATH();
138 return require ilComponentBuildPluginInfoObjective::PATH();
149 if (!in_array($type, $types)) {
150 throw new \InvalidArgumentException(
151 "Unknown component type $type." 154 return isset($this->component_id_by_type_and_name[$type][$name]);
181 throw new \InvalidArgumentException(
182 "Unknown component $id" 194 throw new \InvalidArgumentException(
195 "Unknown component $type/$name" 198 return $this->
components[$this->component_id_by_type_and_name[$type][$name]];
207 return isset($this->pluginslot_by_id[$id]);
215 foreach ($this->pluginslot_by_id as
$id => $slot) {
226 throw new \InvalidArgumentException(
227 "Unknown pluginslot $id" 230 return $this->pluginslot_by_id[
$id];
238 return isset($this->plugin_by_id[$id]);
250 foreach ($this->plugin_by_id as
$id =>
$plugin) {
263 throw new \InvalidArgumentException(
264 "Unknown plugin $id." 267 return $this->plugin_by_id[
$id];
278 if ($plugin->getName() === $name) {
282 throw new \InvalidArgumentException(
283 "No plugin with name $name." 290 if (
$plugin->getCurrentVersion() !==
null &&
$plugin->getCurrentVersion()->isGreaterThan($version)) {
291 throw new \RuntimeException(
292 "Cannot downgrade plugins version from {$plugin->getCurrentVersion()} to $version" 295 if (
$plugin->getCurrentDBVersion() !==
null &&
$plugin->getCurrentDBVersion() > $db_version) {
296 throw new \RuntimeException(
297 "Cannot downgrade plugins db version from {$plugin->getCurrentDBVersion()} to $db_version" 300 $this->plugin_state_db->setCurrentPluginVersion($plugin_id, $version, $db_version);
307 throw new \InvalidArgumentException(
308 "Unknown plugin $plugin_id." 311 $this->plugin_state_db->setActivation($plugin_id, $activated);
318 throw new \InvalidArgumentException(
319 "Unknown plugin $plugin_id." 322 $this->plugin_state_db->remove($plugin_id);
hasActivatedPlugin(string $id)
Check if a plugin exists and is activated.
setCurrentPluginVersion(string $plugin_id, Data\Version $version, int $db_version)
hasPluginSlotId(string $id)
Writeable part of repository interface to ilComponentDataDB.
ilPluginStateDB $plugin_state_db
hasComponentId(string $id)
getComponentByTypeAndName(string $type, string $name)
Simple value class for basic information about a pluginslot.
Data Factory $data_factory
hasPluginId(string $id)
Check if a plugin exists.
getPluginByName(string $name)
Get a plugin by name.
__construct(Data\Factory $data_factory, ilPluginStateDB $plugin_state_db, Data\Version $ilias_version)
array $component_id_by_type_and_name
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPluginSlotById(string $id)
removeStateInformationOf(string $plugin_id)
setActivation(string $plugin_id, bool $activated)
Repository interface for plugin state data.
Simple value class for information about a plugin.
getPluginById(string $id)
Get a plugin by id.
Repository for component data implemented over artifacts.
Data Version $ilias_version
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
A version number that consists of three numbers (major, minor, patch).
hasComponent(string $type, string $name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getComponentById(string $id)
getPlugins()
Get all plugins.
Simple value class for basic information about a component.