Package-info.xml: Difference between revisions From Online Manual

Jump to: navigation, search
(Created page with "Before reading on, you should know some definitions used in this documentation: * ''element'' aka ''tag'': an instruction used to tell the package manager what to do. ie <inst...")
 
(Add new 2.1 package tags)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Before reading on, you should know some definitions used in this documentation:
Before reading on, you should know some definitions used in this documentation:
* ''element'' aka ''tag'': an instruction used to tell the package manager what to do. ie &lt;install&gt;&lt;/install&gt;
* ''element'' aka ''tag'': an instruction used to tell the package manager what to do. ie <install></install>
* ''attribute'' aka ''property'': an additional value used to describe an element
* ''attribute'' aka ''property'': an additional value used to describe an element
* ''inline'': code or text that is written in this file instead of coming from an outside source
* ''inline'': code or text that is written in this file instead of coming from an outside source
* ''file'': the name or location of a file to be used instead of "inline"
* ''file'': the name or location of a file to be used instead of "inline"
* ''location'' aka ''path'': the location on the computer of a directory and/or file</ul>
* ''location'' aka ''path'': the location on the computer of a directory and/or file
There are also variables that may be used in place of a path.
There are also variables that may be used in place of a path.
* $sourcedir: The directory where the source files are contained (ie Post.php, Admin.php, etc)
* $sourcedir: The directory where the source files are contained (ie Post.php, Admin.php, etc)
Line 12: Line 12:
* $imagesdir: The directory of the images for each theme
* $imagesdir: The directory of the images for each theme
* $languagedir: The location of the directories of language files
* $languagedir: The location of the directories of language files
* $smileysdir: The location of the smiley directory</ul>
* $smileysdir: The location of the smiley directory
'''package-info.xml'''
'''package-info.xml'''
''All elements, unless otherwise stated, are not optional and contain no attributes.''
''All elements, unless otherwise stated, are not optional and contain no attributes.''


* '''&lt;package-info&gt;&lt;/package-info&gt;'''
* '''<package-info></package-info>'''
<ul class="bbc_list">
** Must encompass all other elements in the file.
* Must encompass all other elements in the file.
** '''Attributes''':
* '''Attributes''':<ul class="bbc_list">
*** ''xmlns'': defaults to ''[http://www.simplemachines.org/xml/package-info http://www.simplemachines.org/xml/package-info]''; optional
* ''xmlns'': defaults to ''[http://www.simplemachines.org/xml/package-info]''; optional</ul></ul>
* '''<id></id>'''
* '''&lt;id&gt;&lt;/id&gt;'''
** Contains the id of the package. Should be in the format of [username]:[package name]. For instance ''sleepy:LeetMod'' When submitting a mod to the mod site, the username should be your username from [http://www.simplemachines.org www.simplemachines.org]
<ul class="bbc_list">
* '''<name></name>'''
* Contains the id of the package. Should be in the format of [username]:[package name]. For instance ''sleepy:LeetMod'' When submitting a mod to the mod site, the username should be your username from [http://www.simplemachines.org www.simplemachines.org]</ul>
** Contains the name of the package.
* '''&lt;name&gt;&lt;/name&gt;'''
* '''<type></type>'''
<ul class="bbc_list">
** The type of package - "avatar", "language", or "modification".
* Contains the name of the package.</ul>
* '''<version></version>'''
* '''&lt;type&gt;&lt;/type&gt;'''
** The package's current version.
<ul class="bbc_list">
* '''<install></install>, <upgrade></upgrade>, and <uninstall></uninstall>'''
* The type of package - "avatar", "language", or "modification".</ul>
** Actions taken on installation. The elements and their attributes are the same for the install, upgrade, and uninstall elements.
* '''&lt;version&gt;&lt;/version&gt;'''
** '''Attributes''':
<ul class="bbc_list">
*** ''for'': What versions to install/upgrade/uninstall for. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional
* The package's current version.</ul>
*** ''from'': Upgrade Only; What mod versions they are upgrading from. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional
* '''&lt;install&gt;&lt;/install&gt;, &lt;upgrade&gt;&lt;/upgrade&gt;, and &lt;uninstall&gt;&lt;/uninstall&gt;'''
** '''Elements''':
<ul class="bbc_list">
*** '''<readme></readme> or <readme /> (for use with type="file" only)'''
* Actions taken on installation. The elements and their attributes are the same for the install, upgrade, and uninstall elements.
**** Filename of the readme file
* '''Attributes''':
**** '''Optional''': Yes
<ul class="bbc_list">
**** '''Attributes''':
* ''for'': What versions to install/upgrade/uninstall for. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional
***** lang: which language this readme applies to; optional
* ''from'': Upgrade Only; What mod versions they are upgrading from. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional</ul>
***** parsebbc: whether or not to parse bbcode in the readme; optional; defaults to false
* '''Elements''':
***** type: "inline" or "file"; defaults to "file"; optional
<ul class="bbc_list">
*** '''<hook />'''
* '''&lt;readme&gt;&lt;/readme&gt; or &lt;readme /&gt; (for use with type="file" only)'''
**** Adds an integration function
<ul class="bbc_list">
**** Only exists in SMF 2.1 or higher
* Filename of the readme file
**** '''Optional''': Yes
* '''Optional''': Yes
**** '''Attributes''':
* '''Attributes''':
***** hook: the complete hook name
<ul class="bbc_list">
***** function: the function name. Can be a call to a method via Class::method
* lang: which language this readme applies to; optional
***** file: the file. Must include one of the following wildcards: $boarddir, $sourcedir, $themedir, example: $sourcedir/Test.php
* parsebbc: whether or not to parse bbcode in the readme; optional; defaults to false
***** object: indicates if your class will be instantiated when its respective hook is called. If true, your function must be a method
* type: "inline" or "file"; defaults to "file"; optional</ul></ul>
***** reverse: removes the integration function
* '''&lt;code&gt;&lt;/code&gt; or &lt;code /&gt; (for use with type="file" only)'''
*** '''<credits></credits>'''
<ul class="bbc_list">
**** Title of the package
* Filename of a php file to be executed.
**** Only exists in SMF 2.1 or higher
* Deprecated use in SMF 2.0, please use &lt;database&gt; in SMF 2.0 or higher
**** '''Optional''': Yes
* '''Optional''': Yes
**** '''Attributes''':
* '''Attributes''':
***** url: link to third party website if any
<ul class="bbc_list">
***** license: name of the chosen package license
* type: "inline" or "file"; defaults to "file"; optional</ul></ul>
***** licenseurl: link to the full license contents
* '''&lt;database&gt;&lt;/database&gt; or &lt;database /&gt; (for use with type="file" only)'''
***** copyright: copyright year
<ul class="bbc_list">
*** '''<nowiki><code></code> or <code /> </nowiki>(for use with type="file" only)'''
* Filename of a database code to be executed.
**** Filename of a php file to be executed.
* Only exists in SMF 2.0 or higher
**** '''Optional''': Yes
* '''Optional''': Yes
**** '''Attributes''':
* '''Attributes''':
***** type: "inline" or "file"; defaults to "file"; optional
<ul class="bbc_list">
*** '''<database></database> or <database /> (for use with type="file" only)'''
* type: "inline" or "file"; defaults to "file"; optional</ul></ul>
**** Filename of a database code to be executed.
* '''&lt;modification&gt;&lt;/modification&gt; or &lt;modification /&gt; (for use with type="file" only)'''
**** Only exists in SMF 2.0 or higher
<ul class="bbc_list">
**** '''Optional''': Yes
* Instructions to take for a modification.
**** '''Attributes''':
* '''Optional''': Yes
***** type: "inline" or "file"; defaults to "file"; optional
* '''Attributes''':
*** '''<modification></modification> or <modification /> (for use with type="file" only)'''
<ul class="bbc_list">
**** Instructions to take for a modification.
* type: if "inline", you may use the &lt;file&gt;, &lt;operation&gt;, &lt;search&gt;, and &lt;add&gt; elements listed in the modification.xml documentation."inline" or "file"; defaults to "file"; optional
**** '''Optional''': Yes
* reverse: reverse the instructions; "true" or "false"; defaults to "false"; optional
**** '''Attributes''':
* format: this documentation only covers xml formatted modifications and it is recommended that you use this format; "xml" or "boardmod"; defaults to "xml"; optional</ul></ul>
***** type: if "inline", you may use the <file>, <operation>, <search>, and <add> elements listed in the modification.xml documentation."inline" or "file"; defaults to "file"; optional
* '''&lt;create-dir /&gt;'''
****** reverse: reverse the instructions; "true" or "false"; defaults to "false"; optional
<ul class="bbc_list">
****** format: this documentation only covers xml formatted modifications and it is recommended that you use this format; "xml" or "boardmod"; defaults to "xml"; optional
* Create a new directory.
*** '''<create-dir />'''
* '''Optional''': Yes
**** Create a new directory.
* '''Attributes''':
**** '''Optional''': Yes
<ul class="bbc_list">
**** '''Attributes''':
* name: the name of the directory
***** name: the name of the directory
* destination: the path of the directory where you want to create this new directory</ul></ul>
***** destination: the path of the directory where you want to create this new directory
* '''&lt;create-file /&gt;'''
*** '''<create-file />'''
<ul class="bbc_list">
**** Create a blank file.
* Create a blank file.
**** '''Optional''': Yes
* '''Optional''': Yes
**** '''Attributes''':
* '''Attributes''':
***** name: the name of the file
<ul class="bbc_list">
***** destination: the path of the directory where you want to create this new file
* name: the name of the file
*** '''<require-dir />'''
* destination: the path of the directory where you want to create this new file</ul></ul>
**** Require a directory and all files in it from inside the package.
* '''&lt;require-dir /&gt;'''
**** '''Optional''': Yes
<ul class="bbc_list">
**** '''Attributes''':
* Require a directory and all files in it from inside the package.
***** from: the path to the directory
* '''Optional''': Yes
***** name: the name of the directory
* '''Attributes''':
***** destination: the path of where you want to put this directory>
<ul class="bbc_list">
*** '''<require-file />'''
* from: the path to the directory
**** Require a file from inside the package.
* name: the name of the directory
**** '''Optional''': Yes
* destination: the path of where you want to put this directory</ul></ul>
**** '''Attributes''':
* '''&lt;require-file /&gt;'''
***** from: the path to the file
<ul class="bbc_list">
***** name: the name of the file
* Require a file from inside the package.
***** destination: the path of where you want to put this file
* '''Optional''': Yes
*** '''<move-dir />'''
* '''Attributes''':
**** Move an entire directory. May also be used to rename a directory by moving it to it's parent directory with a different name.
<ul class="bbc_list">
**** '''Optional''': Yes
* from: the path to the file
**** '''Attributes''':
* name: the name of the file
***** from: the path of the directory you want to move
* destination: the path of where you want to put this file</ul></ul>
***** name: the name of the directory
* '''&lt;move-dir /&gt;'''
***** destination: the path to where you want to put the directory
<ul class="bbc_list">
*** '''<move-file />'''
* Move an entire directory. May also be used to rename a directory by moving it to it's parent directory with a different name.
**** Move a file. May also be used to rename a file by moving it to it's parent directory with a different name.
* '''Optional''': Yes
**** '''Optional''': Yes
* '''Attributes''':
**** '''Attributes''':
<ul class="bbc_list">
***** from: the path of the file you want to move
* from: the path of the directory you want to move
***** name: the name of the file
* name: the name of the directory
***** destination: the path to where you want to put the file
* destination: the path to where you want to put the directory</ul></ul>
*** '''<remove-dir />'''
* '''&lt;move-file /&gt;'''
**** Remove a directory and all files in it.
<ul class="bbc_list">
**** '''Optional''': Yes
* Move a file. May also be used to rename a file by moving it to it's parent directory with a different name.
**** '''Attributes''':
* '''Optional''': Yes
***** name: the name and path of the directory to be removed
* '''Attributes''':
*** '''<remove-file />'''
<ul class="bbc_list">
**** Remove a file.
* from: the path of the file you want to move
**** '''Optional''': Yes
* name: the name of the file
**** '''Attributes''':
* destination: the path to where you want to put the file</ul></ul>
***** name: the name and path of the file to be removed
* '''&lt;remove-dir /&gt;'''
*** '''<redirect></redirect> or <redirect />'''
<ul class="bbc_list">
**** Redirect after install/upgrade/uninstall.
* Remove a directory and all files in it.
**** '''Optional''': Yes
* '''Optional''': Yes
**** '''Attributes''':
* '''Attributes''':
***** url: the url to redirect to; Required. "$boardurl", "$scripturl", and "$session_id" are accepted.
<ul class="bbc_list">
***** type: inline or file. Whether to use a file or inline text for redirect text.
* name: the name and path of the directory to be removed</ul></ul>
***** timeout: Time until the redirect occurs. Default: 5 seconds
* '''&lt;remove-file /&gt;'''
<ul class="bbc_list">
* Remove a file.
* '''Optional''': Yes
* '''Attributes''':
<ul class="bbc_list">
* name: the name and path of the file to be removed</ul></ul>
* '''&lt;redirect&gt;&lt;/redirect&gt; or &lt;redirect /&gt;'''
<ul class="bbc_list">
* Redirect after install/upgrade/uninstall.
* '''Optional''': Yes
* '''Attributes''':
<ul class="bbc_list">
* url: the url to redirect to; Required. "$boardurl", "$scripturl", and "$session_id" are accepted.
* type: inline or file. Whether to use a file or inline text for redirect text.
* timeout: Time until the redirect occurs. Default: 5 seconds


[[Category:Developing SMF]]
[[Category:Developing SMF]]
[[Category:Package SDK]]
[[Category:Package SDK]]

Latest revision as of 18:04, 12 July 2019

Before reading on, you should know some definitions used in this documentation:

  • element aka tag: an instruction used to tell the package manager what to do. ie <install></install>
  • attribute aka property: an additional value used to describe an element
  • inline: code or text that is written in this file instead of coming from an outside source
  • file: the name or location of a file to be used instead of "inline"
  • location aka path: the location on the computer of a directory and/or file

There are also variables that may be used in place of a path.

  • $sourcedir: The directory where the source files are contained (ie Post.php, Admin.php, etc)
  • $boarddir: The directory where index.php is found. Usually one level beneath the source files are contained.
  • $avatardir: The directory where the avatars may be found
  • $themedir: The directory where the directories of the themes are located
  • $imagesdir: The directory of the images for each theme
  • $languagedir: The location of the directories of language files
  • $smileysdir: The location of the smiley directory

package-info.xml All elements, unless otherwise stated, are not optional and contain no attributes.

  • <package-info></package-info>
  • <id></id>
    • Contains the id of the package. Should be in the format of [username]:[package name]. For instance sleepy:LeetMod When submitting a mod to the mod site, the username should be your username from www.simplemachines.org
  • <name></name>
    • Contains the name of the package.
  • <type></type>
    • The type of package - "avatar", "language", or "modification".
  • <version></version>
    • The package's current version.
  • <install></install>, <upgrade></upgrade>, and <uninstall></uninstall>
    • Actions taken on installation. The elements and their attributes are the same for the install, upgrade, and uninstall elements.
    • Attributes:
      • for: What versions to install/upgrade/uninstall for. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional
      • from: Upgrade Only; What mod versions they are upgrading from. Comma delimited string with ranges such as "1.0-1.5,2.0"; optional
    • Elements:
      • <readme></readme> or <readme /> (for use with type="file" only)
        • Filename of the readme file
        • Optional: Yes
        • 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
      • <hook />
        • Adds an integration function
        • Only exists in SMF 2.1 or higher
        • Optional: Yes
        • Attributes:
          • hook: the complete hook name
          • function: the function name. Can be a call to a method via Class::method
          • file: the file. Must include one of the following wildcards: $boarddir, $sourcedir, $themedir, example: $sourcedir/Test.php
          • object: indicates if your class will be instantiated when its respective hook is called. If true, your function must be a method
          • reverse: removes the integration function
      • <credits></credits>
        • Title of the package
        • Only exists in SMF 2.1 or higher
        • Optional: Yes
        • Attributes:
          • url: link to third party website if any
          • license: name of the chosen package license
          • licenseurl: link to the full license contents
          • copyright: copyright year
      • <code></code> or <code /> (for use with type="file" only)
        • Filename of a php file to be executed.
        • Optional: Yes
        • Attributes:
          • type: "inline" or "file"; defaults to "file"; optional
      • <database></database> or <database /> (for use with type="file" only)
        • Filename of a database code to be executed.
        • Only exists in SMF 2.0 or higher
        • Optional: Yes
        • Attributes:
          • type: "inline" or "file"; defaults to "file"; optional
      • <modification></modification> or <modification /> (for use with type="file" only)
        • Instructions to take for a modification.
        • Optional: Yes
        • Attributes:
          • type: if "inline", you may use the <file>, <operation>, <search>, and <add> elements listed in the modification.xml documentation."inline" or "file"; defaults to "file"; optional
            • reverse: reverse the instructions; "true" or "false"; defaults to "false"; optional
            • format: this documentation only covers xml formatted modifications and it is recommended that you use this format; "xml" or "boardmod"; defaults to "xml"; optional
      • <create-dir />
        • Create a new directory.
        • Optional: Yes
        • Attributes:
          • name: the name of the directory
          • destination: the path of the directory where you want to create this new directory
      • <create-file />
        • Create a blank file.
        • Optional: Yes
        • Attributes:
          • name: the name of the file
          • destination: the path of the directory where you want to create this new file
      • <require-dir />
        • Require a directory and all files in it from inside the package.
        • Optional: Yes
        • Attributes:
          • from: the path to the directory
          • name: the name of the directory
          • destination: the path of where you want to put this directory>
      • <require-file />
        • Require a file from inside the package.
        • Optional: Yes
        • Attributes:
          • from: the path to the file
          • name: the name of the file
          • destination: the path of where you want to put this file
      • <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.
        • Optional: Yes
        • 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
      • <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.
        • Optional: Yes
        • 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
      • <remove-dir />
        • Remove a directory and all files in it.
        • Optional: Yes
        • Attributes:
          • name: the name and path of the directory to be removed
      • <remove-file />
        • Remove a file.
        • Optional: Yes
        • Attributes:
          • name: the name and path of the file to be removed
      • <redirect></redirect> or <redirect />
        • Redirect after install/upgrade/uninstall.
        • Optional: Yes
        • Attributes:
          • url: the url to redirect to; Required. "$boardurl", "$scripturl", and "$session_id" are accepted.
          • type: inline or file. Whether to use a file or inline text for redirect text.
          • timeout: Time until the redirect occurs. Default: 5 seconds


Advertisement: