Creating a simple module/Adding Auto Update

From Joomla! Documentation

< Archived:Creating a simple module

This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

This section of the tutorial will help you create an update server so that your module can utilize the Joomla one-click-upgrade system.

Introduction & Pre-reading[edit]

The first thing to do is to read the Managing Component Upgrades with Joomla 2.5 - Part 1 tutorial to give an idea of how the upgrade process works in Joomla. Also read Deploying an update server - this is what we'll be implementing in this tutorial.

Remember that sql update file we mentioned in the Using the database section? That will be used to update our database still. Whilst a new zipped version of our module will be used to update all the php files. To keep this simple for now we will update the files and sql database without any checks for Joomla version and the version of the module that is currently installed (it is recommended these are used in a production module).

Updating our module[edit]

The only way to update our existing module is to add in a update server into the xml file.

	<server type="extension" name="Helloworld" priority="1"></server>

Joomla will now search for updates with a frequency set in the extension manager options.

Creating an update[edit]

So now that Joomla is searching for updates to our extension - lets create one to test out our process.

Create a copy of the module as it is now. Then lets update the version number to 1.0.1, and also we'll add something into our Update SQL file - in this case an extra German Language file

INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Hallo Welt', 'de-DE');

Note we can also edit any of our php files - all the existing php files will be overridden by the ones in the update file (Note: This is the reason why core hacks of any extension are discouraged - they will be lost on the extension update).

Now we must create the xml file at to let Joomla know an update is available.

		<description>This is mod_helloworld 1.0.1</description>
			<downloadurl type="full" format="zip"></downloadurl>
		<targetplatform name="joomla" version="2.5"/>

where is the zip of our newly created update. If you now log into the backend of Joomla you should now see in the control panel that an automatic update is available (if not you may need to purge your cache in the update section of the extension manager). Simply click update and you'll find your module has been updated to version 1.0.1.

Commercial Modules[edit]

Note that in our files we have linked to the extensions updates xml file. And from that xml file we have a location for the zip of the module. This means that if someone were to track this backwards they could find the physical source of your modules zip file (and make it available/use it after a subscription has expired etc.). For this reason generally commercial modules do not contain automatic updates (although they often will inform you of updates in some alternative way).


Updating modules in Joomla is really easy for both users and the extension developers to perform and should be expected as standard with any module since Joomla 2.5.