
|
If you're reading this, it most likely means you are a mod maker interested in
using this installer script in your own mods. If that's the case, then this
script should meet your needs just fine. I welcome any and all mod makers to
use this script as their installer, all I ask is that you don't redistribute it
on their own, just link to a site to download it in your mod's instructions.
You can link to either link to IPSBeyond, and/or Invision Modding.
Apart from linking to this script, all you'd then need to include in your mods would be the XML files necessary, any custom PHP scripts, and the file edits. This document will walk you through the process of creating the XML files and the custom PHP scripts. The rest is up to you, good luck! |
|
Any mods that use this script must include an XML file. This file will hold all
of the necessary information that your mod requires for operation. Remember
that you only need to create this XML file if your mod needs to do one of the
tasks listed in the 'What can it do?' section of the script's main ReadMe file.
If your mod consists of just file edits and skin edits, you don't need this
script.
Start off by examining the included XML file in this directory, sample.xml. This XML file gives an example of each of the sections that can be included in the XML file for your mod. As you can see from this file, under the mod_data node, there are a total of 13 sections. The only one of which that is required is the very top section, mod_info. Apart from that, you will have to fill out at least one other section, otherwise there is nothing for the installer to do. But you can have as many of the other sections as you wish. And remember that for most of the sections, you can add multiple items for the script to perform (such as adding multiple language strings if needed). You add multiple items to a section by just duplicating the code inside the section tags and adding it to the existing code. Taking the example of the Languages section, if you wanted to add two language string installations to your script, you'd copy the code inside the <languages_group> section and duplicate it, keeping it inside that same section still. For example, this code will allow you to add a single language string as part of your mod install: While this block of code would be used for adding two language strings: So let me guide you through the process of creating your XML. Creating the file There is no simple way (yet) to just generate your XML based on some user input, the file must be created manually. This may seem daunting at first, but as you do it it should make more and more sense. I'm assuming that as part of the mod creating process you have a folder set aside for your mod. Inside that folder you will need to either create a mod_install subfolder for the XML file to go in to, or put the XML just in the mod's folder and include instructions to upload it into the site's mod_install directory. Copy the sample.xml file that comes in this documentation folder into the appropriate folder for your mod and rename the file. The file name should be something that will be unique to your mod, as users may be using this script for many mods and all XML files in this folder will need their own unique names. Using CDATA If you're not that familiar with the structure of XML, you need to at least understand the CDATA tag, it is used to make the XML parser ignore characters that may break the XML structure. You can read up on the use of this tag on W3Schools, here. As you create your XML file, be sure to remember this. You may think that everything is going along fine, but the script fails to read the XML, and it is most likely due to this tag not being used when it should. If you get errors that there was an error reading the XML file, go back and look through your code to determine if you need to CDATA an element of the file. mod_info Now that you have your file ready to hold the info, let's start plugging in our info. In the top section of our file, the mod_info section, we have the following elements. Remember that this section must be completed.
This is where you set up the ACP Settings Sections. These Settings Sections are the things that show up in your Tools & Settings page of the ACP. Generally speaking, if you need to set up these for your mod, you'll only be creating one. But if for some reason you need to set up more than one for your mod, that is also possible. To do that, just follow the steps above for creating multiple sections here. Just remember in which order you add them here as it will affect how you set up the settings for them. Here are the elements to the sections_group section:
Most mod authors will simply export these settings after adding them via the ACP. You can do that and just copy-paste the result of that into this section here, but I prefer to build this section manually. If you do paste in the generated XML, make sure you remove any blocks that refer to the settings group, as that is already covered above.
This is another that will often be copy-pasted from an export from the board after creating this yourself. I again build this manually except for the com_menu_data element, that ones too complicated to build manually.
This is used for adding new language strings. You can just include instructions for editing the language files directly, but this method makes the mod install easier for the people installing it.
These are used for the skin templates in the mod. Depending on the size of your mod, you may have a lot of these and you could be tempted to just include a language file, fight that urge. This is really best as it is a (nearly) foolproof method of setting up the skins for your mod.
Tasks are rarely used in mods, but they can often be some of the coolest mods as they work without you having to do anything to them. I tend to create my tasks using the Add New Task link in the ACP and then just look in the database for the values to out in here.
This allows you to add entries to your board's Help system, to create articles to instruct your users on board features, or features in the mod. Please note that you cannot use language strings here, each of these needs to be filled out in plain text in your board's language.
This feature specific to IP.Board 2.3.x allows you to add entries to your board's ACP Help system to add notes at the top of sections in your Admin CP to assist users of the mod. This feature will be ignored when mods are installed on IP.Board v2.2.x.
This section of the XML will let you create new tables in the database. Remember that this functionality is only verified to be supported in MySQL, with un-tested support for MSSQL implemented, so be warned that you may have people that use Oracle or MSSQL come to you and say this doesn't work for them; it definitely won't work for Oracle and might not work for MSSQL, it's an IPB limitation at this point.
This section will let you add or remove columns from database tables. Remember to fill out all of these sections even if the job of the installer is to remove an existing column; the uninstall may need to re-add it.
This section will allow you to insert rows into the database. Again, it is important to fill out all sections so both the install and uninstall will work correctly.
Using this section, you can update values for existing database entries. Remember to fill out all sections so the uninstall script will work.
The most powerful part of this installer script, with this section you can add a custom PHP script to be executed for any steps that are not covered in the sections above. Remember that you can only have up to one script per mod, but that script can do whatever you need it to. Refer to the section below for actually building that file.
Once you have each of the relevant sections above filled out, your XML should be complete. Remember that any of the above sections that do not apply to your mod can (and should) be left out of your XML. Also remember that it doesn't matter what order you put the various sections in, you can start off by defining the tasks_group then below that add some new settings; the script will handle putting all of the tasks in the correct order. All you have left to do then is package your XML file inside your mod and refer to this script in your instructions! |
|
You may find that the options that the script and XML files this tool gives you
just won't accomplish certain things that are needed by your mod. To deal with
this, I created the concept of custom PHP scripts that can be added in to your
mod installations. Creating these is a bit advanced, so keep that in mind as
you make it. I have included a basic sample.php file that you can use as a base
for your own custom install script.
The first thing you need to do is complete the <customs_group> section in the XML file as outlined above. Fill out the script_name tag with the name of the PHP file that will be used, remembering to leave off the .php extension. If your custom installation script need to execute certain actions before the rest of the XML file processes are run, then be sure to set the has_init key to 1. If your script will do work that will require the IPB caches or skins be re-cached, be sure to set those tags to 1 as appropriate as well. Next, rename the sample.php file in this directory to the file name specified above and include it in your mod's mod_install directory with the XML file. Open up this PHP file and check out it's contents. Be sure to first change the class name of this file, making that class name be the same as the file name, again without the .php extension. Note that the file contains 4 functions:
If doing a redirect, be sure to include some descriptive text explaining what work was done, you would put your text in the place where I have "Custom Script Redirect Text...." in the sample file. And remember, you only want to do either a call to $this->ipsclass->admin->redirect() or $this->ipsclass->boink_it(), not both. If you actually have work to execute for that step, it's best to use $this->ipsclass->admin->redirect() and explain what was done, and if you don't have any work to perform for that step, you'd use $this->ipsclass->boink_it() to just make it seem like you're skipping the step. The way this second option would come in to play would be if you did have custom script to run on installation, but none on uninstallation. As far as actually executing your custom code, how you do that is going to depend on what you need to do. Most often, the code you need to execute will go at the beginning of the function, before you call $this->ipsclass->input['step']++;. Remember that this script has access to the $this->ipsclass object, so it has access to all of it's associated functions and members, meaning you can perform database queries or any one of the dozens of other actions in $ipsclass. The final piece of advice I can give you about using this is to be sure to test it out thoroughly. Using custom scripts in this manner is very tricky for less experienced modders to do, but it is very powerful. |
|
This new feature allows you as a Developer to update users when there is a new
version of your mod out and available to them. The first step is to create the
XML file that will hold your mods' version info. Check out the mods.xml file
included in this folder:
Rename this file to whatever you want, and host the file on some publicly accessible location. Keep track of the URL to that file, you'll need it. For each mod you create to use this system, just add a new 'mod' section to this XML file. As you can see, each 'mod' section has just two pieces of info: the version number and the file name. Just change the version number here when you update your mods, and put the name of the mod's main XML file in as the file value (without the .xml extension). Now you have your remote XML file holding the version number, plug the URL of that file in the top of the XML file, in the version_file section. The Universal Mod Installer will do all the work of then finding your file and reading the version info to store into its internal variables. Then you just have to remember to update this XML file on your site each time you release a new mod or update an existing one, and when you do that then the users of your mods will see that there is an update available. |