Skip to content
Spuds edited this page Nov 26, 2022 · 2 revisions

DEVELOPER DOCUMENTATION > ADDON > Package Info

All elements, unless otherwise stated, are required and do not require any attributes.

<package-info></package-info>

Must wrap all other elements in the file with this tag

<id></id>

Contains the id of the package. Normally in the format of [username]:[package name].

  • Example <id>Bob:AwesomeAddon</id>
  • Important When submitting an addon to the Addon Site, the pkid should match the value used here e.g. pkid: "Bob:AwesomeAddon". Avoid using anything other than letters and numbers.

<name></name>

Contains the name of the package.

  • Example <name>My Awesome Addon</name>

<type></type>

The type of package - "avatar", "language", "addon" or "modification".

  • Example <type>addon</type>

<version></version>

The package's current version.

  • Example <version>1.0.7</version>

<install></install> and <uninstall></uninstall>

This is filled with the specific actions to be taken. The options and their attributes are the same for the install and uninstall.

  • Attributes:
    • for: The valid ElkArte versions to install/upgrade/uninstall for. A comma delimited string with ranges such as "1.0-1.1,2.0"
  • Example <install for="1.1 - 1.1.99">

Options for Install/Uninstall Section:

<readme></readme> or <readme /> Filename of the readme file OR if using type="inline" the text string to display

  • Attributes:
    • lang: which language this readme applies to; optional
    • parsebbc: whether or not to parse bbcode in the readme; optional; defaults to false
    • type: "inline" or "file"; defaults to "file"; optional
  • Example <readme type="inline">This important text will be ignored by users during the install phase.</readme>

<code></code> or <code /> or (the newer) <database></database> or <database /> Filename of a php file to be executed.

  • Attributes:
    • type: "inline" or "file"; defaults to "file"
  • Example <code>add_remove_hooks.php</code> a php file in your package

<hook /> Add a function to an integration hook, or remove a function from an integration hook.

  • Attributes:
    • hook: name of any integration hook as found in ElkArte
    • function: name of the function to call
    • file: path and name of the file that contains the function. Normally this is a file added by your addon, so you can use various constants like SOURCEDIR/MyFile.php
      • SOURCEDIR THEMEDIR SUBSDIR EXTDIR LANGUAGEDIR CONTROLLERDIR
    • reverse: if "true" removes the function from the integration hook (used for uninstalling); defaults to "false"
  • Example <hook hook="integrate_admin_areas" file="SOURCEDIR/MyAddonIntegration.php" function="someFunctionp" />

<modification></modification> or <modification /> Steps to take for a source modification / edit. Although an option, its use should be considered a last resort as changing the source code can/will interfear with upgrades.

  • Attributes:
    • type: if "inline", you may use the , , , and elements listed in the modification.xml documentation. "inline" or "file"; defaults to "file"
    • reverse: reverse the instructions; "true" or "false"; defaults to "false"
  • Example <modification>modification.xml</modification>

<create-dir /> Create a new directory.

  • Attributes:
    • name: the name of the directory
    • destination: the path of the directory where you want to create this new directory
  • Example <create-dir name="SomeDirToCreate" destination="BOARDDIR" />

<create-file /> Create a blank file.

  • Attributes:
    • name: the name of the file
    • destination: the path of the directory where you want to create this new file
  • Example <create-file name="SomeFile.txt" destination="BOARDDIR" />

<require-dir /> Require a directory and all files in it from inside the package.

  • Attributes:
    • from: the path to the directory
    • name: the name of the directory
    • destination: the path of where you want to put this directory
  • Example <require-dir name="DirInPackage" destination="BOARDDIR" />

<require-file /> Require a file from inside the package.

  • Attributes:
    • from: the path to the file
    • name: the name of the file
    • destination: the path of where you want to put this file
  • Example <require-file name="SomeFile.txt" destination="BOARDDIR" />

<move-dir /> Move an entire directory. May also be used to rename a directory by moving it to it's parent directory with a different name.

  • Attributes:
    • from: the path of the directory you want to move
    • name: the name of the directory
    • destination: the path to where you want to put the directory
  • Example <move-dir name="SomeDirToMove" destination="BOARDDIR" />

<move-file /> Move a file. May also be used to rename a file by moving it to it's parent directory with a different name.

  • Attributes:
    • from: the path of the file you want to move
    • name: the name of the file
    • destination: the path to where you want to put the file
  • Example <move-file name="SomeMoveFile.txt" destination="BOARDDIR" />

<remove-dir /> Remove a directory and all files in it (only during uninstall)

  • Attributes:
    • name: the name and path of the directory to be removed
  • Example <remove-dir name="BOARDDIR/SomeDirToCreate" />

<remove-file /> Remove a file.

  • Attributes:
    • name: the name and path of the file to be removed (only during uninstall)
  • Example <remove-file name="BOARDDIR/SomeFile.txt" />

<redirect></redirect> or <redirect /> Redirect after install/uninstall.

  • Attributes:
    • url: the url to redirect to; Required.
    • type: inline or file. Whether to use a file or inline text for redirect text.
    • timeout: Time until the redirect occurs. Default: 5 seconds
  • Example <redirect url="?action=admin;area=packages" timeout="5000" />
Clone this wiki locally