LG Addon Updater v1.0.2 Notify users of ExpressionEngine extension, module and plugin updates
Download LG Addon Updater v1.0.2 Table of contentsFeatures
LG Addon Updater is an extension that allows 3rd party ExpressionEngine developers to notify users of updates to installed addons (plugins, extensions, modules).
All developers have to do is register their addons using a couple of simple hooks and an xml file. LG Addon Updater downloads the xml which contains information about the developers addons and compares it to the currently installed versions. The xml file is cached for a user determined period of time and any updates displayed to the use on the CP homepage.
LG Addon Updater is MSM compatible and can be enabled on a per site basis.
Screenshots
Requirements
LG Addon Updater requires ExpressionEngine 1.6+ and either CURL or fsockopen() enabled.
Installation
The LG Addon Updater extension contains an extension and language file. To install LG Addon Updater follow the instructions below:
- Download the latest version of LG Addon Updater
- Extract the .zip file to your desktop
- Copy extensions/ext.lg_addon_updater_ext.php directory to your /system/extensions directory
- Copy the language/english/lang.lg_addon_updater_ext.php file to your /system/languages/english directory
- Open the Extension Manager
- Enable Extensions if not already enabled
- Enable the extension
- Configure the extension settings
Configuration
LG Addon Updater has the following extension settings which need to be entered separately for each site:
Check for updates?
Check third party developers websites for updates to their extensions.
Cache Timeout
How many minutes you like the update check cached for? The more time the results are cached the less your CP homepage will need to check third party sources.
Check for Lg Addon extension Updates?
LG Addon Updater can call home and check to see if the extension has been updated.
Usage
LG Addon Updater is not designed to be implemented by site administrators or end users. It is a developers extension written to facilitate easy delivery of update notifications when an ExpressionEngine addon is updated.
To include a new addon in the update check you must first register a source file and addon id with LG Addon Updater.
Creating a source file
A source file is just a simple XML file that lists all a developers addons with version numbers, last updated UNIX timestamp and documentation url. It looks like this:
<versions>
<addon id='LG Addon Updater' version='1.0.1' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-addon-updater/" />
<addon id='LG Add Sitename' version='1.2.2' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-add-sitename/" />
<addon id='LG Better Meta Commercial' version='1.6.2' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-better-meta/" />
<addon id='LG Member List' version='1.3.3' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-member-list/" />
<addon id='LG Member Form Customiser' version='1.2.1' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-member-form-customiser/" />
<addon id='LG Multi Language' version='1.0.2' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-multi-language/" />
<addon id='LG Polls' version='1.1.0' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-polls/" />
<addon id='LG Social Bookmarks' version='2.0.1' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-social-bookmarks/" />
<addon id='LG TinyMCE' version='1.3.3' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-tinymce/" />
<addon id='LG Twitter' version='2.0.1' last_updated="1219175483" docs_url="http://leevigraham.com/cms-customisation/expressionengine/lg-twitter/" />
</versions>
The source file must contain a root <versions> node and at least one <addon> child node.
The <addon> node must have the following attributes:
id
A unique id for your addon. This id is the same used in the lg_addon_update_register_addon hook.
version
The current addon version.
last_updated
The time the addon was last updated in UTC as a UNIX timestamp. Why a UNIX timestamp? Well its the best way to ensure that all users see a correct localised time.
docs_url
The URL where the addon documentation and download is available.
Registering your addon
LG Addon uses ExpressionEngine's extension hook system to make registering a new addon super easy. The two new hooks you will need are lg_addon_update_register_source and lg_addon_update_register_addon.
lg_addon_update_register_source
This hook registers a new source file. This hook returns data so make sure you check if anyone else is using the hook by testing $EXT->last_call.
An example of the function called by the lg_addon_update_register_source hook:
/**
* Register a new Addon Source
*
* @param array $sources The existing sources
* @return array The new source list
* @since version 1.0.0
*/
function register_my_addon_source($sources)
{
global $EXT;
// -- Check if we're not the only one using this hook
if($EXT->last_call !== FALSE)
$sources = $EXT->last_call;
// add a new source
// must be in the following format:
/*
<versions>
<addon id='LG Addon Updater' version='2.0.0' last_updated="1218852797" docs_url="http://leevigraham.com/" />
</versions>
*/
if($this->settings['check_for_extension_updates'] == 'y')
{
$sources[] = 'http://leevigraham.com/version-check/versions.xml';
}
return $sources;
}
lg_addon_update_register_addon
This hook registers a new 3rd party addon. This hook returns data so make sure you check if anyone else is using the hook by testing $EXT->last_call.
An example of the function called by the lg_addon_update_register_addon hook:
/**
* Register a new Addon
*
* @param array $addons The existing sources
* @return array The new addon list
* @since Version 1.0.0
*/
function register_my_addon_id($addons)
{
global $EXT;
// -- Check if we're not the only one using this hook
if($EXT->last_call !== FALSE)
$addons = $EXT->last_call;
// add a new addon
// the key must match the id attribute in the source xml
// the value must be the addons current version
if($this->settings['check_for_extension_updates'] == 'y')
{
$addons[LG_AU_addon_id] = $this->version;
}
return $addons;
}
More Examples
The best example of how to register your addon is to look at the LG Addon extension source code. The extension actually registers itself to check for updates so use it as an example.
Change Log
1.0.2
- PHP4 fixes or should I say downgrade?
1.0.1
- Added CP homepage check to reduce object initialisation and hook method calling; basically a speed improvement.
1.0.0
- Initial Release
License
LG Addon Updater is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Contributors
Make a donation of $30 or more and get your website listed.
Page created on: Aug 21, 2008
Last updated on: Sep 27, 2008
Enjoy LG Addon Updater v1.0.2? Bookmark and share it with others.