Login/Register
Last Update: 2012-02-13

Application Packaging SDK

An Installatron application package is comprised of several files and directories, placed in the Installatron's "installers" directory:

/var/installatron/installers/installerid/
    init.xml             // information about the installer and the application
    locale_en.php        // the default (english) locale file
    button.png           // a 88x31 button image for the app
    logo.png             // up to 400x150 logo image for the app
    icon.png             // 175x175 icon image for the app
    icon64.png           // 64x64 icon image for the app (resized icon.png)
    ss1.png              // 1024x640 screenshot of the app
    ss2.png              // 1024x640 screenshot of the app
    version1/            // a version sub-directory
        LICENSE          // license agreement for this version (optional)
        init.xml         // information for this version
        install.php      // install code for this version
    version2/            // another version sub-directory (optional)
        LICENSE
        init.xml
        install.php
        upgrade.php      // upgrade code for upgrading to this version (optional)

installerid is the unique lowercase-alphanumeric id of the installer.

version1, version2, etc are the versions (eg. "2.1.0p1", "2.1.1", etc).

Back to top▴

Creating an application package

The easiest way to create an Installatron application package is to use the Installer Maker/Editor tool. This tool creates a basic template and has a GUI for editing most of the commonly used features.

See the Refrence: Variables, Commands, and How-Tos section for a closer look at the things you can use in application package installer and upgrader code, the Using an Installer section for information on adding the application package to your server, or read blow for a closer look at each file and directory in an Installatron application package:

Back to top▴

installerid/

The installer id is lowercase alphanumeric key that must be unique to the installer. Usually these are named after the application being installed, so for example the id for the phpBB installer is phpbb.

Back to top▴

installerid/init.xml

The top-level init.xml file contains general information about the installer and the application it installs. Here is the format:

<?xml version='1.0'?>
<installer>
    <information>
        <info id="id" value="installerid"/>
        <info id="build" value="builder_number"/>
        <info id="status" value="enabled"/>
        <info id="name" value="_installer_installerid_title"/>
        <info id="type" value="_installer_installerid_type"/>
        <info id="category" value="_installer_installerid_category"/>
        <info id="created" value="YYYY-MM-DD"/>
        <info id="description" value="_installer_installerid_description"/>
        <info id="authordescription" value="_installer_installerid_authordescription"/>
    </information>
    <links>
        <link id="site" value="url_to_app_website"/>
        <link id="docs" value="url_to_app_documentation"/>
        <link id="faq" value="url_to_app_faq"/>
        <link id="support" value="url_to_app_support"/>
        <link id="demo" value="url_to_app_demo"/>
    </links>
    <versions>
        <branch id="current">
            <version id="version3" upgrade="auto" install="auto"/>
            <version id="version2" upgrade="auto" install="auto"/>
            <version id="version1" upgrade="none" install="auto"/>
        </branch>
    </versions>
</installer>

installerid is the unique id of the installer.

build_number is the current build number of the installer. Increment this number whenever the installer is edited.

_installer_installerid_* are references to locale entries. You can use plain text here if you don't want to use the locale file.

url_to_* are all optional, though users do like to see at least a website link for the application.

version1, version2, etc are the versions (eg. "2.1.0p1", "2.1.1", etc), with the newest version at the top. If upgrading is not supported then there will be a single version in this area.

upgrade types, in the versions section, can be: none (cannot upgrade to this version), manual (can only upgrade manually to this version), auto (auto-upgrading is supported by the installer), or skip (auto-upgrading is supported by the installer, and this version can be skipped over if upgrading to a later version).

install types, in the versions section, can be: none (cannot install this version), auto (auto-installing is supported by the installer).

Back to top▴

installerid/locale_en.php

The default locale file. You can have as many translations as you wish to support. For example, a French translation would be locale_fr.php. Here is the format:

<?php
itron::$locale = array_merge(itron::$locale,array(
    "_installer_installerid_title" => "app_name",
    "_installer_installerid_type" => "app_type",
    "_installer_installerid_category" => "app_category",
    "_installer_installerid_input_inputid_label" => "input_description",
    "_installer_installerid_input_inputid_text" => "short_input_description",
    "_installer_installerid_description" => "formal_description",
    "_installer_installerid_authordescription" => "author_description",
));
?>

installerid is the unique id of the installer.

app_name is the name of the application (eg. "My Application").

app_type is one of these: or any plain text.

app_category is one of these: or any plain text to create a new category of application.

inputid keys are only used if custom fields are used in the installer. inputid is the id of the input (see fields section below).

formal_description is a description of the application in an formal format. Look at the descriptions in Installatron to see the format used.

authors_description is a longer description of the application, usually quoted from the website of the application.

NOTE: you can also add your own locale keys, using the _installer_installerid_ prefix on any lines that you add.

Back to top▴

installerid/button.png

A "button" image for the application in PNG or GIF format, sized at exactly 88x31.

Back to top▴

installerid/logo.png

A "logo" image for the application in PNG or GIF format, up to 400x150 in size.

Back to top▴

installerid/icon.png

An "icon" image for the application in PNG format, sized at exactly 175x175.

Back to top▴

installerid/icon64.png

The "icon" image for the application in PNG format resized to exactly 64x64.

Back to top▴

installerid/ss1.jpg

installerid/ss2.jpg

installerid/ssN.jpg

Any number of screenshot images for the application in GIF, JPG, or PNG format. Most commonly sized at 1024x640.

Back to top▴

installerid/version/

There is one version/ directory for each version of the application that is supported by the package. If the package installs a single version, or does not support upgrading, then there will be a single version directory. The version should have no spaces, and should only use characters that can be used in a directory name.

Back to top▴

installerid/version/LICENSE

The optional LICENSE file contains a plain-text version of the application's license agreement.

Back to top▴

installerid/version/init.xml

The version-level init.xml file contains information specific to this version of the application. Here is the format:

<?xml version='1.0'?>
<installer>
	<information>
		<info id="version" value="1.2.3"/>
		<info id="license" value="_apps_opensource"/>
		<info id="default-dir" value="default_directory_name"/>
		<info id="date" value="YYYY-MM-DD"/>
	</information>
	<links>
		<link id="admin" value="wp-admin/index.php"/>
		<link id="edit-1" value="wp-config.php"/>
		<link id="edit-2" value="other_editable_files.php"/>
	</links>
	<requirements>
		<requirement id="itron-version" value="5.0.0"/>
		<requirement id="diskspace" value="18"/>
		<requirement id="database" value="1"/>
		<requirement id="db-prefix-support" value="1"/>
		<requirement id="db-prefix-underscore" value="1"/>
		<requirement id="php-version-minimum" value="5.2.4"/>
		<requirement id="php-version-minimum" value=""/>
		<requirement id="perl-version-minimum" value=""/>
		<requirement id="perl-version-maximum" value=""/>
		<requirement id="mysql-version-minimum" value="5"/>
		<requirement id="mysql-version-maximum" value=""/>
		<requirement id="php-pdo-mysql-minimum" value="1.0"/>
		<requirement id="php-register-globals" value="0"/>
		<requirement id="php-safe-mode" value="0"/>
	</requirements>
	<archives>
		<archive id="main" url="url_to_main_archive" type="archive_type" md5="md5_value" />
		<archive id="xtra1" url="url_to_extra_archive_1" type="archive_type" md5="md5_value" />
		<archive id="xtra2" url="url_to_extra_archive_2" type="archive_type" md5="md5_value" />
	</archives>
	<skeleton>
		<file id="wp-admin"/>
		<file id="wp-content"/>
		<file id="wp-includes"/>
		<file id="wp-config.php" isconfig="true"/>
		<file id="wp-activate.php"/>
		<file id="wp-app.php"/>
		<file id="wp-blog-header.php"/>
		<file id="wp-comments-post.php"/>
		<file id="wp-cron.php"/>
		<file id="wp-links-opml.php"/>
		<file id="wp-load.php"/>
		<file id="wp-login.php"/>
		<file id="wp-mail.php"/>
		<file id="wp-pass.php"/>
		<file id="wp-register.php"/>
		<file id="wp-settings.php"/>
		<file id="wp-signup.php"/>
		<file id="wp-trackback.php"/>
		<file id="xmlrpc.php"/>
		<table id="commentmeta"/>
		<table id="comments"/>
		<table id="links"/>
		<table id="options"/>
		<table id="postmeta"/>
		<table id="posts"/>
		<table id="term_relationships"/>
		<table id="term_taxonomy"/>
		<table id="terms"/>
		<table id="usermeta"/>
		<table id="users"/>
	</skeleton>
	<fields>
		<field id="version">
			<get>
				<?php return $this->read("wp-includes/version.php""/wp_version = (['\"])(.+?);/"2);?>
			</get>
		</field>
		<field id="language">
			<get>
				<?php return $this->db_query("SELECT setting_value FROM {$this->db_prefix}settings WHERE setting_key='locale'"null"setting_value");?>
			</get>
			<set>
				<?php $this->db_query("UPDATE {$this->db_prefix}settings SET setting_value=? WHERE setting_key='locale'", array($this->input["field_language_value"]));?>
			</set>
		</field>
		<field id="login">
			<get>
				<?php return $this->db_query("SELECT user_login FROM {$this->db_prefix}users WHERE ID=?", array("1"), "user_login");?>
			</get>
			<set>
				<?php $this->db_query("UPDATE {$this->db_prefix}users SET user_login=? WHERE ID=?", array($this->input["field_login"], "1"));?>
			</set>
		</field>
		<field id="passwd">
			<set>
				<?php $this->db_query("UPDATE {$this->db_prefix}users SET user_password=? WHERE ID=?", array(md5($this->input["field_passwd"]), "1"));?>
			</set>
		</field>
	</fields>
	<languages>
		<language id="en" value="en-US"/>
		<language id="en_uk" value="en-GB"/>
		<language id="fr" value="fr-FR"/>
		<language id="nl" value="nl-NL"/>
		<language id="pt" value="pt-PT"/>
		<language id="pt_br" value="pt-BR"/>
	</languages>
</installer>

<information>

version is this version of the application (eg. "2.1.0p1").

license_type can be any text, or a reference to the application's locale file, or the global locale keys: _apps_free or _apps_opensource

default_directory_name is an optional default install directory name. If not present, the default directory when installing the application will be the installerid.

<links>

All links are optional, and all are relative to the install directory. admin adds an [admin] button to the Installed Apps page and is a link to an "administration" page. config is the same except it is for a [config] button. edit-1, edit-2, etc are files that can be edited inside Installatron (for templates or config files that can't be edited through the application itself).

<requirements>

requirements are all optional. Leave empty if the application doesn't have a specific requirement.

<archives>

archives are used to register archives for this version of the application. The "main" archive is required and "xtra1", "xtra2", etc are optional. The archive_type can be either: zip or tar.gz

md5_value is an optional md5 value for the archives, which is used by Installatron to check that the archive downloaded correctly. Editor automatically adds an md5 value when saving from the Version Info tab, if no md5 value is already present.

<skeleton>

skeleton contains a list of directories, files, and database tables included with the application. Database tables should be listed without a table prefix. Boolean flags are available, including isconfig, which informs Installatron which files contain the application's MySQL and other configuration values (needed when importing installed applications). This list also informs Installatron what should be removed when an application is uninstalled.

<fields>

fields gather information and interface directly with the installed application. Fields can be uni-directional or bi-directional.

These common fields are built-in:

In <get>, <set>, and <verify>, the PHP variable $this->input["field_fieldname"] always represents the input value of the field. As a special case for the language field, the PHP variable $this->input["field_language_value"] represents the application's language identifier for the selected language, as defined in the <languages> section (see below).

Custom fields can also be defined. Here's an example that uses many available options.

<field id="multisite" type="radio" value="no">
	<label>_info_enablemultisite</label>
	<options>
		<option value="no">_settings_enablemultisite_wordpress_no</option>
		<option value="yes">_settings_enablemultisite_wordpress_yes</option>
	</options>
	<get>
		<?php return $this->db_query("SELECT `option_value` FROM `{$this->db_prefix}options` WHERE `option_name`='is_multisite'"null"option_value");?>
	</get>
	<verify>
		<?php
if ( !isset($this->input["field_multisite"]) || strlen($this->input["field_multisite"]) < )
{
$this->addError("_errors_tooshort""field_multisite");
}
?> </verify> <set> <?php return $this->db_query("UPDATE `{$this->db_prefix}options` SET `option_value`=? WHERE `option_name`='is_multisite'", array($this->input["field_multisite"]));?> </set> </field>

<languages>

languages lists available UI languages and provides a way to relate the application's language identifiers with Installatron's language identifiers. See the Installatron Language Identifier table.

Back to top▴

installerid/version/install.php

The install.php file installs this version of the application.

The install process is comprised of steps, and each step is comprised of an _init (configures the page for the step), and a _process (performs actions).

Step 1 is a legeacy step and should be omitted.

Step 2 is usually used to extract the "main" archive (see the version/init.xml file above).

Step 4 is usually used as the main processing step. Here it CHMODS, moves and edits files, populates a database if the application uses one, and so on.

Here is the format, with some example content included:


<?php

class i_{INSTALLERID}_{STRIPPEDVERSION}_install extends i_action_install
{
   
//==========================================================================
    // STEP II: ARCHIVE EXTRACTION
    //==========================================================================

    
public function step2_init()
    {
        
$this->setStepLabel('_step_progress_extracting');
    }

    public function 
step2_process()
    {
        
// extract main archive:
        
$this->extract('main');
    }

    
//==========================================================================
    // STEP III: CONFIGURING INSTALL
    //==========================================================================

    
public function step3_init()
    {
        
$this->setStepLabel('_step_progress_processing');
    }

    public function 
step3_process()
    {
        
// THIS IS AN EXAMPLE SET OF INSTALL STEPS

        // move the contents of this directory back into the install directory
        
$this->mv('myapplication-2.0.0/*','.');

        
// chmod files and/or directories
        
$this->chmod(array('CHMOD_DIRECTORY_ONE','CHMOD_DIRECTORY_TWO'),0777);
        
$this->chmod(array('CHMOD_FILE_ONE','CHMOD_FILE_TWO','PATH/CHMOD_FILE_THREE'),0666);

        
// use regex to edit a file (replace the hard-coded table prefix with the Installatron-generated prefix)
        
$this->sr('INSTALL/MYSQL_FILE_ONE.sql''#PREFIX_#'$this->db_prefix);

        
// import a MySQL .sql file to create or populate the database
        
$this->db_import('INSTALL/MYSQL_FILE_ONE.sql');

        
// use regex to edit a file:
        // - insert the Installatron-generated database values into the config file
        // - insert the path and url into the config file
        
$this->sr("CONFIG_FILE.php", array(
                
"#DB_VAR_HOST = '.*?'#" => "DB_VAR_HOST = ".var_export($this->db_host,true),
                
"#DB_VAR_NAME = '.*?'#" => "DB_VAR_NAME = ".var_export($this->db_name,true),
                
"#DB_VAR_USER = '.*?'#" => "DB_VAR_USER = ".var_export($this->db_user,true),
                
"#DB_VAR_PASS = '.*?'#" => "DB_VAR_PASS = ".var_export($this->db_pass,true),
                
"#DB_VAR_PREF = '.*?'#" => "DB_VAR_PREF = ".var_export($this->db_prefix,true),

                
"#SCRIPT_PATH_VAR = '.*?'#" => "SCRIPT_PATH_VAR = ".var_export($this->path,true),
                
"#SCRIPT_URL_VAR = '.*?'#" => "SCRIPT_URL_VAR = ".var_export($this->url,true),

        ));

        
// execute the applications own install API
        
$this->fetch('install.php',array( 'mode' => 'automatic' ));

        
// clean up
        
$this->chmod('FILEONE',0644);
        
$this->rm(array('FILETWO','DIRECTORYONE'));

    }

}

?>

{INSTALLID} is the unique id of the installer.

{STRIPPEDVERSION} is the "version" with all non-alphanumeric characters replaced by underscores. For example, the strippedversion for '2.0 (p1)' would be: 2_0__p1_

Back to top▴

installerid/version/upgrade.php

The upgrade.php file upgrades an install to this version of the application from the previous version.

The upgrade file uses the same format as install.php (see above), with any number of steps and each step has an _init (for setting up the page for that step) and _process (for doing stuff). Unlike install.php, step 1 is not reserved for settings, and it's more common to have just one or two steps.

Here is the format, with some example content included:


<?php

class i_{INSTALLERID}_{STRIPPEDVERSION}_upgrade extends i_action_upgrade
{
    
//==========================================================================
    // STEP I: ARCHIVE EXTRACTION
    //==========================================================================

    
public function step1_init()
    {
        
$this->setStepLabel("_step_progress_extracting");
    }

    public function 
step1_process()
    {
        
$this->extract("xtra1""upgradetemp");
    }

    
//==========================================================================
    // STEP II: CONFIGURING INSTALL
    //==========================================================================

    
public function step2_init()
    {
        
$this->setStepLabel("_step_progress_processing");
    }

    public function 
step2_process()
    {
        
$this->rm("upgradetemp/config.php");
        
$this->mv("upgradetemp/*");
        
$this->rm("upgradetemp");

        
$this->fetch("upgrade/update_to_latest.php");
        
$this->rm("upgrade");
        
    }

}

?>

{INSTALLID} is the unique id of the installer.

{STRIPPEDVERSION} is the "version" with all non-alphanumeric characters replaced by underscores. For example, the strippedversion for '2.0 (p1)' would be: 2_0__p1_

Back to top▴

Using Your Installatron Application Package

There are three ways to add your Installatron application package to your server. The three methods are:

(Option 1) Use Installatron's addon-installer system.

Installatron's addon-installer system is the proper way to add an application package to Installatron.

To use the addon-installer system, you must use Application Package Editor.

An addon-installer is comprised of two files: the first is a tar.gz archive containing the application package (this is created by the editor). The second file is a controller file which looks like this:

<installer>
    <id>installerid</id>
    <build>build_number</build>
    <url>url_to_installer</url>
<installer>

installerid is the unique id of the installer.
build_number is the current build number of the installer. Increment this number whenever the installer is edited.
url_to_installer is a URL to the application package archive. The archive must be a gzip-compressed tar archive, and must be created using our Application Package Editor tool.

Example

Let's create an example application package with the id joomla.

When we're ready to test it we go to the Publisher tab and click the Publish button.

That will create an archive named joomla.tar.gz, which we download to our PC and then upload to a public web location somewhere. Let's upload it to http://my_domain/my_installers/joomla.tar.gz for this example.

Then we create this catalog file (or edit the one provided by Publisher) named joomla.xml:

<installer>
    <id>joomla</id>
    <build>1</build>
    <url>http://my_domain/my_installers/joomla.tar.gz</url>
<installer>

Now we upload that catalog file to the same location as the application package, which will make it: http://my_domain/my_installers/joomla.xml

Then we load up Installatron, navigate to Administration > Applications > Catalogs, and add this URL as a new catalog:

<url>http://my_domain/my_installers/joomla.xml</url>

Save that, and finally we navigate to Administration > License & Logs and click run Installatron updater now.

That will add the joomla application package to Installatron. Installatron will check the joomla.xml file each time an update/repair is run to see if the build number has changed. If it has changed, it will download the installer again.

More information is provided on the Publisher page in the editor.

(Option 2) Use WGET to download the application package directly from the editor to your server.

The wget shell command can be used to transfer application packages directly to the /var/installatron/installers directory. Details are provided on the Publisher tab in the editor.

This option is only available for PHP5 because PHP4 uses a different application package format, which must be created using the Publisher tool in the editor.

This approach is also good for quick development, but should only be used during development. Once an application package is finished, you should use method 1 above.

(Option 3) Manually add the application package to your server.

It's also possible to manually upload/make the files and directories directly in the /var/installatron/installers directory.

This option is only available for PHP5 because PHP4 uses a different installer format, which must be created using the Publisher tool in the editor.

If you are good with vim then this might be a quick way to edit and test your application package.

Back to top▴

Refrence: Variables, Commands, and How-Tos

This section lists the variables and commands that can be used in application package installer and upgrader code, and some how-to explanations. See the Overview section for a closer look at the packaging format.

Installer/Upgrader Variables

Installer/Upgrader Commands

Other Refrences

Back to top▴

Custom Fields

Custom fields defined in init.xml are used to collect information such as a password or email address that is then used to configure the install.

While most custom fields are bi-directional and have their own setter, all custom field values can be recalled in subsequent install methods (such as step2_process, etc.). For example:

$this->sr("config.php", "#'username'#", var_export($this->input['field_uname'],true));
$this->sr("config.php", "#'password'#", var_export(md5($this->input['field_passwd']),true));
$this->sr("config.php", "#'your@email.com'#", var_export($this->input['field_email'],true));
Back to top▴

Database: Host

The hostname of the MySQL server.

$this->db_host

// example
$this->sr("config.php", "#'localhost'#", $this->var_export($this->db_host));
Back to top▴

Database: User

The user of the MySQL database used by this install. This requires that the "database" requirement is enabled.

$this->db_user

// example
$this->sr("config.php", "#'database_user'#", $this->var_export($this->db_user));
Back to top▴

Database: Password

The password of the MySQL database used by this install. This requires that the "database" requirement is enabled.

$this->db_pass

// example
$this->sr("config.php", "#'database_password'#", $this->var_export($this->db_pass));
Back to top▴

Database: Name

The name of the MySQL database used by this install. This requires that the "database" requirement is enabled.

$this->db_name

// example
$this->sr("config.php", "#'database_username'#", $this->var_export($this->db_name));
Back to top▴

Database: Table Prefix

The prefix of the MySQL database table(s) used by this install. This requires that the "database" requirement is enabled.

$this->db_pass

// example
$this->sr("config.php", "#'table_prefix'#", $this->var_export($this->db_prefix));
Back to top▴

Install Location: Path

The location of the install as a local server path.

$this->path

// example
$this->sr("config.php", "#install_path#", $this->path);
Back to top▴

Install Location: URL

The location of the install as a URL (webpage location).

$this->url

// example
$this->sr("config.php", "#install_url#", $this->url);
Back to top▴

Install Location: URL Hostname

The hostname/domain portion of the URL, as retrieved from PHP's parse_url() function.

$this->url_domain

// example
$this->sr("config.php", "#'http://installdomain.com'#", $this->var_export($this->url_domain));
Back to top▴

Install Location: URL Path

The path portion of the URL, as retrieved by PHP's parse_url() function.

$this->url_path

// example
$this->sr("config.php", "#'/install_dir'#", $this->var_export($this->url_path));
Back to top▴

Time

The current server time, as a UNIX time stamp.

$this->systime
Back to top▴

CHMOD

Set Unix permissions for files or directories.

$this->chmod("file_or_directory", chmod_value [, diff_chmod_value_for_dirs = chmod_value [, recursive = false ]] );

// examples
$this->chmod("config.php", 0666);
$this->chmod("temp/uploads", 0777);
$this->chmod("data", 0666, 0777, true);
$this->chmod(array("config.php","data/level.inc"), 0644);
Back to top▴

CHOWN

Set Unix owner and group for files or directories. Typically files are written with the correct ownership and do not need modification.

$this->chown("file_or_directory", user [, group [, recursive = false ]] );

// examples
$this->chown("config.php", "bob");
$this->chown("config.php", "bob", "apache");
$this->chown("temp/uploads", "bob", null, true);
$this->chown(array("uploads","temp"), "apache", null, true);
Back to top▴

Copy

Copy files or directories.

$this->cp("source", "destination");

// examples
$this->cp("config-dist.php", "config.php");
$this->cp("inc/config.php", "admin/data.php");
Back to top▴

Extract Archive

Extract an archive. The archive must be registered in the version's init.xml file.

$this->extract("archive_id", "destination");

// examples
$this->extract("main", ".");
$this->extract("xtra1", "upgradetempdir");
$this->extract("chineselang", "plugins/locale");
Back to top▴

Fetch

Execute an external script over HTTP, usually to run an install or upgrade script. This is like loading the page in a web browser, however there is no visual output, and no interaction.

$result = $this->fetch("path_and_scriptname");

// examples
$this->fetch("install/install.php");
$this->fetch("upgrade.php?step=2&language=en");// a GET request
$this->fetch("upgrade.php",array( "step" => "2", "language" => "en" ));// a POST request
Back to top▴

Make Directory

Create a directory.

$this->mkdir("path_and_dirname");

// examples
$this->mkdir("temp");
$this->mkdir("temp/upload");
Back to top▴

Read File

Get the contents of a file.

$this->read("path_and_filename" [, "preg_filter", "preg_filter_capture" ]);

// example
$this->read("config.php");

// only read the value of the $wp_version variable
$this->read("config.php", "/wp_version = (['\"])(.+?)\\1;/", 2);
Back to top▴

Make File (Write)

Create a file.

$this->write("path_and_filename", "contents");

// examples
$this->write("config.php", "This is a config file.");
$this->write("inc/config.php", $myContents);
Back to top▴

Move

Move files or directories.

$this->mv("source" [, "destination" = "." ]);

// examples
$this->mv("config-dist.php", "config.php");
$this->mv("inc/config.php", "admin/data.php");

// move contents to the "install directory" examples
$this->mv("script-1.5.2/*");
$this->mv("script-1.5.2/upload/*");
Back to top▴

SQL Escape Value

Escape a value before using it with database commands, to remove the possibility of SQL injections.

$this->db_escape("text");

// example
$escaped_websitename = $this->db_escape($this->field['field_sitename']);
Back to top▴

SQL Import File

Import/execute a .sql script. This requires that the "database" requirement is enabled.

$this->db_import("path_and_file");

// examples
$this->db_import("mysql.sql");
$this->db_import("install/db/populate.sql");
$this->db_import("upgrade/45_to_46.sql");
Back to top▴

SQL Query

Execute a MySQL statement. This requires that the "database" requirement is enabled.

If an array of binded_variables are included, each will replace a corresponding question mark placeholder in the SQL statement. If select_this is included, this method will return the corresponding result value.

$this->db_query("sql_statement" [, binded_variables [, "select_this"] ]);

// examples
$this->db_query("INSERT INTO {$this->db_prefix}_config (name, age) VALUES('Bob', '20' ) ");

// example using $binded_variables
$this->db_query("UPDATE {$this->db_prefix}users SET username=? WHERE userid='0'", array("admin"));

// example using $binded_variables and $select_this
$login = $this->db_query("SELECT login FROM users WHERE ID=?", array("1"), "login");?>
Back to top▴

Remove

Remove (delete) files or directories.

$this->rm("path_and_target");

// examples
$this->rm("install");
$this->rm("*.php");
$this->rm("temp/*");
$this->rm(array("one.php","temp/two","admin/advanced/*.inc"));
Back to top▴

Search/Replace (Edit File)

Edit a file using PHP PREG search and replace.

$this->sr("path_and_file", "#regex_search#", "replace_value");
$this->sr("path_and_file", array( "#regex_search#" => "replace_value" ));

// examples
$this->sr("config.php", "#false#", "true");
$this->sr("config.php", "#\$installed\s+=\s+'0'#", "$installed = '1'");
$this->sr("config.php", "#(\$installed\s+=\s+')0'#", "{$1}0'");
$this->sr("data.php", "#(// SET THESE VALUES)#", "$newContent\n\n$1");

// database values examples
$this->sr("config.php", array(
	'#(\$hostname\s+=\s+)\'.*?\'#'      => "$1".$this->var_export($this->db_host),
	'#(\$database_name\s+=\s+)\'.*?\'#' => "$1".$this->var_export($this->db_name),
	'#(\$database_username\s+=\s+)\'.*?\'#' => "$1".$this->var_export($this->db_user),
	'#(\$database_password\s+=\s+)\'.*?\'#' => "$1".$this->var_export($this->db_pass),
	'#(\$table_prefix\s+=\s+)\'.*?\'#' => "$1".$this->var_export($this->db_prefix)
));

// custom input fields examples
$this->sr("install/mysql.sql", "#administrator#", "");
$this->sr("install/mysql.sql", "#548dfjfsd998dfs9kd#", md5($this->input['field_password']));
$this->sr("install/mysql.sql", "#your@email.com#", addslashes($this->input['field_email']));
Back to top▴

Var Export

Export a variable to be written to a PHP source file.

$this->var_export("value");

// examples
$ready_to_be_written_to_a_phpfile = $this->var_export($this->path);
Back to top▴

Language Identifier Refrence

This table lists Installatron's Language Identifier for most languages that are in use today (used for the XML <languages> tag). If support is required for a language that is not listed, please contact us.

abAbkhazianaceAcehnese (Acèh)achAcoliadaAdangmeadyAdyghe; Adygei
aaAfarafhAfrihiliafAfrikaansafaAfro-AsiaticainAinu
akAkanakkAkkadianalnAlbanian (Gegë)sqAlbanian (Shqip)alsAlemannisch
aleAleutalgAlgonquianamAmharicanpAngikaarArabic
arzArabic (Egyptian)aryArabic (Moroccan); MaġribianAragonésarcAramaicarpArapaho
arwArawakhyArmenianroa_rupArmãneashcerupAromanian; Arumanian; Macedo-RomanianfrpArpetan
asAssameseastAsturian; Bable; Leonese; AsturleoneseathAthapascanausAustralianavAvar
aeAvestanayAymaraazAzerbaijanibjnBahasa BanjarbqiBakhtiari
bccBalochi SouthernbmBambara (Bamanankan)jvBasa JawabaBashkirminBaso Minangkabau
euBasque (Euskera)beBelarusianbe_taraskBelarusian (Taraškievica)bemBembabnBengali
bhoBhojpuridzBhutani (Dzongkha)bhBiharibclBikol Central (Bicolano)bpyBishnupria
biBislamabarBoarischbsBosanskibrBretonbugBuginese
bgBulgarianmyBurmesecpsCapiceñocaCatalancebCebuano
chChamorrocbkChavacano (Spanish)cbk_zamChavacano de ZamboangaceChechenchrCherokee
chyCheyennenyChichewaganChinese GanhakChinese HakkaczhChinese Huizhou
cjyChinese JinyucmnChinese MandarinmnpChinese Min BeicdoChinese Min DongnanChinese Min Nan
czoChinese Min ZhongcpxChinese Pu XianwuuChinese WuhsnChinese XiangyueChinese Yue (Cantonese)
choChoctawcvChuvashseiCmique ItomkwCornishcoCorsican
hrCroatiandaDanskpdcDeitschdeDeutschndsDeutsch (Plattdüütsch)
de_chDeutsch (Schweizer Hochdeutsch)de_formalDeutsch (Sie-Form)de_atDeutsch (Österreichisches)dsbDolnoserbskidtpDusun Bundu-liwan
emlEmiliàn e rumagnòlenEnglishangEnglish (Old)en_ukEnglish (United Kingdom)myvErzya
es_419Español (Latin American)es_mxEspañol (Mexico)esEspañol (Spanish)eoEsperantoetEstonian
extEstremeñueeEwefoFaroesefjFijianhifFiji Hindi
filFilipinovlsFlemish (West-Vlams)frFrançaisfrcFrançais (Cadien)fyFrysk
ffFulfuldefurFurlanglGaelggagGagauzkaGeorgian
glkGilakigotGothicklGreenlandicgnGuaraniguGujarati
htHaitian CreolehaHausahawHawai`iheHebrewhzHerero
hiHindihoHiri MotuhsbHornjoserbsceisIcelandicioIdo
igIgboiloIlokanohilIlonggoidIndonesianinhIngush
iaInterlinguaieInterlingueiuInuktitutike_cansInuktitut (ᐃᓄᒃᑎᑐᑦ)ikInupiak
gaIrishitItalianoit_formalItaliano (Formal)jaJapanesejwJavanese
jutJyskkbdKabardianxalKalmykknKannadakrKanuri
pamKapampangankrcKarachay-BalkarksKashmiricsbKaszëbsczikkKazakh
kmKhmer (Cambodian)khwKhowarkiKikuyukrjKinaray-arwKinyarwanda
kiuKirmanjkirnKirundikvKomikoiKomi-PermyakkgKongo
koKoreanavkKotavakriKriokuKurdishckbKurdish (Central)
kjKwanyamakyKyrgyzladLadinolbeLakloLaothian
ltgLatgaļulaLatinlvLatvianlzzLazurilezLezghian
ltLietuvių (Lithuanian)lijLigureliLimburgslnLingalalfnLingua Franca Nova
lzhLiterary Chinese (Classical)livLivjboLojbanlolLolspeaklgLuganda
lmoLumbaartluoLuolbLuxembourgishmkMacedonianhuMagyar (Hungarian)
vmfMainfränkischmaiMaithilimgMalagasymsMalay (Bahasa Malaysia)mlMalayalam
dvMaldivianmtMaltesegvManxmiMaoriarnMapuche (Mapudungun)
mhrMari (Eastern)mrjMari (Western)mhMarshallesemfeMauritian CreolemznMazanderani
xmfMingrelianmwlMirandésmdfMokshamoMoldavianmnMongolian
sr_meMontenegrinmusMvskokenaNaurunvNavajongNdonga
nlNederlands (Dutch)nl_informalNederlands InformeelnewNepal BhasaneNepaliniuNiuē
napNnapulitanofrrNordfriiskpihNorfuk; PitkernndNorth NdebelenoNorwegian
nbNorwegian (Bokmål)nnNorwegian (Nynorsk)nrmNouormandnahNāhuatlcrNēhiyawēwin (Cree)
ocOccitancuOld SlavonicorOriyaomOromoosOssetian
pagPangasinanpnbPanjabi (Western)papPapiamentupsPashtofaPersian
pflPfaelzischpcdPicardpmsPiemontesecpePijin SolomonpdtPlautdietsch
plPolskipntPonticptPortuguês (Portuguese)pt_brPortuguês do BrasilprgPrūsiskan
paPunjabikaaQaraqalpaqshaquQuechuacrhQırımtatarca (Chimean Tatar)kshRipoarisch
rgnRomagnolrmyRomaniruqRomanian MeglenormRomanshroRomână
qugRuna shimibxrRussia BuriatruRussianseSami (Northern)smaSami (Southern)
smSamoansgsSamogitiansgSangosaSanskritscSardinian
sdcSassaresusliSchläschscoScotsgdScots GaelicstqSeeltersk
srSerbiansr_elSerbian (Srpski)sr_ecSerbian (Српски)shSerbo-CroatianstSesotho
tnSetswanasnShonaiiSichuan Yi; NuosuscnSicilianuszlSilesian
lozSilozisdSindhisiSinhalesessSiswatiskSlovak (Slovakian)
slSlovenščina (Slovenian)soSomalinsoSotho (Northern); Pedi; SepedialtSouthern AltainrSouth Ndebele
srnSranantongosuSundanesefiSuomiswSwahilisvSwedish
gswSwiss GermanshiTachelhittlTagalogtyTahitiantgTajik
taTamilkabTaqbaylitroa_taraTarandínerifTarifitttTatar
teTelugutetTetunthThaiboTibetantiTigrinya
tpiTok PisintoTongaluTshilubatsTsongatcyTulu
tumTumbukatkTurkmentvlTuvaluantyvTuviniantwTwi
trTürkçe (Turkish)udmUdmurtugUighururUrduuzUzbek
veVendavecVenetianvepVepsanviVietnamesevoVolapük
votVoticvroVõrowaWaloncyWelshwarWinaray
woWolofxhXhosasahYakutyiYiddishyoYoruba
diqZazakizeaZeeuwszaZhuangzuZulucsČesky (Czech)
cs_informalČesky NeformálníelΕλληνικά (Greek)rueРусиньскый (Rusyn)ukУкраїнська (Ukrainian)piपािऴ (Pali)
mrमराठी (Marathi)grcἈρχαία ἑλληνικὴ (Ancient Greek)zh中文 (Chinese Simplified)zh_tw中文(台灣) (Chinese Traditional)
Back to top▴

Troubleshooting

If your application package isn't displaying or installing, the first place to check is the Installatron logs. These can be viewed from Administration, or if you need to see more than just the last few lines you can find them here:

/var/installatron/logs

The filesystem_log is usually the most useful as it logs the result of every $this-> command. The fetch_log logs the result of every call to a URL, so that includes all control panel API calls, all downloads, and all $this->fetch() commands.

Browse below for some of the more common application package problems and their fixes.

archive 'main' not found

CAUSE

Installatron failed to download the 'main' archive.

The causes are usually either a) the archive is not at a publically accessible location, or b) the MD5 checksum is wrong.

DOWNLOAD LOCATION SOLUTION

Make sure that the URL to the archive can be downloaded with a wget command from the server. If wget can get the file then Installatron can too.

INCORRECT MD5 CHECKSUM SOLUTION

The MD5 checksum, used to verify that the archive has downloaded correctly, is not shown in the Editor GUI at this time so to fix it you need to:

my application package isn't listed

CAUSE

If the application package is listed in Administration > Access Groups > Edit but is not showing in the Application Browser then the cause is usually requirement filtering.

SOLUTION

Check the requirements you have configured for the script (Editor > Version Info > Requirements) and compare them with the Administration > Applications > Dependencies configuration in Installatron.

Back to top▴

Change log

© 2004 - 2014 Installatron LLC. All rights reserved.