20declare(strict_types=1);
55 $this->components = [];
56 $this->component_id_by_type_and_name = [
60 $this->pluginslot_by_id = [];
61 $plugins_per_slot = [];
62 foreach ($component_data as $comp_id => [
$type, $comp_name, $slot_data]) {
70 foreach ($slot_data as [$slot_id, $slot_name]) {
71 $plugins_per_slot[$slot_id] = [];
76 $plugins_per_slot[$slot_id]
78 $this->pluginslot_by_id[$slot_id] = $slots[$slot_id];
80 $this->components[$comp_id] = $component;
81 $this->component_id_by_type_and_name[
$type][$comp_name] = $comp_id;
84 $this->plugin_by_id = [];
85 foreach ($plugin_data as $plugin_id =>
$data) {
101 throw new \InvalidArgumentException(
102 "Can't find component $type/$comp_name for plugin $plugin_name"
106 if (!$component->hasPluginSlotName($slot_name)) {
107 throw new \InvalidArgumentException(
108 "Can't find slot $type/$comp_name/$slot_name for plugin $plugin_name"
111 $slot = $component->getPluginSlotByName($slot_name);
113 $this->ilias_version,
117 $this->plugin_state_db->isPluginActivated($plugin_id),
118 $this->plugin_state_db->getCurrentPluginVersion($plugin_id),
119 $this->plugin_state_db->getCurrentPluginDBVersion($plugin_id),
120 $this->data_factory->version($plugin_version),
127 $supports_cli_setup ??
true
129 $plugins_per_slot[$slot->getId()][$plugin_id] = $this->plugin_by_id[$plugin_id];
149 throw new \InvalidArgumentException(
150 "Unknown component type $type."
154 return isset($this->component_id_by_type_and_name[
$type][
$name]);
162 return isset($this->components[
$id]);
170 foreach ($this->components as
$id => $comp) {
181 throw new \InvalidArgumentException(
182 "Unknown component $id"
185 return $this->components[
$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];
282 throw new \InvalidArgumentException(
283 "No plugin with name $name."
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);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
A version number that consists of three numbers (major, minor, patch).
Repository for component data implemented over artifacts.
hasPluginId(string $id)
Check if a plugin exists.
Data Factory $data_factory
array $component_id_by_type_and_name
hasPluginSlotId(string $id)
@inheritdocs
hasActivatedPlugin(string $id)
Check if a plugin exists and is activated.
getPluginById(string $id)
Get a plugin by id.
ilPluginStateDB $plugin_state_db
getComponentByTypeAndName(string $type, string $name)
@inheritdocs
setCurrentPluginVersion(string $plugin_id, Data\Version $version, int $db_version)
const COMPONENT_DATA_PATH
setActivation(string $plugin_id, bool $activated)
removeStateInformationOf(string $plugin_id)
Data Version $ilias_version
hasComponent(string $type, string $name)
@inheritdocs
__construct(Data\Factory $data_factory, ilPluginStateDB $plugin_state_db, Data\Version $ilias_version)
getPlugins()
Get all plugins.
getPluginSlots()
@inheritdocs
getComponents()
@inheritdocs
hasComponentId(string $id)
@inheritdocs
getPluginSlotById(string $id)
@inheritdocs
getComponentById(string $id)
@inheritdocs
getPluginByName(string $name)
Get a plugin by name.
Simple value class for basic information about a component.
Simple value class for information about a plugin.
Simple value class for basic information about a pluginslot.
Writeable part of repository interface to ilComponentDataDB.
Repository interface for plugin state data.