Advertisement:
A2Hosting

Author Topic: Package SDK: modification.xml  (Read 26129 times)

Offline SleePy

  • Site Team
  • SMF Master
  • *
  • Posts: 28,868
  • Gender: Male
  • Thats his happy face.
    • @jdarwood on Twitter
    • SleePy Code - My personal site
Package SDK: modification.xml
« on: March 17, 2009, 06:57:37 PM »
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
  • ignore: used to ignore an error
  • skip: skip this operation/file
  • fatal: stop the entire modification and return an error

There are also variables that may be used in place of a path. Italics denotes the commonly used path so you get an understanding of what the variable references.
  • $boarddir: The directory where index.php is found. Usually one level beneath the source files are contained.
  • $sourcedir: The directory where the source files are contained (ie Post.php, Admin.php, etc) /Sources
  • $avatardir: The directory where the avatars may be found /Avatars
  • $themedir: The directory of the default theme
  • $themes_dir: The directory containing the default, and other themes
  • $imagesdir: The images directory of the default theme
  • $languagedir: The location of the directories of language files
  • $smileysdir: The location of the smiley directory

modification.xml
All elements, unless otherwise stated, are not optional and contain no attributes.

  • <modification></modification>
  • <id></id>
    • Contains the id of the package. Should be in the format of [username]:[package name]. For instance groundup:bestmod When submitting a mod to the mod site, the username should be your username from www.simplemachines.org
  • <version></version>
    • The package's current version.
  • <file></file>
    • The file to modify. Including all of the operations to take on this file.
    • Attributes:
      • name: the name of the file and path
      • error: what to do when this file cannot be modified; "ignore" "fatal" or "skip"; use "ignore" to create a new file; optional; default to "fatal"
    • Elements:
      • <operation></operation>
        • An operation to be perfomed on this file
        • Attributes:
          • error: what to do if this operation can not be performed; "ignore" "fatal" or "required"; use "required" if this operation must fail; defaults to "fatal"; optional
          • Elements:
            • <search></search> or <search /> (for use with position="end" only)
              • The code to search for
              • Attributes:
                • position: the position of where the search code should exist after changes: "before" (to put the code before your addition), "after" (to put the code after your addition), or "replace"; required
                • whitespace: Whether to ignore whitespace or not: "exact" (default) or "loose"; optional; default: exact
                • regexp: If the search is a regularexpression or not. "true" or "false"; optional; default: false
            • <add></add>
              • The code to add
« Last Edit: October 07, 2009, 03:46:07 PM by Arantor »
Jeremy D — Site Team / SMF Developer
Support the SMF Support team!
Profiles:
GitHub
G+

Offline Inter

  • Jr. Member
  • **
  • Posts: 262
  • Gender: Male
Re: Package SDK: modification.xml
« Reply #1 on: August 22, 2012, 06:44:16 AM »
how to tell the installer to ignore the first right bracket?

Code: [Select]
<search position="replace"><![CDATA[<script type="text/javascript"><!-- // --><![CDATA[...
// ]]></script>]]></search>

Code: [Select]
<add><![CDATA[<script type="text/javascript"><!-- // --><![CDATA[...
// ]]></script>]]></add>
Sorry my English  ;)

Online emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,071
  • Gender: Male
  • THERE'S JUST ME
Re: Package SDK: modification.xml
« Reply #2 on: August 22, 2012, 07:59:13 AM »
Unfortunately for the <search> there is no way around. You have to find another point to replace...

For the <add> you can do like this:
Code: [Select]
<add><![CDATA[<script type="text/javascript"><!-- // --><![CD' . 'ATA[...
// ]' . ']></script>]]></add>
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Inter

  • Jr. Member
  • **
  • Posts: 262
  • Gender: Male
Re: Package SDK: modification.xml
« Reply #3 on: August 27, 2012, 12:32:54 PM »
Error:
Code: [Select]
$txt['key'] = '<<word>>';
Sorry my English  ;)

Online emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,071
  • Gender: Male
  • THERE'S JUST ME
Re: Package SDK: modification.xml
« Reply #4 on: August 27, 2012, 12:40:43 PM »
Could you be a bit more specific?
Are you using that one in the <search> or <add> tags? How?
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Inter

  • Jr. Member
  • **
  • Posts: 262
  • Gender: Male
Re: Package SDK: modification.xml
« Reply #5 on: August 27, 2012, 12:49:51 PM »
brackets are not used for tag and as a punctuation mark
Sorry my English  ;)

Online emanuele

  • Language Moderator
  • SMF Super Hero
  • *
  • Posts: 14,071
  • Gender: Male
  • THERE'S JUST ME
Re: Package SDK: modification.xml
« Reply #6 on: August 27, 2012, 01:09:28 PM »
So you mean that:
Code: [Select]
<search position="end" />
<add><![CDATA[$txt['key'] = '<<word>>';]]></add>
doesn't work?
Do you want to discover what I'm doing? Here it is!



Hai bisogno di supporto in Italiano?

* emanuele dislikes "like" and alike

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

It has been reported to me that I'm being snarky, feel free to be offended by my comments, I'm probably doing it on purpose...or not.

Offline Inter

  • Jr. Member
  • **
  • Posts: 262
  • Gender: Male
Re: Package SDK: modification.xml
« Reply #7 on: August 28, 2012, 03:20:49 AM »
So you mean that:
Code: [Select]
<search position="end" />
<add><![CDATA[$txt['key'] = '<<word>>';]]></add>
doesn't work?
yes

solved: brackets can be changed to &lt; &gt;
Sorry my English  ;)