ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilPluginInfo Class Reference

Simple value class for information about a plugin. More...

+ Collaboration diagram for ilPluginInfo:

Public Member Functions

 __construct (Version $actual_ilias_version, ilPluginSlotInfo $pluginslot, string $id, string $name, string $type, bool $activated, ?Version $current_version, ?int $current_db_version, Version $available_version, Version $minimum_ilias_version, Version $maximum_ilias_version, string $responsible, string $responsible_mail, bool $supports_learning_progress, bool $supports_export, bool $supports_cli_setup)
 
 getPluginSlot ()
 
 getComponent ()
 
 getId ()
 
 getName ()
 
 getType ()
 
 getPath ()
 
 getClassName ()
 
 getConfigGUIClassName ()
 
 isActivated ()
 "activated" tells if the administrator of the installation wants the plugin to be effective. More...
 
 getCurrentVersion ()
 
 getCurrentDBVersion ()
 
 getAvailableVersion ()
 
 getMinimumILIASVersion ()
 
 getMaximumILIASVersion ()
 
 getResponsible ()
 
 getResponsibleMail ()
 
 supportsLearningProgress ()
 
 supportsExport ()
 
 supportsCLISetup ()
 
 isInstalled ()
 "Installed" tells if the plugin has some installed version. More...
 
 isUpdateRequired ()
 "Update required" tells if the plugin needs an update. More...
 
 isVersionToOld ()
 "Version to old" tells if the plugin code has a version that is below the version that was updated last. More...
 
 isCompliantToILIAS ()
 "ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version. More...
 
 isActivationPossible ()
 Can this plugin be activated right now. More...
 
 isActive ()
 Is this plugin active right now? More...
 
 getReasonForInactivity ()
 Which is the reason for the inactivity? More...
 

Protected Member Functions

 normalizePath (string $path)
 Resolves "." and ".." segments without touching the file system, so it also works for plugins which are not installed (yet). More...
 

Protected Attributes

Version $actual_ilias_version
 
ilPluginSlotInfo $pluginslot
 
string $id
 
string $name
 
string $type
 
bool $activated
 
Version $current_version
 
int $current_db_version
 
Version $available_version
 
Version $minimum_ilias_version
 
Version $maximum_ilias_version
 
string $responsible
 
string $responsible_mail
 
bool $supports_learning_progress
 
bool $supports_export
 
bool $supports_cli_setup
 

Detailed Description

Simple value class for information about a plugin.

Definition at line 26 of file class.ilPluginInfo.php.

Constructor & Destructor Documentation

◆ __construct()

ilPluginInfo::__construct ( Version  $actual_ilias_version,
ilPluginSlotInfo  $pluginslot,
string  $id,
string  $name,
string  $type,
bool  $activated,
?Version  $current_version,
?int  $current_db_version,
Version  $available_version,
Version  $minimum_ilias_version,
Version  $maximum_ilias_version,
string  $responsible,
string  $responsible_mail,
bool  $supports_learning_progress,
bool  $supports_export,
bool  $supports_cli_setup 
)

Definition at line 45 of file class.ilPluginInfo.php.

62 {
63 if ($current_version === null && $current_db_version !== null) {
64 throw new \InvalidArgumentException(
65 "If there is no current version for the plugin, we also should not " .
66 "have a db-version."
67 );
68 }
69 $this->actual_ilias_version = $actual_ilias_version;
70 $this->pluginslot = $pluginslot;
71 $this->id = $id;
72 $this->name = $name;
73 $this->type = $type;
74 $this->activated = $activated;
75 $this->current_version = $current_version;
76 $this->current_db_version = $current_db_version;
77 $this->available_version = $available_version;
78 $this->minimum_ilias_version = $minimum_ilias_version;
79 $this->maximum_ilias_version = $maximum_ilias_version;
80 $this->responsible = $responsible;
81 $this->responsible_mail = $responsible_mail;
82 $this->supports_learning_progress = $supports_learning_progress;
83 $this->supports_export = $supports_export;
84 $this->supports_cli_setup = $supports_cli_setup;
85 }
Version $maximum_ilias_version
Version $available_version
bool $supports_learning_progress
ilPluginSlotInfo $pluginslot
Version $current_version
Version $minimum_ilias_version
Version $actual_ilias_version

References $activated, $actual_ilias_version, $available_version, $current_db_version, $current_version, $id, $maximum_ilias_version, $minimum_ilias_version, $name, $pluginslot, $responsible, $responsible_mail, $supports_cli_setup, $supports_export, $supports_learning_progress, and $type.

Member Function Documentation

◆ getAvailableVersion()

ilPluginInfo::getAvailableVersion ( )

Definition at line 178 of file class.ilPluginInfo.php.

178 : Version
179 {
181 }
A version number that consists of three numbers (major, minor, patch).
Definition: Version.php:27

References $available_version.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getClassName()

ilPluginInfo::getClassName ( )

Definition at line 149 of file class.ilPluginInfo.php.

149 : string
150 {
151 return "il" . $this->getName() . "Plugin";
152 }

References getName().

+ Here is the call graph for this function:

◆ getComponent()

ilPluginInfo::getComponent ( )

Definition at line 92 of file class.ilPluginInfo.php.

93 {
94 return $this->pluginslot->getComponent();
95 }
Simple value class for basic information about a component.

Referenced by ilPluginsOverviewTable\filterData(), and getPath().

+ Here is the caller graph for this function:

◆ getConfigGUIClassName()

ilPluginInfo::getConfigGUIClassName ( )

Definition at line 154 of file class.ilPluginInfo.php.

154 : string
155 {
156 return "il" . $this->getName() . "ConfigGUI";
157 }

References getName().

Referenced by ilPluginsOverviewTable\getActions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCurrentDBVersion()

ilPluginInfo::getCurrentDBVersion ( )

Definition at line 173 of file class.ilPluginInfo.php.

173 : ?int
174 {
176 }

References $current_db_version.

Referenced by ilPluginDBUpdate\__construct(), and ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getCurrentVersion()

ilPluginInfo::getCurrentVersion ( )

Definition at line 168 of file class.ilPluginInfo.php.

168 : ?Version
169 {
171 }

References $current_version.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getId()

ilPluginInfo::getId ( )

Definition at line 97 of file class.ilPluginInfo.php.

97 : string
98 {
99 return $this->id;
100 }

References $id.

Referenced by ilPluginsOverviewTable\filterData(), and ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getMaximumILIASVersion()

ilPluginInfo::getMaximumILIASVersion ( )

Definition at line 188 of file class.ilPluginInfo.php.

188 : Version
189 {
191 }

References $maximum_ilias_version.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getMinimumILIASVersion()

ilPluginInfo::getMinimumILIASVersion ( )

Definition at line 183 of file class.ilPluginInfo.php.

183 : Version
184 {
186 }

References $minimum_ilias_version.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getName()

ilPluginInfo::getName ( )

Definition at line 102 of file class.ilPluginInfo.php.

102 : string
103 {
104 return $this->name;
105 }

References $name.

Referenced by ilPluginsOverviewTable\filterData(), getClassName(), getConfigGUIClassName(), getPath(), and ilPluginsOverviewTable\getTable().

+ Here is the caller graph for this function:

◆ getPath()

ilPluginInfo::getPath ( )

Definition at line 112 of file class.ilPluginInfo.php.

112 : string
113 {
114 return $this->normalizePath(
115 implode('/', [
117 $this->getType(),
118 $this->getComponent()->getName(),
119 $this->getPluginSlot()->getName(),
120 $this->getName()
121 ])
122 );
123 }
normalizePath(string $path)
Resolves "." and ".." segments without touching the file system, so it also works for plugins which a...

References getComponent(), getName(), getPluginSlot(), getType(), normalizePath(), and ilComponentRepository\PLUGIN_BASE_PATH.

+ Here is the call graph for this function:

◆ getPluginSlot()

ilPluginInfo::getPluginSlot ( )

Definition at line 87 of file class.ilPluginInfo.php.

88 {
89 return $this->pluginslot;
90 }
Simple value class for basic information about a pluginslot.

References $pluginslot.

Referenced by ilPluginsOverviewTable\filterData(), ilPluginsOverviewTable\getContent(), getPath(), and ilPluginsOverviewTable\getTable().

+ Here is the caller graph for this function:

◆ getReasonForInactivity()

ilPluginInfo::getReasonForInactivity ( )

Which is the reason for the inactivity?

Exceptions

LogicException if plugin is actually active.

Returns
string to be used as identifier for language service.

Definition at line 280 of file class.ilPluginInfo.php.

280 : string
281 {
282 if ($this->isActive()) {
283 throw new \LogicException(
284 "Plugin is active, so no reason for inactivity."
285 );
286 }
287
288 if (!$this->isCompliantToILIAS()) {
289 return "cmps_needs_matching_ilias_version";
290 }
291
292 if (!$this->isInstalled()) {
293 return "cmps_must_installed";
294 }
295
296 if ($this->isVersionToOld()) {
297 return "cmps_needs_upgrade";
298 }
299
300 if ($this->isUpdateRequired()) {
301 return "cmps_needs_update";
302 }
303
304 if (!$this->isActivated()) {
305 return "cmps_not_activated";
306 }
307
308 throw new \LogicException(
309 "Unknown reason for inactivity of the plugin."
310 );
311 }
isInstalled()
"Installed" tells if the plugin has some installed version.
isActive()
Is this plugin active right now?
isCompliantToILIAS()
"ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version.
isUpdateRequired()
"Update required" tells if the plugin needs an update.
isActivated()
"activated" tells if the administrator of the installation wants the plugin to be effective.
isVersionToOld()
"Version to old" tells if the plugin code has a version that is below the version that was updated la...

References isActivated(), isActive(), isCompliantToILIAS(), isInstalled(), isUpdateRequired(), and isVersionToOld().

+ Here is the call graph for this function:

◆ getResponsible()

ilPluginInfo::getResponsible ( )

Definition at line 193 of file class.ilPluginInfo.php.

193 : string
194 {
195 return $this->responsible;
196 }

References $responsible.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getResponsibleMail()

ilPluginInfo::getResponsibleMail ( )

Definition at line 198 of file class.ilPluginInfo.php.

198 : string
199 {
201 }

References $responsible_mail.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ getType()

ilPluginInfo::getType ( )

Definition at line 107 of file class.ilPluginInfo.php.

107 : string
108 {
109 return $this->type;
110 }

References $type.

Referenced by getPath().

+ Here is the caller graph for this function:

◆ isActivated()

ilPluginInfo::isActivated ( )

"activated" tells if the administrator of the installation wants the plugin to be effective.

Compare to "active".

Definition at line 163 of file class.ilPluginInfo.php.

163 : bool
164 {
165 return $this->activated;
166 }

References $activated.

Referenced by getReasonForInactivity(), and isActive().

+ Here is the caller graph for this function:

◆ isActivationPossible()

ilPluginInfo::isActivationPossible ( )

Can this plugin be activated right now.

Definition at line 257 of file class.ilPluginInfo.php.

257 : bool
258 {
259 return $this->isCompliantToILIAS()
260 && $this->isInstalled()
261 && !$this->isVersionToOld()
262 && !$this->isUpdateRequired();
263 }

References isCompliantToILIAS(), isInstalled(), isUpdateRequired(), and isVersionToOld().

Referenced by ilPluginsOverviewTable\getActions(), and isActive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isActive()

ilPluginInfo::isActive ( )

Is this plugin active right now?

Definition at line 268 of file class.ilPluginInfo.php.

268 : bool
269 {
270 return $this->isActivationPossible()
271 && $this->isActivated();
272 }
isActivationPossible()
Can this plugin be activated right now.

References isActivated(), and isActivationPossible().

Referenced by ilPluginsOverviewTable\filterData(), ilPluginsOverviewTable\getActions(), ilPluginsOverviewTable\getContent(), ilPluginsOverviewTable\getImportantFields(), and getReasonForInactivity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCompliantToILIAS()

ilPluginInfo::isCompliantToILIAS ( )

"ILIAS Version compliance" tells if the plugin can be operated with the given ILIAS version.

Definition at line 247 of file class.ilPluginInfo.php.

247 : bool
248 {
249 return
250 $this->actual_ilias_version->isGreaterThanOrEquals($this->minimum_ilias_version)
251 && $this->actual_ilias_version->isSmallerThanOrEquals($this->maximum_ilias_version);
252 }

Referenced by getReasonForInactivity(), isActivationPossible(), and ilPluginInfoTest\testIsCompliantToILIAS().

+ Here is the caller graph for this function:

◆ isInstalled()

ilPluginInfo::isInstalled ( )

"Installed" tells if the plugin has some installed version.

Definition at line 221 of file class.ilPluginInfo.php.

221 : bool
222 {
223 return $this->current_version !== null;
224 }

Referenced by ilPluginsOverviewTable\getActions(), ilPluginsOverviewTable\getContent(), ilPluginsOverviewTable\getImportantFields(), getReasonForInactivity(), isActivationPossible(), and isUpdateRequired().

+ Here is the caller graph for this function:

◆ isUpdateRequired()

ilPluginInfo::isUpdateRequired ( )

"Update required" tells if the plugin needs an update.

Definition at line 229 of file class.ilPluginInfo.php.

229 : bool
230 {
231 return $this->isInstalled() && !$this->current_version->equals($this->available_version);
232 }

References isInstalled().

Referenced by ilPluginsOverviewTable\getActions(), ilPluginsOverviewTable\getContent(), ilPluginsOverviewTable\getImportantFields(), getReasonForInactivity(), and isActivationPossible().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isVersionToOld()

ilPluginInfo::isVersionToOld ( )

"Version to old" tells if the plugin code has a version that is below the version that was updated last.

Definition at line 238 of file class.ilPluginInfo.php.

238 : bool
239 {
240 return $this->current_version->isGreaterThan($this->available_version);
241 }

Referenced by getReasonForInactivity(), isActivationPossible(), and ilPluginInfoTest\testIsVersionOld().

+ Here is the caller graph for this function:

◆ normalizePath()

ilPluginInfo::normalizePath ( string  $path)
protected

Resolves "." and ".." segments without touching the file system, so it also works for plugins which are not installed (yet).

ilComponentRepository::PLUGIN_BASE_PATH is built from DIR and therefore carries a "../../../.." which would otherwise end up in every path handed out to a plugin.

Definition at line 132 of file class.ilPluginInfo.php.

132 : string
133 {
134 $segments = [];
135 foreach (explode('/', $path) as $segment) {
136 if ($segment === '' || $segment === '.') {
137 continue;
138 }
139 if ($segment === '..' && $segments !== [] && end($segments) !== '..') {
140 array_pop($segments);
141 continue;
142 }
143 $segments[] = $segment;
144 }
145
146 return (str_starts_with($path, '/') ? '/' : '') . implode('/', $segments);
147 }

Referenced by getPath().

+ Here is the caller graph for this function:

◆ supportsCLISetup()

ilPluginInfo::supportsCLISetup ( )

Definition at line 213 of file class.ilPluginInfo.php.

213 : bool
214 {
216 }

References $supports_cli_setup.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ supportsExport()

ilPluginInfo::supportsExport ( )

Definition at line 208 of file class.ilPluginInfo.php.

208 : bool
209 {
211 }

References $supports_export.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

◆ supportsLearningProgress()

ilPluginInfo::supportsLearningProgress ( )

Definition at line 203 of file class.ilPluginInfo.php.

203 : bool
204 {
206 }

References $supports_learning_progress.

Referenced by ilPluginsOverviewTable\getContent().

+ Here is the caller graph for this function:

Field Documentation

◆ $activated

bool ilPluginInfo::$activated
protected

Definition at line 33 of file class.ilPluginInfo.php.

Referenced by __construct(), and isActivated().

◆ $actual_ilias_version

Version ilPluginInfo::$actual_ilias_version
protected

Definition at line 28 of file class.ilPluginInfo.php.

Referenced by __construct().

◆ $available_version

Version ilPluginInfo::$available_version
protected

Definition at line 36 of file class.ilPluginInfo.php.

Referenced by __construct(), and getAvailableVersion().

◆ $current_db_version

int ilPluginInfo::$current_db_version
protected

Definition at line 35 of file class.ilPluginInfo.php.

Referenced by __construct(), and getCurrentDBVersion().

◆ $current_version

Version ilPluginInfo::$current_version
protected

Definition at line 34 of file class.ilPluginInfo.php.

Referenced by __construct(), and getCurrentVersion().

◆ $id

string ilPluginInfo::$id
protected

Definition at line 30 of file class.ilPluginInfo.php.

Referenced by __construct(), and getId().

◆ $maximum_ilias_version

Version ilPluginInfo::$maximum_ilias_version
protected

Definition at line 38 of file class.ilPluginInfo.php.

Referenced by __construct(), and getMaximumILIASVersion().

◆ $minimum_ilias_version

Version ilPluginInfo::$minimum_ilias_version
protected

Definition at line 37 of file class.ilPluginInfo.php.

Referenced by __construct(), and getMinimumILIASVersion().

◆ $name

string ilPluginInfo::$name
protected

Definition at line 31 of file class.ilPluginInfo.php.

Referenced by __construct(), and getName().

◆ $pluginslot

ilPluginSlotInfo ilPluginInfo::$pluginslot
protected

Definition at line 29 of file class.ilPluginInfo.php.

Referenced by __construct(), and getPluginSlot().

◆ $responsible

string ilPluginInfo::$responsible
protected

Definition at line 39 of file class.ilPluginInfo.php.

Referenced by __construct(), and getResponsible().

◆ $responsible_mail

string ilPluginInfo::$responsible_mail
protected

Definition at line 40 of file class.ilPluginInfo.php.

Referenced by __construct(), and getResponsibleMail().

◆ $supports_cli_setup

bool ilPluginInfo::$supports_cli_setup
protected

Definition at line 43 of file class.ilPluginInfo.php.

Referenced by __construct(), and supportsCLISetup().

◆ $supports_export

bool ilPluginInfo::$supports_export
protected

Definition at line 42 of file class.ilPluginInfo.php.

Referenced by __construct(), and supportsExport().

◆ $supports_learning_progress

bool ilPluginInfo::$supports_learning_progress
protected

Definition at line 41 of file class.ilPluginInfo.php.

Referenced by __construct(), and supportsLearningProgress().

◆ $type

string ilPluginInfo::$type
protected

Definition at line 32 of file class.ilPluginInfo.php.

Referenced by __construct(), and getType().


The documentation for this class was generated from the following file: