|
Module Online Installation and Upgrading
Where are the modules in SVN?
- Module releases (.tgz files)
- Module stable code
- Module development code
How does the Online Module admin know about available modules?
Good question! A modules-X.X.xml file is generated for each released (stable) version of FreePBX. This is done by collecting all the module.xml info from the stable module code branches @ https://svn.sourceforge.net/svnroot/amportal/modules/branches/2.x/. The resulting modules-X.X files are available at http://amportal.sourceforge.net/
The Online Module admin, reads these files and compares what's available with what is installed locally. From this it can determine if a module is installed, not installed, or needs an upgrade.
Goals
- Store modules in an online repository (freepbx.org or sf.net)
- From admin, see a list of available modules
- 3rd party modules need to be approved to find their way into the list
- Modules are installed by using web admin
Plan
- each module contains a module.xml that defines the module and it's requirements
- requirements include freepbx version, and dependancies on other modules
- Run a web-service on sf.net to return/generate a master modules.xml
- The web service parses all the "svn:../amportal/modules/<modulename>/module.xml" directories, and writes out a master modules.xml, which describes each module and it's dependancies. Basically it only needs to glue the individual module.xml files together
- freepbx then parses modules.xml and determines what are available given it's version and installed modules - displaying what's available appropriately
- Module.xml files define whether official or unofficial, where unofficial modules have only seen limited testing .. no support from the core freepbx team.
- php xml stuff http://au3.php.net/manual/en/ref.xml.php
- modules.xml sample
- HTTP access to SVN is used for downloading modules
- modules/release/2.x/modulename-rev.tar.gz
- modules/devel/modulename/page.modulename.php
- modules/release/modules.xml
- 3rd party module submissions are to be submitted as a Ticket. If approved, they are added to SVN by someone in the DEV team.
Publishing a Module
Work in progress!
I've got a svn checkout of the modules as /usr/src/freepbx-modules
- svn co https://svn.sourceforge.net/svnroot/amportal/modules /usr/src/freepbx-modules
In the 2.1 and 2.2 directories there's a publish.pl script that creates the tar.gz file, updates the md5 and location in the xml, and publishes them both. So lets say you've made a change to module foo.
- save and commit your changes
- edit the xml file, bump the version by whatever you think is appropriate (That's all you need to do - it updates the md5 and location string for you)
- from the 2.1 directory run
- ./publish.pl foo
This generates foo-versionname.tar.gz, sticks it in ../../release (this is why you need a complete checkout of the entire modules tree) updates the xml file with the new location and md5sum, and publishes both You also need to run ./mod.php on shell.sourceforge.net (in /home/groups/a/am/amportal) to update the online xml file, but this should be run automatically - something for ryan to fix.
RC: Runs once an hour via cron
Rob's Random Waffling
- How do we find out if a module is installed?
- RC: Done, we compare "installed" array to "online" array
- Note to self - need to ensure that the default install.sql includes 'core' installed.
- Modules need to take care of upgrading themselves (check the various _init's in IVR, recordings, paging), can't rely on install_amp to do it
- OK, each module does an _init to check it's version, and if it's unhappy, does a require 'install.php'. EVERY module must have that
- RC: Done - although I haven't ensured that all existing modules have an install.php
- OK, each module does an _init to check it's version, and if it's unhappy, does a require 'install.php'. EVERY module must have that
- XML should be cached as a blob in the database, with a timestamp. Don't download if it's less than n(4 hours?) old.
- RC: Done - regrab after 2 hours
- Are sourceforge going to get grumpy with A@H/freePBX users sucking the guts out of their subversion server?
- We'll deal with this when they complain :-) Everything has been designed in such a way that it would be easy to move the released module.tgz's elsewhere
- How do modules report their verson number? Need to check if module_version < $arr[VERSION?
- php's version_compare() ?
- RC: Done, find_allmodules() now uses version_compare()
- php's version_compare() ?
- Should there be a seperate page for online? Perhaps just a button 'update online modules' which will say 'IVR: Upgrade Available'
- Pretty colours - red for failed dependancy, green for OK to be installed, white for installed? Yellow for unofficial?
- PGP ?? md5sum ??
- Rob: MD5's are generated automatically by publish.pl
