Fixed docs on excluded packages
[GitHub/WoltLab/woltlab.github.io.git] / pages / package / package_package-xml.md
CommitLineData
a621986f
MS
1---
2title: package.xml
3sidebar: sidebar
4permalink: package_package-xml.html
5folder: package
6---
7
8The `package.xml` is the core component of every package.
9It 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.
10
11## Example
12
13```xml
14<?xml version="1.0" encoding="UTF-8"?>
15<package name="com.example.package" xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/vertex/package.xsd">
16 <packageinformation>
17 <packagename>Simple Package</packagename>
18 <packagedescription>A simple package to demonstrate the package system of WoltLab Suite Core</packagedescription>
19 <version>1.0.0</version>
20 <date>2016-12-18</date>
21 </packageinformation>
22
23 <authorinformation>
24 <author>YOUR NAME</author>
25 <authorurl>http://www.example.com</authorurl>
26 </authorinformation>
27
28 <requiredpackages>
29 <requiredpackage minversion="3.0.0">com.woltlab.wcf</requiredpackage>
30 </requiredpackages>
31
32 <instructions type="install">
33 <instruction type="file" />
34 <instruction type="template">templates.tar</instruction>
35 </instructions>
36</package>
37```
38
39
40## Elements
41
42### `<package>`
43
44The root node of every `package.xml` it contains the reference to the namespace and the location of the XML Schema Definition (XSD).
45
46The attribute `name` is the most important part, it holds the unique package identifier and is mandatory.
47It is based upon your domain name and the package name of your choice.
48
49For 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`.
50The resulting package identifier is `com.woltlab.wbb` (`<tld>.<domain>.<packageName>`).
51
52### `<packageinformation>`
53
54Holds the entire meta data of the package.
55
56#### `<packagename>`
57
58This is the actual package name displayed to the end user, this can be anything you want, try to keep it short.
59It 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:
60
61```xml
62<packageinformation>
63 <packagename>Simple Package</packagename>
64 <packagename languagecode="de">Einfaches Paket</packagename>
65</packageinformation>
66```
67
68#### `<packagedescription>`
69
70Brief summary of the package, use it to explain what it does since the package name might not always be clear enough.
71The attribute `languagecode` is available here too, please reference to [`<packagename>`](#packageName) for details.
72
73#### `<version>`
74
75The 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).
76
77The possible keywords are:
78
79- Alpha/dev (both is regarded to be the same)
80- Beta
81- RC (release candidate)
82- pl (patch level)
83
84Valid examples:
85
86- 1.0.0
87- 1.12.13 Alpha 19
88- 7.0.0 pl 3
89
90Invalid examples:
91
92- 1.0.0 Beta (keyword Beta must be followed by a number)
93- 2.0 RC 3 (version number must consists of 3 blocks of numbers)
94- 1.2.3 dev 4.5 (4.5 is not an integer, 4 or 5 would be valid but not the fraction)
95
96#### `<date>`
97
98Must be a valid [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) date, e.g. `2013-12-27`.
99
100### `<authorinformation>`
101
102Holds meta data regarding the package's author.
103
104#### `<author>`
105
106Can be anything you want.
107
108#### `<authorurl>`
109
110> (optional)
111
112URL to the author's website
113
114### `<requiredpackages>`
115
116A list of packages including their version required for this package to work.
117
118#### `<requiredpackage>`
119
120Example:
121```xml
122<requiredpackage minversion="2.0.0" file="requirements/com.woltlab.wcf.tar">com.woltlab.wcf</requiredpackage>
123```
124
125The attribute `minversion` must be a valid version number as described in [`<version>`](#version).
126The `file` attribute is optional and specifies the location of the required package's archive relative to the `package.xml`.
127
128### `<optionalpackage>`
129
130A list of optional packages which can be selected by the user at the very end of the installation process.
131
132#### `<optionalpackage>`
133
134Example:
135```xml
136<optionalpackage file="optionals/com.woltlab.wcf.moderatedUserGroup.tar">com.woltlab.wcf.moderatedUserGroup</optionalpackage>
137```
138
139The `file` attribute specifies the location of the optional package's archive relative to the `package.xml`.
140
7739597e 141### `<excludedpackages>`
a621986f
MS
142
143List 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.
144
7739597e 145#### `<excludedpackage>`
a621986f
MS
146
147Example:
148
149```xml
7739597e 150<excludedpackage version="3.1.0 Alpha 1">com.woltlab.wcf</excludedpackage>
a621986f
MS
151```
152
153The 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.
154
155#### `<instructions>`
156
157List of instructions to be executed upon install or update. The order is important, the topmost `<instruction>` will be executed first.
158
159#### `<instructions type="install">`
160
161List of instructions for a new installation of this package.
162
163#### `<instructions type="update" fromversion="…">`
164
165The 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.
166
167{% include callout.html content="The installation process will pick exactly one update instruction, ignoring everything else. Please read the explanation below!" type="warning" %}
168
169Example:
170
171- Installed version: `1.0.0`
172- Package version: `1.0.2`
173
174```xml
175<instructions type="update" fromversion="1.0.0">
176 <!-- … -->
177</instructions>
178<instructions type="update" fromversion="1.0.1">
179 <!-- … -->
180</instructions>
181```
182
183In this example WoltLab Suite Core will pick the first update block since it allows an update from `1.0.0 -> 1.0.2`.
184The 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`.
185
186#### `<instruction>`
187
188Example:
189
190```xml
191<instruction type="objectTypeDefinition">objectTypeDefinition.xml</instruction>
192```
193
194The attribute `type` specifies the instruction type which is used to determine the package installation plugin (PIP) invoked to handle its value.
195The value must be a valid file relative to the location of `package.xml`.
196Many PIPs provide default file names which are used if no value is given:
197
198```xml
199<instruction type="objectTypeDefinition" />
200```
201
202There is a [list of all default PIPs](package_pip.html) available.
203
204{% include callout.html content="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." type="warning" %}
595613d0
MS
205
206In 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`:
207
208```xml
209<instruction type="file" run="standalone" />
210```