Commit | Line | Data |
---|---|---|
e3747bbc | 1 | # package.xml |
a621986f MS |
2 | |
3 | The `package.xml` is the core component of every package. | |
4 | It 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 | ||
8 | ```xml | |
9 | <?xml version="1.0" encoding="UTF-8"?> | |
38ab2b9e | 10 | <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/2019/package.xsd"> |
a621986f MS |
11 | <packageinformation> |
12 | <packagename>Simple Package</packagename> | |
13 | <packagedescription>A simple package to demonstrate the package system of WoltLab Suite Core</packagedescription> | |
14 | <version>1.0.0</version> | |
15 | <date>2016-12-18</date> | |
16 | </packageinformation> | |
e119d647 | 17 | |
a621986f MS |
18 | <authorinformation> |
19 | <author>YOUR NAME</author> | |
20 | <authorurl>http://www.example.com</authorurl> | |
21 | </authorinformation> | |
e119d647 | 22 | |
a621986f MS |
23 | <requiredpackages> |
24 | <requiredpackage minversion="3.0.0">com.woltlab.wcf</requiredpackage> | |
25 | </requiredpackages> | |
3e0bb8da TK |
26 | |
27 | <excludedpackages> | |
28 | <excludedpackage version="6.0.0 Alpha 1">com.woltlab.wcf</excludedpackage> | |
29 | </excludedpackages> | |
e119d647 | 30 | |
a621986f MS |
31 | <instructions type="install"> |
32 | <instruction type="file" /> | |
33 | <instruction type="template">templates.tar</instruction> | |
34 | </instructions> | |
35 | </package> | |
36 | ``` | |
37 | ||
38 | ||
39 | ## Elements | |
40 | ||
41 | ### `<package>` | |
42 | ||
43 | The root node of every `package.xml` it contains the reference to the namespace and the location of the XML Schema Definition (XSD). | |
44 | ||
45 | The attribute `name` is the most important part, it holds the unique package identifier and is mandatory. | |
46 | It is based upon your domain name and the package name of your choice. | |
47 | ||
48 | For 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`. | |
49 | The resulting package identifier is `com.woltlab.wbb` (`<tld>.<domain>.<packageName>`). | |
50 | ||
51 | ### `<packageinformation>` | |
52 | ||
53 | Holds the entire meta data of the package. | |
54 | ||
55 | #### `<packagename>` | |
56 | ||
57 | This is the actual package name displayed to the end user, this can be anything you want, try to keep it short. | |
58 | It 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: | |
59 | ||
60 | ```xml | |
61 | <packageinformation> | |
62 | <packagename>Simple Package</packagename> | |
63 | <packagename languagecode="de">Einfaches Paket</packagename> | |
64 | </packageinformation> | |
65 | ``` | |
66 | ||
67 | #### `<packagedescription>` | |
68 | ||
69 | Brief summary of the package, use it to explain what it does since the package name might not always be clear enough. | |
70 | The attribute `languagecode` is available here too, please reference to [`<packagename>`](#packageName) for details. | |
71 | ||
72 | #### `<version>` | |
73 | ||
74 | The 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). | |
75 | ||
76 | The possible keywords are: | |
77 | ||
78 | - Alpha/dev (both is regarded to be the same) | |
79 | - Beta | |
80 | - RC (release candidate) | |
81 | - pl (patch level) | |
82 | ||
83 | Valid examples: | |
84 | ||
85 | - 1.0.0 | |
86 | - 1.12.13 Alpha 19 | |
87 | - 7.0.0 pl 3 | |
88 | ||
89 | Invalid examples: | |
90 | ||
91 | - 1.0.0 Beta (keyword Beta must be followed by a number) | |
92 | - 2.0 RC 3 (version number must consists of 3 blocks of numbers) | |
93 | - 1.2.3 dev 4.5 (4.5 is not an integer, 4 or 5 would be valid but not the fraction) | |
94 | ||
95 | #### `<date>` | |
96 | ||
97 | Must be a valid [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601) date, e.g. `2013-12-27`. | |
98 | ||
99 | ### `<authorinformation>` | |
100 | ||
101 | Holds meta data regarding the package's author. | |
102 | ||
103 | #### `<author>` | |
104 | ||
105 | Can be anything you want. | |
106 | ||
107 | #### `<authorurl>` | |
108 | ||
109 | > (optional) | |
110 | ||
476e5c87 | 111 | URL to the author's website. |
a621986f MS |
112 | |
113 | ### `<requiredpackages>` | |
114 | ||
115 | A list of packages including their version required for this package to work. | |
116 | ||
117 | #### `<requiredpackage>` | |
118 | ||
119 | Example: | |
476e5c87 | 120 | |
a621986f MS |
121 | ```xml |
122 | <requiredpackage minversion="2.0.0" file="requirements/com.woltlab.wcf.tar">com.woltlab.wcf</requiredpackage> | |
123 | ``` | |
124 | ||
125 | The attribute `minversion` must be a valid version number as described in [`<version>`](#version). | |
126 | The `file` attribute is optional and specifies the location of the required package's archive relative to the `package.xml`. | |
127 | ||
128 | ### `<optionalpackage>` | |
129 | ||
130 | A list of optional packages which can be selected by the user at the very end of the installation process. | |
131 | ||
132 | #### `<optionalpackage>` | |
133 | ||
134 | Example: | |
476e5c87 | 135 | |
a621986f MS |
136 | ```xml |
137 | <optionalpackage file="optionals/com.woltlab.wcf.moderatedUserGroup.tar">com.woltlab.wcf.moderatedUserGroup</optionalpackage> | |
138 | ``` | |
139 | ||
140 | The `file` attribute specifies the location of the optional package's archive relative to the `package.xml`. | |
141 | ||
7739597e | 142 | ### `<excludedpackages>` |
a621986f MS |
143 | |
144 | List 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. | |
145 | ||
7739597e | 146 | #### `<excludedpackage>` |
a621986f MS |
147 | |
148 | Example: | |
149 | ||
150 | ```xml | |
7739597e | 151 | <excludedpackage version="3.1.0 Alpha 1">com.woltlab.wcf</excludedpackage> |
a621986f MS |
152 | ``` |
153 | ||
154 | The 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. | |
155 | ||
e119d647 | 156 | ### `<compatibility>` |
9003992d MS |
157 | !!! info "Available since WoltLab Suite 3.1" |
158 | !!! 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 | 159 | |
e119d647 AE |
160 | WoltLab 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. |
161 | ||
162 | The `<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. | |
163 | ||
164 | Example: | |
165 | ||
166 | ```xml | |
167 | <compatibility> | |
168 | <api version="2018" /> | |
169 | </compatibility> | |
170 | ``` | |
171 | ||
172 | #### Existing API versions | |
173 | ||
174 | | WoltLab Suite Core | API-Version | Backwards-Compatible to API-Version | | |
175 | |---|---|---| | |
176 | | 3.1 | 2018 | n/a | | |
177 | ||
a0aa8ae0 | 178 | ### `<instructions>` |
a621986f MS |
179 | |
180 | List of instructions to be executed upon install or update. The order is important, the topmost `<instruction>` will be executed first. | |
181 | ||
182 | #### `<instructions type="install">` | |
183 | ||
184 | List of instructions for a new installation of this package. | |
185 | ||
186 | #### `<instructions type="update" fromversion="…">` | |
187 | ||
188 | The 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. | |
189 | ||
9003992d | 190 | !!! warning "The installation process will pick exactly one update instruction, ignoring everything else. Please read the explanation below!" |
a621986f MS |
191 | |
192 | Example: | |
193 | ||
194 | - Installed version: `1.0.0` | |
195 | - Package version: `1.0.2` | |
196 | ||
197 | ```xml | |
198 | <instructions type="update" fromversion="1.0.0"> | |
199 | <!-- … --> | |
200 | </instructions> | |
201 | <instructions type="update" fromversion="1.0.1"> | |
202 | <!-- … --> | |
203 | </instructions> | |
204 | ``` | |
205 | ||
206 | In this example WoltLab Suite Core will pick the first update block since it allows an update from `1.0.0 -> 1.0.2`. | |
207 | The 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`. | |
208 | ||
209 | #### `<instruction>` | |
210 | ||
211 | Example: | |
212 | ||
213 | ```xml | |
214 | <instruction type="objectTypeDefinition">objectTypeDefinition.xml</instruction> | |
215 | ``` | |
216 | ||
217 | The attribute `type` specifies the instruction type which is used to determine the package installation plugin (PIP) invoked to handle its value. | |
218 | The value must be a valid file relative to the location of `package.xml`. | |
219 | Many PIPs provide default file names which are used if no value is given: | |
220 | ||
221 | ```xml | |
222 | <instruction type="objectTypeDefinition" /> | |
223 | ``` | |
224 | ||
28a75024 | 225 | There is a [list of all default PIPs](package_pip.md) available. |
a621986f | 226 | |
9003992d | 227 | !!! 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 |
228 | |
229 | In 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`: | |
230 | ||
231 | ```xml | |
232 | <instruction type="file" run="standalone" /> | |
233 | ``` | |
102a9caf TD |
234 | |
235 | #### `<void/>` | |
236 | ||
237 | Sometimes a package update should only adjust the metadata of the package, for example, an optional package was added. | |
238 | However, WoltLab Suite Core requires that the list of `<instructions>` is non-empty. | |
239 | Instead of using a dummy `<instruction>` that idempotently updates some PIP, the `<void/>` tag can be used for this use-case. | |
240 | ||
241 | Using the `<void/>` tag is only valid for `<instructions type="update">` and must not be accompanied by other `<instruction>` tags. | |
242 | ||
243 | Example: | |
244 | ||
245 | ```xml | |
246 | <instructions type="update" fromversion="1.0.0"> | |
247 | <void/> | |
248 | </instructions> | |
249 | ``` |