Package-info.xml

From SMFMods

Jump to: navigation, search


H7otLc hi! hice site!

nice work man 10x

Contents

[edit] Install

Each package-info.xml file should have at least one install section. The "for" attribute defines which SMF versions this install section will be used for. It can be a comma-separated list of version numbers (eg. 1.1.1, 1.1.2, 1.1.3), a hyphen-separated range (eg. 1.1.1-1.1.3), or a mix of both (eg. 1.1, 1.1.1-1.1.3). If no "for" attribute is specified, this section will be used for any other SMF versions (any versions not explicitly matched by another install section).

As an example:

<install for="1.1, 1.1.1-1.1.99">
	<!-- Contents ommited for clarity -->
</install>
 
<install>
	<!-- Contents ommited for clarity -->
</install>

If the user was using SMF 1.1, or any version between SMF 1.1.1 to 1.1.99, the first install section will be used. Otherwise, if they're using a different version (eg. SMF 1.0 or SMF 2.0), the second section will be used.

[edit] Uninstall

Uninstall sections are similar to install sections.

Example:

<uninstall for="1.1, 1.1.1-1.1.99">
	<!-- Contents omitted for clarity -->
</uninstall>
 
<uninstall>
	<!-- Contents omitted for clarity -->
</uninstall>

[edit] Upgrade

Upgrade sections are similar to install and uninstall sections, with one significant difference — They also specify an old version of the mod (with the "from" attribute). As with install and uninstall sections, the "for" attribute is optional.

An example:

<upgrade from="1.1">
	<readme>readme_upgrade.txt</readme>
	<code>upgradeScript.php</code>
 
	<require-file name="Shop.template.php" destination="$themedir" />	
	<create-dir name="test" destination="$boarddir" />
	<move-file name="changelog.txt" from="$boarddir" destination="$sourcedir" />
 
	<modification format="xml" type="file">upgrade_1-0_SMF1.1.xml</modification>
</upgrade>
 
<upgrade from="1.0" for="1.1, 1.1.1-1.1.99">
	<readme>readme_upgrade.txt</readme>
	<code>upgradeScript.php</code>
 
	<require-file name="Shop.template.php" destination="$themedir" />	
	<create-dir name="test" destination="$boarddir" />
	<move-file name="changelog.txt" from="$boarddir" destination="$sourcedir" />
 
	<modification format="xml" type="file">upgrade_1-0_SMF1.1.xml</modification>
</upgrade>
 
<upgrade from="1.0">
	<readme>readme_upgrade.txt</readme>
	<code>upgradeScript.php</code>
 
	<require-file name="Shop.template.php" destination="$themedir" />	
	<create-dir name="test" destination="$boarddir" />
	<move-file name="changelog.txt" from="$boarddir" destination="$sourcedir" />
 
	<modification format="xml" type="file">upgrade_1-0_SMF1.1.xml</modification>
</upgrade>

With the example above, if the user had version 1.1 of the mod installed, the first section would be used. If the user had version 1.0 of the mod installed on SMF 1.1, the second section would be used. Finally, if they had version 1.0 of the mod installed on anything except for SMF 1.1, the third section would be used.

[edit] Inside the sections themselves

Inside the install, uninstall and upgrade sections, a number of elements may be used. These are:

[edit] General elements

  • readme — A readme to use.
    Attributes:
    • parsebbc — If set to "yes", BBCode will be parsed in the readme you may use BBCode in it).
    • type — If set to "inline", readme is assumed to be inline:
      <readme type="inline">Your readme goes here!</readme>
      . Otherwise, it is assumed to be a file name:
      <readme>readme.txt</readme>
  • code — Name of a PHP script to run during installation. Usually, this script will do things like add settings to the database, etc.
  • modification — Name of a Modification XML File to use. This can be used more than once within the one section.
    • reverse — If set to true, the changes in the modification will be reversed (effectively undoing the mod). This is often used in uninstall sections, so you don't need a separate uninstall modification file.

[edit] Installed files

  • require-file — This is the one of the most common elements. It is used when you want to copy a file from the package archive into the SMF directory. Attributes:
    • name — Name of the file.
    • destination — Where to copy it to.
  • require-dir — Similar to require-file, but instead copies a whole directory. Attributes:
    • name — Name of the directory.
    • destination — Where to copy it to.
  • create-dir — Create a new directory.
    • name — Name of the new directory.
    • destination — Where to create it.
  • create-file — Create a blank file.
    • name — What to call the file.
    • destination — Where to create it.
  • move-dir — Move a directory from one place to another. Note: This is not for copying a directory from the package archive... Use require-dir for that!
    • name — Name of the directory.
    • destination — Where to move it to.
  • move-file — Move a file from one place to another. Note: This is not for copying a file from the package archive... Use require-file for that!
    • name — Name of the file.
    • destination — Where to move it to.
  • remove-dir — Delete a directory. This is usually used in uninstall sections, to clean up files from your mod.
    • name — Path of the directory.
  • remove-file — Delete a file.
    • name — Path of the file.

[edit] File name variables

In all of the file name attributes, special variables can be used. It is recommended to use these variables, as a user's file structure may be different:

  • $boarddir — The SMF directory.
  • $sourcedir — The Sources directory.
  • $themedir or $themesdir — The Themes/default directory.
  • $languagedir or $languagesdir — the Themes/default/languages directory.
  • $imagedir or $imagesdir — The Themes/default/images directory.
Personal tools