Update `codebox` macro
[GitHub/WoltLab/woltlab.github.io.git] / docs / package / package-xml.md
CommitLineData
e3747bbc 1# package.xml
a621986f
MS
2
3The `package.xml` is the core component of every package.
4It provides the meta data (e.g. package name, description, author) and the instruction set for a new installation and/or updating from a previous version.
5
6## Example
7
9a3f5fa3 8{jinja{ codebox(
f778fce2
MS
9 title="package.xml",
10 language="xml",
11 filepath="package/package.xml"
9a3f5fa3 12) }}
a621986f
MS
13
14
15## Elements
16
17### `<package>`
18
19The root node of every `package.xml` it contains the reference to the namespace and the location of the XML Schema Definition (XSD).
20
21The attribute `name` is the most important part, it holds the unique package identifier and is mandatory.
22It is based upon your domain name and the package name of your choice.
23
24For example WoltLab Suite Forum (formerly know an WoltLab Burning Board and usually abbreviated as `wbb`) is created by WoltLab which owns the domain `woltlab.com`.
25The resulting package identifier is `com.woltlab.wbb` (`<tld>.<domain>.<packageName>`).
26
27### `<packageinformation>`
28
29Holds the entire meta data of the package.
30
31#### `<packagename>`
32
33This is the actual package name displayed to the end user, this can be anything you want, try to keep it short.
34It supports the attribute `languagecode` which allows you to provide the package name in different languages, please be aware that if it is not present, `en` (English) is assumed:
35
36```xml
37<packageinformation>
38 <packagename>Simple Package</packagename>
39 <packagename languagecode="de">Einfaches Paket</packagename>
40</packageinformation>
41```
42
43#### `<packagedescription>`
44
45Brief summary of the package, use it to explain what it does since the package name might not always be clear enough.
46The attribute `languagecode` is available here too, please reference to [`<packagename>`](#packageName) for details.
47
48#### `<version>`
49
50The package's version number, this is a string consisting of three numbers separated with a dot and optionally followed by a keyword (must be followed with another number).
51
52The possible keywords are:
53
54- Alpha/dev (both is regarded to be the same)
55- Beta
56- RC (release candidate)
57- pl (patch level)
58
59Valid examples:
60
61- 1.0.0
62- 1.12.13 Alpha 19
63- 7.0.0 pl 3
64
65Invalid examples:
66
67- 1.0.0 Beta (keyword Beta must be followed by a number)
68- 2.0 RC 3 (version number must consists of 3 blocks of numbers)
69- 1.2.3 dev 4.5 (4.5 is not an integer, 4 or 5 would be valid but not the fraction)
70
71#### `<date>`
72
73Must be a valid [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) date, e.g. `2013-12-27`.
74
75### `<authorinformation>`
76
77Holds meta data regarding the package's author.
78
79#### `<author>`
80
81Can be anything you want.
82
83#### `<authorurl>`
84
85> (optional)
86
476e5c87 87URL to the author's website.
a621986f
MS
88
89### `<requiredpackages>`
90
91A list of packages including their version required for this package to work.
92
93#### `<requiredpackage>`
94
95Example:
476e5c87 96
a621986f
MS
97```xml
98<requiredpackage minversion="2.0.0" file="requirements/com.woltlab.wcf.tar">com.woltlab.wcf</requiredpackage>
99```
100
101The attribute `minversion` must be a valid version number as described in [`<version>`](#version).
102The `file` attribute is optional and specifies the location of the required package's archive relative to the `package.xml`.
103
104### `<optionalpackage>`
105
106A list of optional packages which can be selected by the user at the very end of the installation process.
107
108#### `<optionalpackage>`
109
110Example:
476e5c87 111
a621986f
MS
112```xml
113<optionalpackage file="optionals/com.woltlab.wcf.moderatedUserGroup.tar">com.woltlab.wcf.moderatedUserGroup</optionalpackage>
114```
115
116The `file` attribute specifies the location of the optional package's archive relative to the `package.xml`.
117
7739597e 118### `<excludedpackages>`
a621986f
MS
119
120List of packages which conflict with this package. It is not possible to install it if any of the specified packages is installed. In return you cannot install an excluded package if this package is installed.
121
7739597e 122#### `<excludedpackage>`
a621986f
MS
123
124Example:
125
126```xml
7739597e 127<excludedpackage version="3.1.0 Alpha 1">com.woltlab.wcf</excludedpackage>
a621986f
MS
128```
129
130The attribute `version` must be a valid version number as described in the [\<version\>](#version) section. In the example above it will be impossible to install this package in WoltLab Suite Core 3.1.0 Alpha 1 or higher.
131
e119d647 132### `<compatibility>`
9003992d
MS
133!!! info "Available since WoltLab Suite 3.1"
134!!! warning "With the release of WoltLab Suite 5.2 the API versions were abolished. Instead of using API versions packages should exclude version `6.0.0 Alpha 1` of `com.woltlab.wcf` going forward."
ef328ed8 135
e119d647
AE
136WoltLab Suite 3.1 introduced a new versioning system that focused around the API compatibility and is intended to replace the `<excludedpackage>` instruction for the Core for most plugins.
137
138The `<compatibility>`-tag holds a list of compatible API versions, and while only a single version is available at the time of writing, future versions will add more versions with backwards-compatibility in mind.
139
140Example:
141
142```xml
143<compatibility>
144 <api version="2018" />
145</compatibility>
146```
147
148#### Existing API versions
149
150| WoltLab Suite Core | API-Version | Backwards-Compatible to API-Version |
151|---|---|---|
152| 3.1 | 2018 | n/a |
153
a0aa8ae0 154### `<instructions>`
a621986f
MS
155
156List of instructions to be executed upon install or update. The order is important, the topmost `<instruction>` will be executed first.
157
158#### `<instructions type="install">`
159
160List of instructions for a new installation of this package.
161
162#### `<instructions type="update" fromversion="…">`
163
164The attribute `fromversion` must be a valid version number as described in the [\<version\>](#version) section and specifies a possible update from that very version to the package's version.
165
9003992d 166!!! warning "The installation process will pick exactly one update instruction, ignoring everything else. Please read the explanation below!"
a621986f
MS
167
168Example:
169
170- Installed version: `1.0.0`
171- Package version: `1.0.2`
172
173```xml
174<instructions type="update" fromversion="1.0.0">
175 <!-- … -->
176</instructions>
177<instructions type="update" fromversion="1.0.1">
178 <!-- … -->
179</instructions>
180```
181
182In this example WoltLab Suite Core will pick the first update block since it allows an update from `1.0.0 -> 1.0.2`.
183The other block is not considered, since the currently installed version is `1.0.0`. After applying the update block (`fromversion="1.0.0"`), the version now reads `1.0.2`.
184
185#### `<instruction>`
186
187Example:
188
189```xml
190<instruction type="objectTypeDefinition">objectTypeDefinition.xml</instruction>
191```
192
193The attribute `type` specifies the instruction type which is used to determine the package installation plugin (PIP) invoked to handle its value.
194The value must be a valid file relative to the location of `package.xml`.
195Many PIPs provide default file names which are used if no value is given:
196
197```xml
198<instruction type="objectTypeDefinition" />
199```
200
21609ed2 201There is a [list of all default PIPs](pip.md) available.
a621986f 202
9003992d 203!!! warning "Both the `type`-attribute and the element value are case-sensitive. Windows does not care if the file is called `objecttypedefinition.xml` but was referenced as `objectTypeDefinition.xml`, but both Linux and Mac systems will be unable to find the file."
595613d0
MS
204
205In addition to the `type` attribute, an optional `run` attribute (with `standalone` as the only valid value) is supported which forces the installation to execute this PIP in an isolated request, allowing a single, resource-heavy PIP to execute without encountering restrictions such as PHP’s `memory_limit` or `max_execution_time`:
206
207```xml
208<instruction type="file" run="standalone" />
209```
102a9caf
TD
210
211#### `<void/>`
212
213Sometimes a package update should only adjust the metadata of the package, for example, an optional package was added.
214However, WoltLab Suite Core requires that the list of `<instructions>` is non-empty.
215Instead of using a dummy `<instruction>` that idempotently updates some PIP, the `<void/>` tag can be used for this use-case.
216
217Using the `<void/>` tag is only valid for `<instructions type="update">` and must not be accompanied by other `<instruction>` tags.
218
219Example:
220
221```xml
222<instructions type="update" fromversion="1.0.0">
223 <void/>
224</instructions>
225```