HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Module installation

ocPortal addon versioning is done on two levels:
  • The addon itself (this is for the user's benefit only)
  • The modules/blocks within the addon

ocPortal modules auto-install/auto-upgrade when accessed. They also auto-install when an addon containing them is installed for the first time.

The 'install' code typically creates database tables.

Versioning ocPortal modules or blocks is done as follows…

PHP code

/**
 * Standard modular info function.
 *
 * @return ?array    Map of module info (NULL: module is disabled).
 */
function info()
{
    
$info=array();
    ...
    
$info['version']=2;
    
// Setting 'update_require_upgrade' makes ocPortal realise it can do an upgrade
    //  At run-time it will compare the version in the database, to the version above and auto-upgrade if required
    
$info['update_require_upgrade']=1;
    ...
    return 
$info;
}

/**
 * Standard modular uninstall function.
 */
function uninstall()
{
    ...
}

/**
 * Standard modular install function.
 *
 * @param  ?integer    What version we're upgrading from (NULL: new install)
 * @param  ?integer    What hack version we're upgrading from (NULL: new-install/not-upgrading-from-a-hacked-version)
 */
function install($upgrade_from=NULL,$upgrade_from_hack=NULL)
{
    if (
is_null($upgrade_from))
    {
        
// Code for initial install goes here
        
...
    }

    if ((!
is_null($upgrade_from)) && ($upgrade_from<2))
    {
        
// Code from upgrading from v1 goes here (1<2)
        
...
    }
}


If a user is installing an addon, it will install any modules/blocks within it, if said module/block was not already installed.

If a user is uninstalling an addon, it will uninstall any modules/blocks within it.

A user should upgrade an addon by installing it on top of itself. i.e. don't uninstall the old version, but install the new version on top. ocPortal detects not to do a reinstall via this code in the sources/addons.php file:

PHP code

if (!module_installed($matches[2]))
    
reinstall_module($zone,$matches[2]);

There are no pages beneath this page

There are no posts yet

CEDI change-log Post