Handling dependencies

Plugins can indicate if they depend upon certain conditions in order for them to work correctly. Two attributes are used to specify this: necessite and utilise. In the first case, the dependency is a strong one: a plugin that requires a resource (a certain version of SPIP or another particular plugin) can not be activated if that resource is not present and active. An error will be generated if we try to activate the plugin without that dependency being fulfilled. In the second case, the dependency is weak, and the plugin can be activated and perhaps even work even if that dependency is not fulfilled.

Necessite

<necessite id="prefixe" version="[version_min;version_max]" />
  • id is the name of the plugin’s prefix, or "SPIP" for a direct dependency on SPIP itself,
  • version used optionally can indicate the mininum and/or maximum version of a plugin. Square brackets are used to indicate that the version as specified is included, parentheses to indicate that the version specified is not included.

Utilise

"Utilise" is therefore used to declare optional dependencies, with exactly the same syntax as for necessite.

utilise and necessite also therefore make it possible to override the files for the plugin that they refer to (as they have priority in the file path).

Example

// requires at least SPIP 2.0
<necessite id="SPIP" version="[2.0;)" />
// requires SPIP < 2.0
<necessite id="SPIP" version="[;2.0)" />
// requires SPIP >= 2.0, and <= 2.1
<necessite id="SPIP" version="[2.0;2.1]" />
 
// requires spip_bonux at least at version 1.2
<necessite id="spip_bonux" version="[1.2;]" />

Certain plugins may indicate that it is possible to modify their configurations if the CFG plugin is loaded (but without actually being an indispensable requirement for the plugin to work):

// configuration plugin
<utilise id="cfg" version="[1.10.5;]" />

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français, Nederlands